@liguelead/design-system 0.0.21 → 0.0.22
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
2
2
|
import styled from 'styled-components';
|
|
3
|
-
import { spacing, shadow } from '@liguelead/foundation';
|
|
3
|
+
import { spacing, shadow, fontSize } from '@liguelead/foundation';
|
|
4
4
|
import { parseColor } from '../../utils';
|
|
5
5
|
|
|
6
6
|
export const Overlay = styled(DialogPrimitive.Overlay)`
|
|
@@ -22,9 +22,9 @@ export const Content = styled(DialogPrimitive.Content)<{$centerContent?: boolean
|
|
|
22
22
|
min-width: 425px;
|
|
23
23
|
max-width: 90vw;
|
|
24
24
|
position: fixed;
|
|
25
|
-
top:
|
|
25
|
+
top: 8vh;
|
|
26
26
|
left: 50%;
|
|
27
|
-
transform:
|
|
27
|
+
transform: translateX(-50%);
|
|
28
28
|
`
|
|
29
29
|
export const CloseDialogIconButton = styled.button`
|
|
30
30
|
position: absolute;
|
|
@@ -60,3 +60,16 @@ export const ButtonContainer = styled.div<{$centerContent?: boolean}>`
|
|
|
60
60
|
gap: ${spacing.spacing12}px;
|
|
61
61
|
margin-top: ${spacing.spacing24}px;
|
|
62
62
|
`;
|
|
63
|
+
|
|
64
|
+
export const DialogDescription = styled(DialogPrimitive.Description)`
|
|
65
|
+
color: ${({ theme }) => parseColor(theme.colors.textMedium)};
|
|
66
|
+
font-size: ${fontSize.fontSize14}px;
|
|
67
|
+
font-weight: 400;
|
|
68
|
+
white-space: pre-line;
|
|
69
|
+
`
|
|
70
|
+
|
|
71
|
+
export const DialogTitle = styled(DialogPrimitive.Title)`
|
|
72
|
+
color: ${({ theme }) => parseColor(theme.colors.textDark)};
|
|
73
|
+
font-size: ${fontSize.fontSize18}px;
|
|
74
|
+
font-weight: 500;
|
|
75
|
+
`
|
|
@@ -6,42 +6,49 @@ import {
|
|
|
6
6
|
ChildrenContainer,
|
|
7
7
|
CloseDialogIconButton,
|
|
8
8
|
Content,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogTitle,
|
|
9
11
|
Overlay
|
|
10
12
|
} from "./Dialog.style"
|
|
11
13
|
import { TDialogProps } from "./Dialog.types"
|
|
12
14
|
|
|
13
15
|
import Button from "../Button"
|
|
14
|
-
import Text from "../Text"
|
|
15
16
|
|
|
16
17
|
export const Dialog: React.FC<TDialogProps> = ({
|
|
17
18
|
open,
|
|
18
19
|
onOpenChange,
|
|
19
20
|
title,
|
|
20
21
|
description,
|
|
22
|
+
confirmButton = true,
|
|
23
|
+
cancelButton = true,
|
|
21
24
|
trigger,
|
|
22
25
|
children,
|
|
23
26
|
onConfirm,
|
|
24
27
|
variant = 'default',
|
|
28
|
+
confirmButtonColor = 'primary',
|
|
25
29
|
className,
|
|
26
30
|
confirmLabel = 'Confirmar',
|
|
27
31
|
cancelLabel = 'Cancelar',
|
|
28
32
|
centerContent = false,
|
|
33
|
+
...rest
|
|
29
34
|
}: TDialogProps) => {
|
|
30
35
|
return (
|
|
31
36
|
<DialogPrimitive.Root
|
|
32
|
-
open={open}
|
|
37
|
+
open={open}
|
|
33
38
|
onOpenChange={onOpenChange}
|
|
34
39
|
>
|
|
35
40
|
{trigger
|
|
36
|
-
&& <DialogPrimitive.Trigger asChild className={className}>
|
|
41
|
+
&& <DialogPrimitive.Trigger asChild className={className} >
|
|
37
42
|
{trigger}
|
|
38
43
|
</DialogPrimitive.Trigger>
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
<DialogPrimitive.Portal
|
|
46
|
+
<DialogPrimitive.Portal
|
|
47
|
+
>
|
|
42
48
|
<Overlay />
|
|
43
49
|
|
|
44
50
|
<Content
|
|
51
|
+
{...rest}
|
|
45
52
|
className={className}
|
|
46
53
|
$centerContent={centerContent}
|
|
47
54
|
onInteractOutside={(event) => {
|
|
@@ -52,50 +59,40 @@ export const Dialog: React.FC<TDialogProps> = ({
|
|
|
52
59
|
}}
|
|
53
60
|
>
|
|
54
61
|
{title && (
|
|
55
|
-
<
|
|
56
|
-
<Text
|
|
57
|
-
isTitle
|
|
58
|
-
tag='h1'
|
|
59
|
-
size="heading01"
|
|
60
|
-
weight="fontWeight500"
|
|
61
|
-
color='textDark'
|
|
62
|
-
>
|
|
62
|
+
<DialogTitle>
|
|
63
63
|
{title}
|
|
64
|
-
|
|
65
|
-
</DialogPrimitive.Title>
|
|
64
|
+
</DialogTitle>
|
|
66
65
|
)}
|
|
67
66
|
|
|
68
67
|
{description && (
|
|
69
|
-
<
|
|
70
|
-
<Text
|
|
71
|
-
tag='p'
|
|
72
|
-
size="body02"
|
|
73
|
-
weight="fontWeight400"
|
|
74
|
-
color='textMedium'
|
|
75
|
-
>
|
|
68
|
+
<DialogDescription>
|
|
76
69
|
{description}
|
|
77
|
-
|
|
78
|
-
</DialogPrimitive.Description>
|
|
70
|
+
</DialogDescription>
|
|
79
71
|
)}
|
|
80
72
|
|
|
81
73
|
<ChildrenContainer>
|
|
82
74
|
{children}
|
|
83
|
-
|
|
75
|
+
</ChildrenContainer>
|
|
84
76
|
|
|
85
77
|
<ButtonContainer $centerContent={centerContent}>
|
|
86
78
|
<DialogPrimitive.Close asChild>
|
|
87
|
-
|
|
79
|
+
{cancelButton && (
|
|
80
|
+
<Button
|
|
88
81
|
variant="outline"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
82
|
+
>
|
|
83
|
+
{cancelLabel}
|
|
84
|
+
</Button>
|
|
85
|
+
)}
|
|
92
86
|
</DialogPrimitive.Close>
|
|
93
87
|
|
|
94
|
-
|
|
95
|
-
|
|
88
|
+
{confirmButton && (
|
|
89
|
+
<Button
|
|
90
|
+
onClick={onConfirm}
|
|
91
|
+
color={confirmButtonColor}
|
|
96
92
|
>
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
{confirmLabel}
|
|
94
|
+
</Button>
|
|
95
|
+
)}
|
|
99
96
|
</ButtonContainer>
|
|
100
97
|
{variant === 'danger' ? null : (
|
|
101
98
|
<DialogPrimitive.Close asChild>
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { colorType } from "package/types"
|
|
2
|
+
import { ReactNode, HTMLAttributes } from "react"
|
|
3
|
+
|
|
2
4
|
|
|
3
5
|
export type TDialogProps = {
|
|
4
6
|
open?: boolean
|
|
5
7
|
onOpenChange?: (open: boolean) => void
|
|
6
8
|
title: string
|
|
9
|
+
confirmButton?: boolean
|
|
10
|
+
cancelButton?: boolean
|
|
7
11
|
description?: string
|
|
8
12
|
className?: string
|
|
9
13
|
trigger?: ReactNode
|
|
10
|
-
children
|
|
14
|
+
children?: ReactNode
|
|
11
15
|
onConfirm?: () => void
|
|
16
|
+
confirmButtonColor?: colorType
|
|
12
17
|
confirmLabel?: string
|
|
13
18
|
cancelLabel?: string
|
|
14
19
|
disableClose?: boolean
|
|
15
20
|
centerContent?: boolean
|
|
16
21
|
variant?: 'default' | 'danger'
|
|
17
|
-
}
|
|
22
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children' | 'className'>
|