@liguelead/design-system 0.0.35 → 0.0.37
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/components/Alert/Alert.stories.tsx +10 -4
- package/components/Alert/Alert.style.ts +1 -1
- package/components/Alert/Alert.tsx +10 -2
- package/components/Alert/Alert.types.ts +1 -0
- package/components/Alert/Alert.variants.ts +2 -4
- package/components/Button/Button.appearance.ts +3 -4
- package/components/Button/Button.styles.ts +0 -1
- package/components/Button/Button.tsx +4 -7
- package/components/Checkbox/Checkbox.tsx +5 -5
- package/components/Dialog/Dialog.style.ts +2 -1
- package/components/Dialog/Dialog.tsx +6 -8
- package/components/IconButton/IconButton.tsx +3 -1
- package/components/LinkButton/LinkButton.tsx +3 -1
- package/components/PageWrapper/PageWrapper.tsx +1 -1
- package/components/Skeleton/Skeleton.stories.tsx +126 -0
- package/components/Skeleton/Skeleton.styles.ts +15 -0
- package/components/Skeleton/Skeleton.tsx +38 -0
- package/components/Skeleton/Skeleton.types.ts +9 -0
- package/components/Skeleton/index.ts +2 -0
- package/components/SplitButton/SplitButton.tsx +1 -1
- package/components/Tabs/Tabs.tsx +2 -0
- package/components/TextField/TextField.tsx +12 -7
- package/components/Toaster/Toaster.ts +5 -19
- package/components/index.ts +2 -0
- package/package.json +3 -2
|
@@ -55,6 +55,11 @@ Componente de alerta para comunicar mensagens de feedback ao usuário.
|
|
|
55
55
|
control: 'text',
|
|
56
56
|
description: 'URL do botão de ação',
|
|
57
57
|
},
|
|
58
|
+
openNewTab: {
|
|
59
|
+
control: 'boolean',
|
|
60
|
+
description: 'Abre o link do botão em uma nova aba',
|
|
61
|
+
table: { defaultValue: { summary: 'false' } },
|
|
62
|
+
},
|
|
58
63
|
},
|
|
59
64
|
}
|
|
60
65
|
|
|
@@ -87,13 +92,14 @@ export const TodasVariantes: Story = {
|
|
|
87
92
|
export const ComBotao: Story = {
|
|
88
93
|
name: 'Com botão de ação',
|
|
89
94
|
parameters: {
|
|
90
|
-
docs: { description: { story: 'Use `hasButton` quando houver uma ação clara para o usuário tomar.' } },
|
|
95
|
+
docs: { description: { story: 'Use `hasButton` quando houver uma ação clara para o usuário tomar. Use `openNewTab` para abrir o link em nova aba.' } },
|
|
91
96
|
},
|
|
92
97
|
render: () => (
|
|
93
98
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
94
|
-
<Alert variant="info" title="Nova versão disponível" description="Uma atualização está pronta para ser instalada." hasButton buttonLabel="Atualizar agora" href="#" />
|
|
95
|
-
<Alert variant="warning" title="Sessão expirando" description="Sua sessão expira em 5 minutos." hasButton buttonLabel="Renovar sessão" href="#" />
|
|
96
|
-
<Alert variant="danger" title="Falha no pagamento" description="Não foi possível processar seu pagamento." hasButton buttonLabel="Tentar novamente" href="#" />
|
|
99
|
+
<Alert variant="info" title="Nova versão disponível" description="Uma atualização está pronta para ser instalada." hasButton buttonLabel="Atualizar agora" href="#" openNewTab={false} />
|
|
100
|
+
<Alert variant="warning" title="Sessão expirando" description="Sua sessão expira em 5 minutos." hasButton buttonLabel="Renovar sessão" href="#" openNewTab={false} />
|
|
101
|
+
<Alert variant="danger" title="Falha no pagamento" description="Não foi possível processar seu pagamento." hasButton buttonLabel="Tentar novamente" href="#" openNewTab={false} />
|
|
102
|
+
<Alert variant="info" title="Documentação disponível" description="Acesse a documentação completa no portal." hasButton buttonLabel="Ver documentação" href="#" openNewTab />
|
|
97
103
|
</div>
|
|
98
104
|
),
|
|
99
105
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useTheme } from 'styled-components'
|
|
1
2
|
import Text from '../Text'
|
|
2
3
|
import LinkButton from '../LinkButton'
|
|
3
4
|
|
|
@@ -17,10 +18,12 @@ const Alert = ({
|
|
|
17
18
|
description,
|
|
18
19
|
href,
|
|
19
20
|
children,
|
|
21
|
+
openNewTab,
|
|
20
22
|
title,
|
|
21
23
|
hasButton
|
|
22
24
|
}: TAlertProps) => {
|
|
23
|
-
const
|
|
25
|
+
const theme = useTheme()
|
|
26
|
+
const alertVariant = AlertVariant(variant, theme)
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
29
|
<AlertContainer $variant={alertVariant} className={className}>
|
|
@@ -45,7 +48,12 @@ const Alert = ({
|
|
|
45
48
|
</AlertContent>
|
|
46
49
|
{hasButton && (
|
|
47
50
|
<AlertButtonContainer>
|
|
48
|
-
<LinkButton
|
|
51
|
+
<LinkButton
|
|
52
|
+
href={href || ''}
|
|
53
|
+
target={openNewTab ? '_blank' : undefined}
|
|
54
|
+
>
|
|
55
|
+
{buttonLabel}
|
|
56
|
+
</LinkButton>
|
|
49
57
|
</AlertButtonContainer>
|
|
50
58
|
)}
|
|
51
59
|
</AlertContainer>
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { parseColor } from '../../utils'
|
|
2
|
-
import {
|
|
2
|
+
import { DefaultTheme } from 'styled-components'
|
|
3
3
|
|
|
4
4
|
type TVariant = 'success' | 'danger' | 'warning' | 'info' | 'default'
|
|
5
5
|
|
|
6
|
-
export const AlertVariant = (variant: TVariant) => {
|
|
7
|
-
const theme = useTheme()
|
|
8
|
-
|
|
6
|
+
export const AlertVariant = (variant: TVariant, theme: DefaultTheme) => {
|
|
9
7
|
const variants = {
|
|
10
8
|
success: `
|
|
11
9
|
border-left: 8px solid ${parseColor(theme.colors.success100)};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ButtonVariantTypes } from './Button.types'
|
|
2
2
|
import { colorType } from '../../types'
|
|
3
|
-
import {
|
|
3
|
+
import { DefaultTheme } from 'styled-components'
|
|
4
4
|
import { darkenOrLighten, getTextColor, parseColor, getHoverColor } from '../../utils'
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
export const ButtonVariant = (
|
|
8
8
|
color: colorType,
|
|
9
|
-
variant: ButtonVariantTypes
|
|
9
|
+
variant: ButtonVariantTypes,
|
|
10
|
+
theme: DefaultTheme
|
|
10
11
|
) => {
|
|
11
|
-
const theme = useTheme();
|
|
12
|
-
|
|
13
12
|
const colorValue = theme.colors[color];
|
|
14
13
|
|
|
15
14
|
if (!colorValue) {
|
|
@@ -11,7 +11,6 @@ export interface StyledButtonProps extends ButtonProps {
|
|
|
11
11
|
export const StyledButton = styled.button<StyledButtonProps>`
|
|
12
12
|
position: relative;
|
|
13
13
|
display: flex;
|
|
14
|
-
outline: none !important;
|
|
15
14
|
justify-content: center;
|
|
16
15
|
align-items: center;
|
|
17
16
|
width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components'
|
|
2
3
|
import { StyledButton, RippleContainer } from './Button.styles'
|
|
3
4
|
import { RippleInterface, ButtonProps } from './Button.types'
|
|
4
5
|
import { ButtonSizes } from './Button.sizes'
|
|
@@ -16,14 +17,11 @@ const Button: React.FC<ButtonProps> = ({
|
|
|
16
17
|
type = 'button',
|
|
17
18
|
...rest
|
|
18
19
|
}) => {
|
|
20
|
+
const theme = useTheme()
|
|
19
21
|
const [ripples, setRipples] = useState<RippleInterface[]>([])
|
|
20
22
|
|
|
21
23
|
const buttonSize = ButtonSizes(size)
|
|
22
|
-
const buttonVariant = ButtonVariant(color, variant)
|
|
23
|
-
|
|
24
|
-
const removeRipple = (ripples: RippleInterface[], rippleId: string) => {
|
|
25
|
-
return ripples.filter(r => r.id !== rippleId)
|
|
26
|
-
}
|
|
24
|
+
const buttonVariant = ButtonVariant(color, variant, theme)
|
|
27
25
|
|
|
28
26
|
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
29
27
|
const rect = e.currentTarget.getBoundingClientRect()
|
|
@@ -37,7 +35,6 @@ const Button: React.FC<ButtonProps> = ({
|
|
|
37
35
|
}
|
|
38
36
|
setRipples(prev => [...prev, newRipple])
|
|
39
37
|
|
|
40
|
-
// Chama o onClick fornecido
|
|
41
38
|
if (onClick) {
|
|
42
39
|
onClick(e)
|
|
43
40
|
}
|
|
@@ -65,7 +62,7 @@ const Button: React.FC<ButtonProps> = ({
|
|
|
65
62
|
height: 20
|
|
66
63
|
}}
|
|
67
64
|
onAnimationEnd={() =>
|
|
68
|
-
setRipples(prev =>
|
|
65
|
+
setRipples(prev => prev.filter(r => r.id !== ripple.id))
|
|
69
66
|
}
|
|
70
67
|
/>
|
|
71
68
|
))}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
1
|
+
import React, { useEffect, useState } from 'react'
|
|
2
2
|
import { CheckboxProps } from './Checkbox.types'
|
|
3
3
|
import {
|
|
4
4
|
CheckboxWrapper,
|
|
@@ -31,9 +31,9 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
31
31
|
)
|
|
32
32
|
const [ripples, setRipples] = useState<RippleInterface[]>([])
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (checked !== undefined) setInternalChecked(checked)
|
|
36
|
+
}, [checked])
|
|
37
37
|
|
|
38
38
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
39
39
|
onChange?.(e)
|
|
@@ -78,7 +78,7 @@ const Checkbox: React.FC<CheckboxProps> = ({
|
|
|
78
78
|
height: 20
|
|
79
79
|
}}
|
|
80
80
|
onAnimationEnd={() =>
|
|
81
|
-
setRipples(prev =>
|
|
81
|
+
setRipples(prev => prev.filter(r => r.id !== ripple.id))
|
|
82
82
|
}
|
|
83
83
|
/>
|
|
84
84
|
))}
|
|
@@ -9,6 +9,7 @@ export const Overlay = styled(DialogPrimitive.Overlay)`
|
|
|
9
9
|
background: rgba(0, 0, 0, 0.3);
|
|
10
10
|
position: fixed;
|
|
11
11
|
inset: 0;
|
|
12
|
+
z-index: 9999;
|
|
12
13
|
`
|
|
13
14
|
|
|
14
15
|
export const Content = styled(DialogPrimitive.Content)<{$centerContent?: boolean}>`
|
|
@@ -27,7 +28,7 @@ export const Content = styled(DialogPrimitive.Content)<{$centerContent?: boolean
|
|
|
27
28
|
top: 8vh;
|
|
28
29
|
left: 50%;
|
|
29
30
|
transform: translateX(-50%);
|
|
30
|
-
z-index:
|
|
31
|
+
z-index: 10000;
|
|
31
32
|
`
|
|
32
33
|
|
|
33
34
|
export const TitleDescriptionContainer = styled.div<{$centerContent?: boolean, $variant?: variant}>`
|
|
@@ -40,7 +40,7 @@ export const Dialog: React.FC<TDialogProps> = ({
|
|
|
40
40
|
onOpenChange={onOpenChange}
|
|
41
41
|
>
|
|
42
42
|
{trigger
|
|
43
|
-
&& <DialogPrimitive.Trigger asChild
|
|
43
|
+
&& <DialogPrimitive.Trigger asChild>
|
|
44
44
|
{trigger}
|
|
45
45
|
</DialogPrimitive.Trigger>
|
|
46
46
|
}
|
|
@@ -85,15 +85,13 @@ export const Dialog: React.FC<TDialogProps> = ({
|
|
|
85
85
|
)}
|
|
86
86
|
|
|
87
87
|
<ButtonContainer $centerContent={centerContent}>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<Button
|
|
91
|
-
variant="neutralOutline"
|
|
92
|
-
>
|
|
88
|
+
{cancelButton && (
|
|
89
|
+
<DialogPrimitive.Close asChild>
|
|
90
|
+
<Button variant="neutralOutline">
|
|
93
91
|
{cancelLabel}
|
|
94
92
|
</Button>
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
</DialogPrimitive.Close>
|
|
94
|
+
)}
|
|
97
95
|
|
|
98
96
|
{confirmButton && (
|
|
99
97
|
<Button
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components'
|
|
2
3
|
import { ButtonProps, RippleInterface } from '../Button/Button.types'
|
|
3
4
|
import { ButtonVariant } from '../Button/Button.appearance'
|
|
4
5
|
import { IconButtonSizes } from './IconButton.sizes'
|
|
@@ -15,10 +16,11 @@ const IconButton: React.FC<ButtonProps> = ({
|
|
|
15
16
|
onClick,
|
|
16
17
|
...rest
|
|
17
18
|
}) => {
|
|
19
|
+
const theme = useTheme()
|
|
18
20
|
const [ripples, setRipples] = useState<RippleInterface[]>([])
|
|
19
21
|
|
|
20
22
|
const buttonSize = IconButtonSizes(size)
|
|
21
|
-
const buttonVariant = ButtonVariant(color, variant)
|
|
23
|
+
const buttonVariant = ButtonVariant(color, variant, theme)
|
|
22
24
|
|
|
23
25
|
const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
24
26
|
const rect = e.currentTarget.getBoundingClientRect()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from 'react'
|
|
2
|
+
import { useTheme } from 'styled-components'
|
|
2
3
|
import { LinkAnchor, StyledLinkButton } from './LinkButton.style'
|
|
3
4
|
import { RippleContainer } from '../Button/Button.styles'
|
|
4
5
|
import { RippleInterface } from '../Button/Button.types'
|
|
@@ -19,8 +20,9 @@ const LinkButton: React.FC<LinkButtonProps> = ({
|
|
|
19
20
|
size = 'md',
|
|
20
21
|
...rest
|
|
21
22
|
}) => {
|
|
23
|
+
const theme = useTheme()
|
|
22
24
|
const [ripples, setRipples] = useState<RippleInterface[]>([])
|
|
23
|
-
const buttonVariant = ButtonVariant(color, variant)
|
|
25
|
+
const buttonVariant = ButtonVariant(color, variant, theme)
|
|
24
26
|
const buttonSize = LinkButtonSizes(size)
|
|
25
27
|
|
|
26
28
|
const handleClick = (e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
@@ -16,7 +16,7 @@ const PageWrapper = styled.div.withConfig({
|
|
|
16
16
|
})<WrapperProps>`
|
|
17
17
|
width: 100%;
|
|
18
18
|
height: 100%;
|
|
19
|
-
max-width: ${({width}) => width + 'px'
|
|
19
|
+
max-width: ${({width}) => width ? width + 'px' : '100%'};
|
|
20
20
|
margin: 0 auto;
|
|
21
21
|
padding: ${({padding}) =>
|
|
22
22
|
padding ? spacing[padding] + 'px' : spacing.spacing16 + 'px'};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import Skeleton from './Skeleton'
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Skeleton> = {
|
|
5
|
+
title: 'Feedback/Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered',
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `
|
|
12
|
+
Componente de loading skeleton baseado em \`react-loading-skeleton\`.
|
|
13
|
+
|
|
14
|
+
**Quando usar:**
|
|
15
|
+
- Enquanto dados estão sendo carregados da API
|
|
16
|
+
- Para evitar layout shift e melhorar a percepção de performance
|
|
17
|
+
- Substitua o conteúdo real pelo Skeleton durante o estado de loading
|
|
18
|
+
`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
argTypes: {
|
|
24
|
+
width: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Largura do skeleton (px, %, rem...)',
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'Altura do skeleton',
|
|
31
|
+
},
|
|
32
|
+
count: {
|
|
33
|
+
control: { type: 'number', min: 1, max: 10 },
|
|
34
|
+
description: 'Quantidade de linhas',
|
|
35
|
+
table: { defaultValue: { summary: '1' } },
|
|
36
|
+
},
|
|
37
|
+
circle: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Formato circular (avatar)',
|
|
40
|
+
table: { defaultValue: { summary: 'false' } },
|
|
41
|
+
},
|
|
42
|
+
borderRadius: {
|
|
43
|
+
control: 'text',
|
|
44
|
+
description: 'Border radius customizado',
|
|
45
|
+
},
|
|
46
|
+
inline: {
|
|
47
|
+
control: 'boolean',
|
|
48
|
+
description: 'Exibe inline',
|
|
49
|
+
table: { defaultValue: { summary: 'false' } },
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default meta
|
|
55
|
+
type Story = StoryObj<typeof meta>
|
|
56
|
+
|
|
57
|
+
export const Default: Story = {
|
|
58
|
+
args: {
|
|
59
|
+
width: 200,
|
|
60
|
+
height: 20,
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const MultiplaLinhas: Story = {
|
|
65
|
+
name: 'Múltiplas linhas',
|
|
66
|
+
parameters: {
|
|
67
|
+
docs: { description: { story: 'Use `count` para simular blocos de texto.' } },
|
|
68
|
+
},
|
|
69
|
+
render: () => (
|
|
70
|
+
<div style={{ width: 320 }}>
|
|
71
|
+
<Skeleton count={4} height={16} />
|
|
72
|
+
</div>
|
|
73
|
+
),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export const Circular: Story = {
|
|
77
|
+
name: 'Avatar circular',
|
|
78
|
+
parameters: {
|
|
79
|
+
docs: { description: { story: 'Use `circle` para avatares.' } },
|
|
80
|
+
},
|
|
81
|
+
render: () => (
|
|
82
|
+
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
|
|
83
|
+
<Skeleton circle width={32} height={32} />
|
|
84
|
+
<Skeleton circle width={40} height={40} />
|
|
85
|
+
<Skeleton circle width={56} height={56} />
|
|
86
|
+
</div>
|
|
87
|
+
),
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const Card: Story = {
|
|
91
|
+
name: 'Card de conteúdo',
|
|
92
|
+
parameters: {
|
|
93
|
+
docs: { description: { story: 'Exemplo de skeleton para um card com avatar + texto.' } },
|
|
94
|
+
},
|
|
95
|
+
render: () => (
|
|
96
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, width: 320 }}>
|
|
97
|
+
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
|
|
98
|
+
<Skeleton circle width={40} height={40} />
|
|
99
|
+
<div style={{ flex: 1 }}>
|
|
100
|
+
<Skeleton height={14} width="60%" />
|
|
101
|
+
<Skeleton height={12} width="40%" />
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<Skeleton height={120} borderRadius={8} />
|
|
105
|
+
<Skeleton count={3} height={14} />
|
|
106
|
+
</div>
|
|
107
|
+
),
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const Tabela: Story = {
|
|
111
|
+
name: 'Linhas de tabela',
|
|
112
|
+
parameters: {
|
|
113
|
+
docs: { description: { story: 'Simula linhas de uma tabela carregando.' } },
|
|
114
|
+
},
|
|
115
|
+
render: () => (
|
|
116
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, width: 480 }}>
|
|
117
|
+
{Array.from({ length: 5 }).map((_, i) => (
|
|
118
|
+
<div key={i} style={{ display: 'flex', gap: 16 }}>
|
|
119
|
+
<Skeleton width={120} height={16} />
|
|
120
|
+
<Skeleton width={160} height={16} />
|
|
121
|
+
<Skeleton width={80} height={16} />
|
|
122
|
+
</div>
|
|
123
|
+
))}
|
|
124
|
+
</div>
|
|
125
|
+
),
|
|
126
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { radius } from '@liguelead/foundation'
|
|
3
|
+
import { parseColor } from '../../utils'
|
|
4
|
+
|
|
5
|
+
export const SkeletonWrapper = styled.div<{ $inline?: boolean }>`
|
|
6
|
+
display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 4px;
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const SkeletonThemeWrapper = styled.div`
|
|
12
|
+
--base-color: ${({ theme }) => parseColor(theme.colors.neutral200)};
|
|
13
|
+
--highlight-color: ${({ theme }) => parseColor(theme.colors.neutral100)};
|
|
14
|
+
border-radius: ${radius.radius4}px;
|
|
15
|
+
`
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import ReactSkeleton, { SkeletonTheme } from 'react-loading-skeleton'
|
|
2
|
+
import 'react-loading-skeleton/dist/skeleton.css'
|
|
3
|
+
import { useTheme } from 'styled-components'
|
|
4
|
+
import { parseColor } from '../../utils'
|
|
5
|
+
import { SkeletonWrapper } from './Skeleton.styles'
|
|
6
|
+
import { SkeletonProps } from './Skeleton.types'
|
|
7
|
+
|
|
8
|
+
const Skeleton: React.FC<SkeletonProps> = ({
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
borderRadius,
|
|
12
|
+
circle = false,
|
|
13
|
+
count = 1,
|
|
14
|
+
className,
|
|
15
|
+
inline = false,
|
|
16
|
+
}) => {
|
|
17
|
+
const theme = useTheme()
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SkeletonTheme
|
|
21
|
+
baseColor={parseColor(theme.colors.neutral200)}
|
|
22
|
+
highlightColor={parseColor(theme.colors.neutral100)}
|
|
23
|
+
>
|
|
24
|
+
<SkeletonWrapper $inline={inline} className={className}>
|
|
25
|
+
<ReactSkeleton
|
|
26
|
+
width={width}
|
|
27
|
+
height={height}
|
|
28
|
+
borderRadius={borderRadius}
|
|
29
|
+
circle={circle}
|
|
30
|
+
count={count}
|
|
31
|
+
inline={inline}
|
|
32
|
+
/>
|
|
33
|
+
</SkeletonWrapper>
|
|
34
|
+
</SkeletonTheme>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default Skeleton
|
|
@@ -25,7 +25,7 @@ const SplitButton: React.FC<SplitButtonProps> = ({
|
|
|
25
25
|
className
|
|
26
26
|
}) => {
|
|
27
27
|
const theme = useTheme()
|
|
28
|
-
const buttonVariant = ButtonVariant(color, variant)
|
|
28
|
+
const buttonVariant = ButtonVariant(color, variant, theme)
|
|
29
29
|
const buttonSize = ButtonSizes(size)
|
|
30
30
|
const triggerSize = SplitButtonTriggerSizes(size)
|
|
31
31
|
|
package/components/Tabs/Tabs.tsx
CHANGED
|
@@ -15,6 +15,8 @@ const Tabs: React.FC<TabsProps> = ({
|
|
|
15
15
|
{items.map(item => (
|
|
16
16
|
<Button
|
|
17
17
|
key={item.key}
|
|
18
|
+
aria-controls={`tab-${item.key}`}
|
|
19
|
+
aria-selected={activeKey === item.key}
|
|
18
20
|
variant={activeKey === item.key ? 'solid' : 'neutralGhost'}
|
|
19
21
|
color={activeKey === item.key ? 'primary' : undefined}
|
|
20
22
|
size="sm"
|
|
@@ -138,9 +138,11 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
138
138
|
className={className}
|
|
139
139
|
size={textFieldSize}
|
|
140
140
|
$themefication={textFieldState}>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
{label && (
|
|
142
|
+
<Label>
|
|
143
|
+
{label} {requiredSymbol && <RequiredAsterisk />}
|
|
144
|
+
</Label>
|
|
145
|
+
)}
|
|
144
146
|
<InputWrapper
|
|
145
147
|
as="label"
|
|
146
148
|
onDragOver={handleDragOver}
|
|
@@ -181,10 +183,13 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
181
183
|
<Wrapper
|
|
182
184
|
className={className}
|
|
183
185
|
size={textFieldSize}
|
|
184
|
-
$themefication={textFieldState}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
$themefication={textFieldState}
|
|
187
|
+
>
|
|
188
|
+
{label && (
|
|
189
|
+
<Label>
|
|
190
|
+
{label} {requiredSymbol && <RequiredAsterisk />}
|
|
191
|
+
</Label>
|
|
192
|
+
)}
|
|
188
193
|
<InputWrapper>
|
|
189
194
|
{leftIcon && (
|
|
190
195
|
<IconWrapper onClick={handleLeftIcon}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toast, ToastOptions } from
|
|
1
|
+
import { toast, ToastOptions } from 'react-toastify'
|
|
2
2
|
|
|
3
3
|
const defaultOptions: ToastOptions = {
|
|
4
4
|
position: 'top-right',
|
|
@@ -11,23 +11,6 @@ const defaultOptions: ToastOptions = {
|
|
|
11
11
|
|
|
12
12
|
export type ToastType = 'success' | 'error' | 'warning' | 'info'
|
|
13
13
|
|
|
14
|
-
export const triggerToast = (type: ToastType, message: string, options?: ToastOptions) => {
|
|
15
|
-
const mergedOptions = { ...defaultOptions, ...options }
|
|
16
|
-
|
|
17
|
-
switch (type) {
|
|
18
|
-
case 'success':
|
|
19
|
-
return toast.success(message, mergedOptions)
|
|
20
|
-
case 'error':
|
|
21
|
-
return toast.error(message, mergedOptions)
|
|
22
|
-
case 'warning':
|
|
23
|
-
return toast.warning(message, mergedOptions)
|
|
24
|
-
case 'info':
|
|
25
|
-
return toast.info(message, mergedOptions)
|
|
26
|
-
default:
|
|
27
|
-
return toast(message, mergedOptions)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
14
|
const Toaster = {
|
|
32
15
|
success: (message: string, options?: ToastOptions) =>
|
|
33
16
|
toast.success(message, { ...defaultOptions, ...options }),
|
|
@@ -42,4 +25,7 @@ const Toaster = {
|
|
|
42
25
|
toast.info(message, { ...defaultOptions, ...options })
|
|
43
26
|
}
|
|
44
27
|
|
|
45
|
-
export
|
|
28
|
+
export const triggerToast = (type: ToastType, message: string, options?: ToastOptions) =>
|
|
29
|
+
Toaster[type](message, options)
|
|
30
|
+
|
|
31
|
+
export default Toaster
|
package/components/index.ts
CHANGED
|
@@ -21,3 +21,5 @@ export { Combobox } from './Combobox'
|
|
|
21
21
|
export { default as SplitButton } from './SplitButton'
|
|
22
22
|
export { default as Table } from './Table'
|
|
23
23
|
export { default as Tabs } from './Tabs'
|
|
24
|
+
export { Skeleton } from './Skeleton'
|
|
25
|
+
export type { SkeletonProps } from './Skeleton'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liguelead/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "components/index.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"react-toastify": "^11.0.5",
|
|
26
26
|
"cmdk": "^1.1.1",
|
|
27
27
|
"date-fns": "^2.30.0",
|
|
28
|
-
"@tanstack/react-table": "^8.0.0"
|
|
28
|
+
"@tanstack/react-table": "^8.0.0",
|
|
29
|
+
"react-loading-skeleton": "^3.5.0"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"lint": "eslint ."
|