code7-leia 0.2.361 → 1.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.
Files changed (62) hide show
  1. package/README.md +107 -1
  2. package/dist/code7-leia.cjs.development.js +1 -1
  3. package/dist/code7-leia.cjs.development.js.map +1 -1
  4. package/dist/code7-leia.cjs.production.min.js +1 -1
  5. package/dist/code7-leia.cjs.production.min.js.map +1 -1
  6. package/dist/code7-leia.esm.js +1 -1
  7. package/dist/code7-leia.esm.js.map +1 -1
  8. package/package.json +35 -71
  9. package/src/Leia.tsx +0 -44
  10. package/src/components/CustomToast/index.tsx +0 -62
  11. package/src/components/CustomToast/styles.tsx +0 -73
  12. package/src/components/EmptyState/index.tsx +0 -88
  13. package/src/components/EmptyState/styles.tsx +0 -81
  14. package/src/components/FileArea/components/AreaUpload/index.tsx +0 -137
  15. package/src/components/FileArea/components/AreaUpload/styles.tsx +0 -75
  16. package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +0 -23
  17. package/src/components/FileArea/components/Modal/ModalContent.tsx +0 -26
  18. package/src/components/FileArea/components/Modal/ModalFooter.tsx +0 -18
  19. package/src/components/FileArea/components/Modal/ModalHeader.tsx +0 -18
  20. package/src/components/FileArea/components/Modal/ModalTitle.tsx +0 -18
  21. package/src/components/FileArea/components/Modal/index.tsx +0 -131
  22. package/src/components/FileArea/components/Modal/styles.tsx +0 -121
  23. package/src/components/FileArea/components/Search/index.tsx +0 -44
  24. package/src/components/FileArea/components/Search/styles.tsx +0 -26
  25. package/src/components/FileArea/components/Spinner/index.tsx +0 -22
  26. package/src/components/FileArea/components/Spinner/styles.tsx +0 -59
  27. package/src/components/FileArea/components/Table/index.tsx +0 -34
  28. package/src/components/FileArea/components/Table/styles.tsx +0 -60
  29. package/src/components/FileArea/index.tsx +0 -281
  30. package/src/components/FileArea/styles.tsx +0 -183
  31. package/src/components/MultiSelect/index.tsx +0 -102
  32. package/src/components/MultiSelect/styles.tsx +0 -77
  33. package/src/components/Select/index.tsx +0 -53
  34. package/src/components/Select/styles.tsx +0 -49
  35. package/src/components/Tabs/index.tsx +0 -71
  36. package/src/components/Tabs/styles.tsx +0 -87
  37. package/src/components/TestArea/components/InputTest/index.tsx +0 -21
  38. package/src/components/TestArea/components/InputTest/styles.tsx +0 -28
  39. package/src/components/TestArea/components/TextArea/index.tsx +0 -97
  40. package/src/components/TestArea/components/TextArea/styles.tsx +0 -171
  41. package/src/components/TestArea/index.tsx +0 -101
  42. package/src/components/TestArea/styles.tsx +0 -112
  43. package/src/contexts/SharedPropsProvider.tsx +0 -79
  44. package/src/index.tsx +0 -20
  45. package/src/interface/FileData.ts +0 -11
  46. package/src/interface/Language.ts +0 -93
  47. package/src/interface/Table.ts +0 -12
  48. package/src/service/Api.ts +0 -9
  49. package/src/service/ApiDev.ts +0 -9
  50. package/src/service/ApiHml.ts +0 -9
  51. package/src/store/index.ts +0 -13
  52. package/src/store/modules/actions.ts +0 -88
  53. package/src/store/modules/reducer.ts +0 -46
  54. package/src/store/modules/sagas.ts +0 -127
  55. package/src/store/modules/types.ts +0 -19
  56. package/src/types/image.d.ts +0 -4
  57. package/src/utils/formatAxios.tsx +0 -15
  58. package/src/utils/getApi.tsx +0 -16
  59. package/src/utils/getLanguage.tsx +0 -17
  60. package/src/utils/languages/en.ts +0 -87
  61. package/src/utils/languages/es.ts +0 -87
  62. package/src/utils/languages/pt-br.ts +0 -87
