code7-leia 1.0.14 → 1.0.15
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.es.js +1616 -1399
- package/package.json +3 -4
- package/src/components/Modal/index.tsx +3 -2
- package/src/components/PersonasArea/index.tsx +22 -3
- package/src/components/PersonasArea/styles.ts +6 -0
- package/src/components/Tootip/index.tsx +45 -0
- package/src/components/Tootip/styles.ts +177 -0
- package/src/utils/languages/en.ts +1 -0
- package/src/utils/languages/es.ts +1 -0
- package/src/utils/languages/pt-br.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "code7-leia",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"author": "code7-xlab",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.es.js",
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "vite",
|
|
20
20
|
"build": "vite build",
|
|
21
|
-
"deploy": "npm run build && npm
|
|
22
|
-
"deploy-gio": "npm run build && npm publish"
|
|
21
|
+
"deploy": "npm run build && npm publish"
|
|
23
22
|
},
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"axios": "^1.6.7",
|
|
@@ -40,7 +39,7 @@
|
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"@types/node": "^22.16.0",
|
|
42
41
|
"@types/react-dom": "^18.2.0",
|
|
43
|
-
"@types/styled-components": "^5.1.
|
|
42
|
+
"@types/styled-components": "^5.1.36",
|
|
44
43
|
"@vitejs/plugin-react": "5.0.2",
|
|
45
44
|
"react": "^18.2.0",
|
|
46
45
|
"react-dom": "^18.2.0",
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import * as S from './styles';
|
|
3
3
|
import { IoClose } from 'react-icons/io5';
|
|
4
|
+
import Tooltip from '../Tootip';
|
|
4
5
|
|
|
5
6
|
interface ModalProps {
|
|
6
|
-
title?:
|
|
7
|
+
title?: React.ReactNode;
|
|
7
8
|
children: React.ReactNode;
|
|
8
9
|
onClose: () => void;
|
|
9
10
|
}
|
|
@@ -13,7 +14,7 @@ const Modal = ({ title, children, onClose }: ModalProps) => {
|
|
|
13
14
|
<S.Overlay>
|
|
14
15
|
<S.Container>
|
|
15
16
|
<S.Header>
|
|
16
|
-
|
|
17
|
+
{title && <>{title}</>}
|
|
17
18
|
<button onClick={onClose}>
|
|
18
19
|
<IoClose />
|
|
19
20
|
</button>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { getLanguage } from '../../utils/getLanguage';
|
|
3
|
-
import { FaPlus, FaCopy, FaEdit, FaTrash } from 'react-icons/fa';
|
|
3
|
+
import { FaPlus, FaCopy, FaEdit, FaQuestionCircle, FaTrash } from 'react-icons/fa';
|
|
4
4
|
import Modal from '../Modal';
|
|
5
5
|
import Input from '../TestArea/components/InputTest';
|
|
6
6
|
import TextArea from '../TestArea/components/TextArea';
|
|
@@ -10,7 +10,7 @@ import LengthCounter from '../LengthCounter';
|
|
|
10
10
|
import { useLeia } from '../../contexts/LeiaProvider';
|
|
11
11
|
|
|
12
12
|
import * as S from './styles';
|
|
13
|
-
import
|
|
13
|
+
import Tooltip from '../Tootip';
|
|
14
14
|
|
|
15
15
|
interface Persona {
|
|
16
16
|
id: number;
|
|
@@ -103,6 +103,25 @@ export const PersonasArea = () => {
|
|
|
103
103
|
p.name.toLowerCase().includes(search.toLowerCase())
|
|
104
104
|
);
|
|
105
105
|
|
|
106
|
+
const ModalTitle = () => {
|
|
107
|
+
return (
|
|
108
|
+
<S.ModalTitleContainer className='modal-title'>
|
|
109
|
+
<h3>{t.personas?.modalTitle}</h3>
|
|
110
|
+
<Tooltip
|
|
111
|
+
position="right"
|
|
112
|
+
width={'200px'}
|
|
113
|
+
render={() =>
|
|
114
|
+
t.personas?.modalTooltip
|
|
115
|
+
}
|
|
116
|
+
>
|
|
117
|
+
<>
|
|
118
|
+
<FaQuestionCircle color = "#8D9CA1" size={16}/>
|
|
119
|
+
</>
|
|
120
|
+
</Tooltip>
|
|
121
|
+
</S.ModalTitleContainer>
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
106
125
|
return (
|
|
107
126
|
<S.Container>
|
|
108
127
|
<S.Header>
|
|
@@ -152,7 +171,7 @@ export const PersonasArea = () => {
|
|
|
152
171
|
|
|
153
172
|
|
|
154
173
|
{isOpen && (
|
|
155
|
-
<Modal onClose={() => setIsOpen(false)} title={
|
|
174
|
+
<Modal onClose={() => setIsOpen(false)} title={<ModalTitle/>}>
|
|
156
175
|
<S.InputWrapper>
|
|
157
176
|
<Input
|
|
158
177
|
value={form.name}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import cc from 'classcat';
|
|
3
|
+
|
|
4
|
+
import { Container } from './styles';
|
|
5
|
+
|
|
6
|
+
interface TooltipProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
render: () => ReactNode;
|
|
8
|
+
children: ReactElement;
|
|
9
|
+
position?: 'left' | 'right' | 'top' | 'bottom';
|
|
10
|
+
theme?: 'light' | 'dark';
|
|
11
|
+
show?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
width?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const Tooltip: React.FC<TooltipProps> = ({
|
|
17
|
+
position = 'bottom',
|
|
18
|
+
theme = 'dark',
|
|
19
|
+
render,
|
|
20
|
+
children,
|
|
21
|
+
show = true,
|
|
22
|
+
className = '',
|
|
23
|
+
width = '100px',
|
|
24
|
+
...rest
|
|
25
|
+
}) => {
|
|
26
|
+
return (
|
|
27
|
+
<>
|
|
28
|
+
{!show ? (
|
|
29
|
+
children
|
|
30
|
+
) : (
|
|
31
|
+
<Container
|
|
32
|
+
width={width}
|
|
33
|
+
className={cc([theme, position, className])}
|
|
34
|
+
{...rest}
|
|
35
|
+
>
|
|
36
|
+
{render && <div className="tooltip-content">{render()}</div>}
|
|
37
|
+
|
|
38
|
+
<div className="tooltip-target">{children}</div>
|
|
39
|
+
</Container>
|
|
40
|
+
)}
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default Tooltip;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
interface ContainerProps {
|
|
4
|
+
width?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const Container = styled.div<ContainerProps>`
|
|
8
|
+
align-items: center;
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
.tooltip-content {
|
|
14
|
+
border-radius: 5px;
|
|
15
|
+
font-size: 13px;
|
|
16
|
+
display: none;
|
|
17
|
+
padding: 6px 10px;
|
|
18
|
+
position: absolute;
|
|
19
|
+
transition: opacity 0.5s;
|
|
20
|
+
z-index: 6;
|
|
21
|
+
width: ${({ width }) => width};
|
|
22
|
+
line-height: 20px;
|
|
23
|
+
|
|
24
|
+
&::after {
|
|
25
|
+
border-style: solid;
|
|
26
|
+
border-width: 6px;
|
|
27
|
+
content: '';
|
|
28
|
+
position: absolute;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:hover {
|
|
33
|
+
.tooltip-content {
|
|
34
|
+
display: block;
|
|
35
|
+
opacity: 1;
|
|
36
|
+
visibility: visible;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.dark {
|
|
41
|
+
.tooltip-content {
|
|
42
|
+
background-color: var(--neutral-3);
|
|
43
|
+
color: #fff;
|
|
44
|
+
box-shadow: 0px 5px 6px #00000040;
|
|
45
|
+
|
|
46
|
+
&::after {
|
|
47
|
+
border-color: var(--neutral-3) transparent transparent transparent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.light {
|
|
53
|
+
.tooltip-content {
|
|
54
|
+
background: #fff;
|
|
55
|
+
border-radius: 5px;
|
|
56
|
+
box-shadow: 1px 4px 4px rgba(0, 0, 0, 0.25);
|
|
57
|
+
|
|
58
|
+
&::after {
|
|
59
|
+
border-color: #fff transparent transparent transparent;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&::before {
|
|
63
|
+
content: '';
|
|
64
|
+
border-style: solid;
|
|
65
|
+
border-width: 9px;
|
|
66
|
+
position: absolute;
|
|
67
|
+
border-color: #d8d8d8 transparent transparent transparent;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&.top {
|
|
73
|
+
.tooltip-content {
|
|
74
|
+
bottom: calc(100% + 10px);
|
|
75
|
+
left: 50%;
|
|
76
|
+
transform: translateX(-50%);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.dark .tooltip-content {
|
|
80
|
+
&::after {
|
|
81
|
+
top: calc(100%);
|
|
82
|
+
left: 50%;
|
|
83
|
+
transform: translateX(-50%);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.light .tooltip-content {
|
|
88
|
+
&::before,
|
|
89
|
+
&::after {
|
|
90
|
+
top: 100%;
|
|
91
|
+
left: 50%;
|
|
92
|
+
transform: translateX(-50%);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&.bottom {
|
|
98
|
+
.tooltip-content {
|
|
99
|
+
top: calc(100% + 10px);
|
|
100
|
+
left: 50%;
|
|
101
|
+
transform: translateX(-50%);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.dark .tooltip-content {
|
|
105
|
+
&::after {
|
|
106
|
+
bottom: calc(100%);
|
|
107
|
+
left: 50%;
|
|
108
|
+
transform: translateX(-50%) rotate(180deg);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.light .tooltip-content {
|
|
113
|
+
&::before,
|
|
114
|
+
&::after {
|
|
115
|
+
bottom: 100%;
|
|
116
|
+
left: 50%;
|
|
117
|
+
transform: translateX(-50%) rotate(180deg);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&.right {
|
|
123
|
+
.tooltip-content {
|
|
124
|
+
left: calc(100% + 10px);
|
|
125
|
+
top: 50%;
|
|
126
|
+
transform: translateY(-50%);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&.dark .tooltip-content {
|
|
130
|
+
&::after {
|
|
131
|
+
right: 100%;
|
|
132
|
+
top: 50%;
|
|
133
|
+
transform: translateY(-50%) rotate(90deg);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.light .tooltip-content {
|
|
138
|
+
&::before,
|
|
139
|
+
&::after {
|
|
140
|
+
right: 100%;
|
|
141
|
+
top: 50%;
|
|
142
|
+
transform: translateY(-50%) rotate(90deg);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&.left {
|
|
148
|
+
.tooltip-content {
|
|
149
|
+
right: calc(100% + 10px);
|
|
150
|
+
top: 50%;
|
|
151
|
+
transform: translateY(-50%);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&.dark .tooltip-content {
|
|
155
|
+
&::after {
|
|
156
|
+
left: 100%;
|
|
157
|
+
top: 50%;
|
|
158
|
+
transform: translateY(-50%) rotate(270deg);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
&.light .tooltip-content {
|
|
163
|
+
&::before,
|
|
164
|
+
&::after {
|
|
165
|
+
left: 100%;
|
|
166
|
+
top: 50%;
|
|
167
|
+
transform: translateY(-50%) rotate(270deg);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.show {
|
|
173
|
+
.tooltip-content {
|
|
174
|
+
display: inline-block;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
@@ -17,6 +17,7 @@ export const enTranslation: Language = {
|
|
|
17
17
|
add: 'Add persona',
|
|
18
18
|
modalTitle: 'Persona',
|
|
19
19
|
modalAlert: 'Are you sure you want to delete',
|
|
20
|
+
modalTooltip: "The AI will behave exactly as described in this prompt. Anything it says from here on is the responsibility of the user.",
|
|
20
21
|
|
|
21
22
|
fields: {
|
|
22
23
|
name: 'Name',
|
|
@@ -17,6 +17,7 @@ export const esTranslation: Language = {
|
|
|
17
17
|
add: 'Agregar persona',
|
|
18
18
|
modalTitle: 'Persona',
|
|
19
19
|
modalAlert: '¿Seguro que deseas eliminar',
|
|
20
|
+
modalTooltip: "La IA se comportará exactamente según este prompt. Todo lo que diga a partir de aquí es responsabilidad del usuario.",
|
|
20
21
|
|
|
21
22
|
fields: {
|
|
22
23
|
name: 'Nombre',
|
|
@@ -17,6 +17,7 @@ export const ptTranslation: Language = {
|
|
|
17
17
|
add: 'Adicionar persona',
|
|
18
18
|
modalTitle: 'Persona',
|
|
19
19
|
modalAlert: 'Quer mesmo deletar',
|
|
20
|
+
modalTooltip: "A IA vai se comportar exatamente como este prompt descreve. Tudo o que ela disser a partir disso é responsabilidade do usuário.",
|
|
20
21
|
|
|
21
22
|
fields: {
|
|
22
23
|
name: 'Nome',
|