@@ -1,49 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const Container = styled.div`
4
- position: relative;
5
- width: 50%;
6
- margin-right: 5px;
7
-
8
- .custom-select {
9
- position: relative;
10
- width: 100%;
11
- cursor: pointer;
12
-
13
- .selected-option {
14
- padding: 12px;
15
- border-radius: 4px;
16
- border: 1px solid #979AA5;
17
- height: 45px;
18
- display: flex;
19
- align-items: center;
20
- justify-content: space-between;
21
- font-size: 14px;
22
- }
23
-
24
- .options {
25
- position: absolute;
26
- top: 100%;
27
- left: 0;
28
- width: 100%;
29
- border: 1px solid #979AA5;
30
- border-top: none;
31
- border-radius: 0 0 4px 4px;
32
- background-color: #fff;
33
- z-index: 9;
34
-
35
- .option {
36
- padding: 12px;
37
- cursor: pointer;
38
- transition: background-color 0.1s;
39
- letter-spacing: 0.5px;
40
- font-size: 14px;
41
-
42
- &:hover {
43
- background-color: #6690ff;
44
- color: white;
45
- }
46
- }
47
- }
48
- }
49
- `;
@@ -1,71 +0,0 @@
1
- import React, { ReactNode } from 'react';
2
- import PropTypes from 'prop-types';
3
- import cc from 'classcat';
4
-
5
- import * as S from './styles';
6
-
7
- interface TabProps {
8
- children: ReactNode;
9
- active?: boolean;
10
- }
11
-
12
- interface ITabsProps {
13
- children: ReactNode;
14
- value: string | number;
15
- onChange: (e: any) => void;
16
- active?: boolean;
17
- }
18
-
19
- export const Tab = ({ active, children, ...rest }: TabProps) => {
20
- return (
21
- <S.Tab className={cc({ active })} {...rest}>
22
- {children}
23
- </S.Tab>
24
- );
25
- };
26
-
27
- Tab.propTypes = {
28
- children: PropTypes.oneOfType([
29
- PropTypes.string,
30
- PropTypes.element,
31
- PropTypes.node,
32
- ]).isRequired,
33
- onChange: PropTypes.func,
34
- value: PropTypes.string,
35
- active: PropTypes.bool,
36
- };
37
-
38
- Tab.defaultProps = {
39
- onChange: () => {},
40
- value: '',
41
- active: false,
42
- };
43
-
44
- export const Tabs = ({ children: childrenProp, value, onChange, ...rest }: ITabsProps) => {
45
- const children = React.Children.map(childrenProp, (child) => {
46
- if (!React.isValidElement(child)) {
47
- return null;
48
- }
49
-
50
- if (Array.isArray(child.props?.children)) {
51
- return React.cloneElement(child as React.ReactElement<any>, {
52
- active: child.props?.value === value,
53
- value,
54
- onChange,
55
- });
56
- }
57
-
58
- return React.cloneElement(child as React.ReactElement<any>, {
59
- active: child.props?.value === value,
60
- onClick: () => onChange(child.props?.value),
61
- });
62
- });
63
-
64
- return <S.TabsPane {...rest}>{children}</S.TabsPane>;
65
- };
66
-
67
- Tabs.propTypes = {
68
- children: PropTypes.node.isRequired,
69
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
70
- onChange: PropTypes.func.isRequired,
71
- };
@@ -1,87 +0,0 @@
1
- import styled from 'styled-components';
2
- import { ReactNode } from 'react';
3
-
4
- interface TabProps {
5
- children: ReactNode;
6
- }
7
-
8
- interface OptionProps {
9
- children: ReactNode;
10
- onClick: () => void;
11
- }
12
-
13
- export const TabsPane = styled.ul`
14
- width: max-content;
15
- display: flex;
16
- align-items: center;
17
- border-bottom: 1px solid var(--neutral-1);
18
- `;
19
-
20
- export const Tab = styled.li<TabProps>`
21
- padding: 12px;
22
- color: var(--neutral-3);
23
- font-size: 0.875rem;
24
- font-weight: normal;
25
- position: relative;
26
- cursor: pointer;
27
-
28
- svg {
29
- fill: var(--neutral-3) !important;
30
- margin-left: 8px;
31
- }
32
-
33
- &.active {
34
- color: var(--primary-700-light);
35
-
36
- svg {
37
- fill: var(--primary-700-light) !important;
38
- }
39
-
40
- ::after {
41
- content: '';
42
- position: absolute;
43
- bottom: 0;
44
- left: 0;
45
- width: 100%;
46
- height: 2px;
47
- background-color: var(--primary-700-light);
48
- }
49
- }
50
-
51
- &:not(:last-child) {
52
- margin-right: 8px;
53
- }
54
- `;
55
-
56
- export const DropdownContainer = styled.div`
57
- position: absolute;
58
- left: 0px;
59
- top: 40px;
60
- display: flex;
61
- flex-direction: column;
62
-
63
- background: #ffffff;
64
-
65
- border: 1px solid #979aa5;
66
- box-sizing: border-box;
67
- box-shadow: 0px 6px 12px -6px rgba(24, 39, 75, 0.12),
68
- 0px 8px 24px -4px rgba(24, 39, 75, 0.08);
69
- border-radius: 4px;
70
- padding: 8px;
71
- z-index: 2;
72
- `;
73
-
74
- export const Option = styled.div<OptionProps>`
75
- padding: 8px;
76
- font-size: 14px;
77
- border-radius: 4px;
78
- cursor: pointer;
79
- overflow: hidden;
80
- text-overflow: ellipsis;
81
- white-space: nowrap;
82
-
83
- &:hover {
84
- background-color: var(--primary-800-light);
85
- color: white;
86
- }
87
- `;
@@ -1,21 +0,0 @@
1
- import React from 'react';
2
- import * as S from './styles';
3
-
4
- interface InputTestProps {
5
- placeholder: string;
6
- onChange: (value: string) => void;
7
- }
8
-
9
- const InputTest: React.FC<InputTestProps> = ({ placeholder, onChange }) => {
10
- return (
11
- <S.Container>
12
- <S.StyledInput
13
- type="text"
14
- onChange={(e: any) => onChange(e.target.value)}
15
- placeholder={placeholder}
16
- />
17
- </S.Container>
18
- );
19
- };
20
-
21
- export default InputTest;
@@ -1,28 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const Container = styled.div`
4
- position: relative;
5
- width: 100%;
6
- margin-right: 5px;
7
- `;
8
-
9
- export const StyledInput = styled.input`
10
- padding-left: 10px;
11
- padding-right: 40px;
12
- border-radius: 5px;
13
- border: 1px solid #ccc;
14
- height: 45px;
15
- width: 100%;
16
-
17
- &:focus {
18
- outline: none;
19
- box-shadow: 0 0 0 3px #6690ff;
20
- }
21
- `;
22
-
23
- export const RecordAudioButton = styled.div`
24
- position: absolute;
25
- top: 14px;
26
- right: 10px;
27
- cursor: pointer;
28
- `;
@@ -1,97 +0,0 @@
1
- import React, { forwardRef, ReactNode } from 'react';
2
- import cc from 'classcat';
3
-
4
- import {
5
- Container,
6
- LabelWrapper,
7
- CustomTextArea,
8
- InputWrapper,
9
- Helper,
10
- Error,
11
- } from './styles';
12
-
13
- type TextAreaProps = {
14
- id?: string;
15
- label?: string;
16
- placeholder?: string;
17
- className?: string;
18
- description?: string;
19
- helper?: string;
20
- error?: string;
21
- color?: '' | 'danger' | 'success';
22
- size?: 'small' | 'medium' | 'large';
23
- startIcon?: string | ReactNode;
24
- endIcon?: string | ReactNode;
25
- disabled?: boolean;
26
- marginBottom?: string;
27
- rows?: number;
28
- } & React.TextareaHTMLAttributes<HTMLTextAreaElement>;
29
-
30
- const TextArea: React.FC<TextAreaProps> = forwardRef<HTMLTextAreaElement, TextAreaProps>(
31
- (
32
- {
33
- id,
34
- label,
35
- description,
36
- helper,
37
- error,
38
- placeholder,
39
- className,
40
- size = 'medium',
41
- color = '',
42
- disabled = false,
43
- startIcon,
44
- endIcon,
45
- marginBottom = '3px',
46
- rows = 4,
47
- ...props
48
- },
49
- ref
50
- ) => {
51
- const selfId = id || `input__${Math.random().toString(36).substr(2, 9)}`;
52
-
53
- return (
54
- <Container className={className} marginBottom={marginBottom}>
55
- {label && (
56
- <LabelWrapper htmlFor={selfId}>
57
- <span className="label">{label}</span>
58
- {description && <span className="description">{description}</span>}
59
- </LabelWrapper>
60
- )}
61
-
62
- <InputWrapper className={cc({ hasLabel: Boolean(label) })}>
63
- <CustomTextArea
64
- className={cc([
65
- 'input',
66
- size,
67
- color,
68
- {
69
- error: Boolean(error),
70
- 'has-start-icon': Boolean(startIcon),
71
- 'has-end-icon': Boolean(endIcon),
72
- },
73
- ])}
74
- id={selfId}
75
- placeholder={placeholder}
76
- disabled={disabled}
77
- rows={rows}
78
- ref={ref}
79
- {...props}
80
- />
81
- {startIcon && (
82
- <span className={cc(['icon', 'start-icon'])}>{startIcon}</span>
83
- )}
84
- {endIcon && (
85
- <span className={cc(['icon', 'end-icon'])}>{endIcon}</span>
86
- )}
87
- </InputWrapper>
88
-
89
- {helper && <Helper className={cc(['helper', color])}>{helper}</Helper>}
90
-
91
- {error && <Error className={cc(['error'])}>{error}</Error>}
92
- </Container>
93
- );
94
- }
95
- );
96
-
97
- export default TextArea;
@@ -1,171 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- type ContainerProps = {
4
- marginBottom?: string;
5
- };
6
-
7
- export const Container = styled.div<ContainerProps>`
8
- display: flex;
9
- flex-flow: column;
10
- margin-bottom: ${({ marginBottom }) => marginBottom};
11
- `;
12
-
13
- export const InputWrapper = styled.div`
14
- display: flex;
15
- align-items: center;
16
- position: relative;
17
- margin-right: 5px;
18
- width: 725px;
19
-
20
- .icon {
21
- position: absolute;
22
- color: #5a5d68;
23
-
24
- &.start-icon {
25
- left: 12px;
26
- }
27
- &.end-icon {
28
- right: 12px;
29
- }
30
- }
31
-
32
- & .pass-view {
33
- position: absolute;
34
- right: 0;
35
- top: 0;
36
- bottom: 0;
37
- padding: 14px;
38
- font-size: 1rem;
39
- color: #5a5d68;
40
- }
41
- `;
42
-
43
- export const LabelWrapper = styled.label`
44
- margin-bottom: 8px;
45
-
46
- .label {
47
- display: block;
48
- color: #5a5d68;
49
-
50
- font-style: normal;
51
- font-weight: 600;
52
- font-size: 0.875rem;
53
- line-height: 114%;
54
- letter-spacing: -0.02em;
55
- }
56
-
57
- .description {
58
- font-style: normal;
59
- font-weight: 500;
60
- font-size: 0.625rem;
61
- line-height: 120%;
62
- color: #5a5d68;
63
- display: block;
64
- }
65
- `;
66
-
67
- export const CustomTextArea = styled.textarea`
68
- font-family: 'Monospace', -apple-system, BlinkMacSystemFont, sans-serif;
69
- font-size: 0.875rem;
70
- font-style: normal;
71
- font-weight: 500;
72
- line-height: 20px;
73
- text-align: left;
74
- letter-spacing: -0.02em;
75
- resize: vertical;
76
- padding: 8px 12px;
77
-
78
- border-radius: 4px;
79
- border: 1px solid #979aa5;
80
- color: #5a5d68 !important;
81
- width: 100%;
82
-
83
- background: #ffffff;
84
- transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
85
- border 0.2s ease-in-out;
86
-
87
- &:focus {
88
- outline: none;
89
- box-shadow: 0 0 0 3px #6690ff;
90
- }
91
-
92
- &:hover {
93
- border: 1px solid #102693;
94
- }
95
- &:active {
96
- border: 1px solid #102693;
97
- }
98
- &:disabled {
99
- border: 1px solid #dadce3;
100
- background: #f3f5f9;
101
- color: #dadce3;
102
- }
103
-
104
- &.small {
105
- height: 32px;
106
- }
107
-
108
- &.medium {
109
- height: 120px;
110
- }
111
-
112
- &.large {
113
- height: 48px;
114
- font-size: 1rem;
115
- }
116
-
117
- &.success {
118
- background: #e3f8cc;
119
- border: 1px solid #19660a;
120
- color: #19660a;
121
- }
122
-
123
- &.danger {
124
- background: #fae0d2;
125
- border: 1px solid #871821;
126
- color: #871821;
127
- }
128
-
129
- &.error {
130
- background: #fae0d2;
131
- border: 1px solid #871821;
132
- color: #871821;
133
- }
134
-
135
- &.has-start-icon {
136
- padding-left: 40px;
137
- }
138
- &.has-end-icon {
139
- padding-right: 40px;
140
- }
141
- `;
142
-
143
- export const Helper = styled.div`
144
- &.helper {
145
- font-style: normal;
146
- font-weight: 500;
147
- font-size: 0.625rem;
148
- line-height: 120%;
149
- color: #5a5d68;
150
- display: block;
151
- margin-top: 4px;
152
-
153
- &.success {
154
- color: #19660a;
155
- }
156
-
157
- &.danger {
158
- color: #871821;
159
- }
160
- }
161
- `;
162
-
163
- export const Error = styled.div`
164
- font-style: normal;
165
- font-weight: 500;
166
- font-size: 0.625rem;
167
- line-height: 120%;
168
- display: block;
169
- margin-top: 4px;
170
- color: #871821;
171
- `;
@@ -1,101 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { getLanguage } from '../../utils/getLanguage'
3
- import * as S from './styles';
4
- import Select from '../Select'
5
- import InputTest from './components/InputTest'
6
- import TextArea from './components/TextArea'
7
- import { PiWaveformBold } from 'react-icons/pi';
8
- import { FaList } from 'react-icons/fa';
9
- import EmptyState from '../EmptyState';
10
- import { SharedPropsProvider, useSharedProps } from '../../contexts/SharedPropsProvider';
11
- import { MdPerson2 } from "react-icons/md";
12
- import { useDispatch, useSelector } from 'react-redux';
13
- import { testAction } from '../../store/modules/actions';
14
-
15
- export const TestArea = () => {
16
- const { id, language, personas, propTags, token, env, readonly } = useSharedProps();
17
- const t = getLanguage(language)
18
- const results = useSelector((state: any) => state.message);
19
- const isloading = useSelector((state: any) => state.isloading);
20
- const [search, setSearch] = useState('');
21
- const [prompt, setPrompt] = useState('');
22
- const [profile, setProfile] = useState('');
23
- const [presset, setPresset] = useState('');
24
- const dispatch = useDispatch();
25
- const tags = propTags ? propTags.tags : [];
26
-
27
-
28
- const optionsPersona = personas && personas.map(persona => {
29
- return { label: persona.name, value: persona.name }
30
- })
31
-
32
- const optionsPresset = tags.map(tag => {
33
- return { label: tag, value: tag }
34
- })
35
-
36
- const handleSelectPersona = (value: string) => {
37
- setProfile(value);
38
- };
39
-
40
- const handleSelectPresset = (value: string) => {
41
- setPresset(value);
42
- };
43
-
44
- const handleSearch = (value: string) => {
45
- setSearch(value);
46
- };
47
-
48
- const handlePrompt = (value: string) => {
49
- setPrompt(value);
50
- };
51
-
52
- const handleTest = () => {
53
- dispatch(testAction(search, prompt, profile, presset, id, token, env))
54
- };
55
-
56
- const returnTest = () => {
57
- return (
58
- <S.Container isloading={isloading}>
59
- <div id='loading' />
60
- <S.Header>
61
- <div className='infos'>
62
- <h2>{t.test}</h2>
63
- <p>{t.testArea.description}</p>
64
- </div>
65
- </S.Header>
66
- <S.Inputs>
67
- <InputTest placeholder={t.testArea.typeSentence} onChange={handleSearch} />
68
- <Select placeholder={t.testArea.selectPersona} options={optionsPersona} onSelect={handleSelectPersona} />
69
- <Select placeholder={t.testArea.selectPresset} options={optionsPresset} onSelect={handleSelectPresset} />
70
- <button onClick={handleTest}><PiWaveformBold /> {t.buttons.test}</button>
71
- </S.Inputs>
72
- <S.Inputs>
73
- {profile === "Custom" && <TextArea className="textarea-message" placeholder={t.testArea.typePrompt} value={prompt} onChange={(e) => { handlePrompt(e.target.value); }} />}
74
- </S.Inputs>
75
- {
76
- !results ? (
77
- <EmptyState
78
- icon={<FaList></FaList>}
79
- title={t.testArea.emptyState.title}
80
- description={t.testArea.emptyState.description}
81
- activeButton={false}
82
- />
83
- ) : <S.Result>
84
- <div className='icon'>
85
- <MdPerson2 />
86
- </div>
87
- <div className='text'>{results}</div>
88
- </S.Result>
89
- }
90
- </S.Container>
91
- )
92
- }
93
-
94
- return (
95
- <SharedPropsProvider id={id} token={token} readonly={readonly} language={language} env={env} propTags={{ tags: [] }} personas={[{name: '', description: ''}]}>
96
- <S.Container>
97
- {returnTest()}
98
- </S.Container>
99
- </SharedPropsProvider>
100
- );
101
- };