code7-leia 0.2.37 → 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 (76) 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/dist/components/CustomToast/styles.d.ts +1 -1
  9. package/dist/components/EmptyState/styles.d.ts +1 -2
  10. package/dist/components/FileArea/components/AreaUpload/styles.d.ts +2 -3
  11. package/dist/components/FileArea/components/Modal/styles.d.ts +8 -9
  12. package/dist/components/FileArea/components/Search/styles.d.ts +3 -4
  13. package/dist/components/FileArea/components/Spinner/styles.d.ts +1 -2
  14. package/dist/components/FileArea/components/Table/styles.d.ts +3 -4
  15. package/dist/components/FileArea/styles.d.ts +2 -3
  16. package/dist/components/MultiSelect/styles.d.ts +7 -8
  17. package/dist/components/Select/styles.d.ts +1 -2
  18. package/dist/components/Tabs/styles.d.ts +4 -4
  19. package/dist/components/TestArea/components/InputTest/styles.d.ts +3 -4
  20. package/dist/components/TestArea/components/TextArea/styles.d.ts +6 -7
  21. package/dist/components/TestArea/styles.d.ts +4 -5
  22. package/package.json +35 -70
  23. package/src/Leia.tsx +0 -44
  24. package/src/components/CustomToast/index.tsx +0 -62
  25. package/src/components/CustomToast/styles.tsx +0 -73
  26. package/src/components/EmptyState/index.tsx +0 -88
  27. package/src/components/EmptyState/styles.tsx +0 -81
  28. package/src/components/FileArea/components/AreaUpload/index.tsx +0 -137
  29. package/src/components/FileArea/components/AreaUpload/styles.tsx +0 -75
  30. package/src/components/FileArea/components/Modal/ModalButtonClose.tsx +0 -23
  31. package/src/components/FileArea/components/Modal/ModalContent.tsx +0 -26
  32. package/src/components/FileArea/components/Modal/ModalFooter.tsx +0 -18
  33. package/src/components/FileArea/components/Modal/ModalHeader.tsx +0 -18
  34. package/src/components/FileArea/components/Modal/ModalTitle.tsx +0 -18
  35. package/src/components/FileArea/components/Modal/index.tsx +0 -131
  36. package/src/components/FileArea/components/Modal/styles.tsx +0 -121
  37. package/src/components/FileArea/components/Search/index.tsx +0 -44
  38. package/src/components/FileArea/components/Search/styles.tsx +0 -26
  39. package/src/components/FileArea/components/Spinner/index.tsx +0 -22
  40. package/src/components/FileArea/components/Spinner/styles.tsx +0 -59
  41. package/src/components/FileArea/components/Table/index.tsx +0 -34
  42. package/src/components/FileArea/components/Table/styles.tsx +0 -60
  43. package/src/components/FileArea/index.tsx +0 -281
  44. package/src/components/FileArea/styles.tsx +0 -183
  45. package/src/components/MultiSelect/index.tsx +0 -102
  46. package/src/components/MultiSelect/styles.tsx +0 -77
  47. package/src/components/Select/index.tsx +0 -53
  48. package/src/components/Select/styles.tsx +0 -49
  49. package/src/components/Tabs/index.tsx +0 -71
  50. package/src/components/Tabs/styles.tsx +0 -87
  51. package/src/components/TestArea/components/InputTest/index.tsx +0 -21
  52. package/src/components/TestArea/components/InputTest/styles.tsx +0 -28
  53. package/src/components/TestArea/components/TextArea/index.tsx +0 -97
  54. package/src/components/TestArea/components/TextArea/styles.tsx +0 -171
  55. package/src/components/TestArea/index.tsx +0 -101
  56. package/src/components/TestArea/styles.tsx +0 -112
  57. package/src/contexts/SharedPropsProvider.tsx +0 -79
  58. package/src/index.tsx +0 -20
  59. package/src/interface/FileData.ts +0 -11
  60. package/src/interface/Language.ts +0 -93
  61. package/src/interface/Table.ts +0 -12
  62. package/src/service/Api.ts +0 -9
  63. package/src/service/ApiDev.ts +0 -9
  64. package/src/service/ApiHml.ts +0 -9
  65. package/src/store/index.ts +0 -13
  66. package/src/store/modules/actions.ts +0 -88
  67. package/src/store/modules/reducer.ts +0 -46
  68. package/src/store/modules/sagas.ts +0 -127
  69. package/src/store/modules/types.ts +0 -19
  70. package/src/types/image.d.ts +0 -4
  71. package/src/utils/formatAxios.tsx +0 -15
  72. package/src/utils/getApi.tsx +0 -16
  73. package/src/utils/getLanguage.tsx +0 -17
  74. package/src/utils/languages/en.ts +0 -87
  75. package/src/utils/languages/es.ts +0 -87
  76. package/src/utils/languages/pt-br.ts +0 -87
@@ -1,102 +0,0 @@
1
- import React, { useEffect, useState } from 'react';
2
- import * as S from './styles';
3
- import { getLanguage } from '../../utils/getLanguage'
4
- import { Language } from '../../interface/Language';
5
-
6
- interface Option {
7
- label: string;
8
- value: string;
9
- }
10
-
11
- interface MultiSelectProps {
12
- options: Option[];
13
- presset: string[];
14
- setPresset: React.Dispatch<React.SetStateAction<string[]>>;
15
- setOptions: React.Dispatch<React.SetStateAction<Option[]>>;
16
- modal: boolean;
17
- hasAddNewOptions: boolean;
18
- language: keyof Record<'en' | 'pt-br' | 'es', Language>;
19
- }
20
-
21
- const MultiSelect: React.FC<MultiSelectProps> = ({ options, presset, setPresset, setOptions, modal, language, hasAddNewOptions }) => {
22
- const [expanded, setExpanded] = useState(false);
23
- const [newOption, setNewOption] = useState('');
24
- const t = getLanguage(language)
25
-
26
- useEffect(() => {
27
- setExpanded(false)
28
- }, [modal])
29
-
30
- const handleCheckboxChange = (value: string) => {
31
- setPresset(prevPresset => {
32
- if (prevPresset.includes(value)) {
33
- return prevPresset.filter(val => val !== value);
34
- } else {
35
- return [...prevPresset, value];
36
- }
37
- });
38
- }
39
-
40
- const showCheckboxes = () => {
41
- setExpanded(!expanded);
42
- }
43
-
44
- const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
45
- setNewOption(event.target.value);
46
- }
47
-
48
- const handleInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {
49
- if (event.key === 'Enter' && hasAddNewOptions) {
50
- event.preventDefault();
51
- const trimmedOption = newOption.trim();
52
- if (trimmedOption !== '' && !options.some(option => option.value === trimmedOption)) {
53
- setOptions(prevOptions => [...prevOptions, { label: trimmedOption, value: trimmedOption }]);
54
- setPresset(prevPresset => [...prevPresset, trimmedOption]);
55
- }
56
- setNewOption('');
57
- }
58
- }
59
-
60
- return (
61
- <form>
62
- <S.MultiSelectWrapper>
63
- <S.SelectBox onClick={showCheckboxes}>
64
- <select>
65
- {options.map((option, index) => (
66
- <option key={index} value={option.value}>{option.label}</option>
67
- ))}
68
- </select>
69
- <S.OverSelect>
70
- <S.SelectedValues>
71
- {presset.map((value, index) => (
72
- <S.SelectedValue key={index}>{value}</S.SelectedValue>
73
- ))}
74
- </S.SelectedValues>
75
- <input
76
- type="text"
77
- placeholder={hasAddNewOptions ? t.buttons.addNewPresset : t.buttons.addPresset}
78
- value={newOption}
79
- onChange={handleInputChange}
80
- onKeyPress={handleInputKeyPress}
81
- />
82
- </S.OverSelect>
83
- </S.SelectBox>
84
- <S.Checkboxes style={{ display: expanded ? 'block' : 'none' }}>
85
- {options.map((option, index) => (
86
- <S.CheckboxLabel key={index} htmlFor={option.value}>
87
- <input
88
- type="checkbox"
89
- id={option.value}
90
- checked={presset.includes(option.value)}
91
- onChange={() => handleCheckboxChange(option.value)}
92
- />
93
- {option.label}
94
- </S.CheckboxLabel>
95
- ))}
96
- </S.Checkboxes>
97
- </S.MultiSelectWrapper>
98
- </form>
99
- );
100
- }
101
-
102
- export default MultiSelect;
@@ -1,77 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const MultiSelectWrapper = styled.div`
4
- width: 100%;
5
- height: 45px;
6
- `;
7
-
8
- export const SelectBox = styled.div`
9
- position: relative;
10
-
11
- select {
12
- width: 100%;
13
- font-weight: bold;
14
- height: 45px;
15
- border-radius: 4px;
16
- }
17
- `;
18
-
19
- export const OverSelect = styled.div`
20
- position: absolute;
21
- left: 0;
22
- right: 0;
23
- top: 0;
24
- bottom: 0;
25
- display: flex;
26
-
27
- input {
28
- height: 43px;
29
- width: calc(100% - 30px);
30
- border: none;
31
- margin: 1px;
32
-
33
- &:focus {
34
- outline: none;
35
- box-shadow: 0 0 0 3px #6690ff;
36
- }
37
- }
38
- `;
39
-
40
- export const Checkboxes = styled.div`
41
- display: none;
42
- background: white;
43
- position: absolute;
44
- width: 95%;
45
- z-index: 10;
46
-
47
- label {
48
- padding: 10px 5px;
49
- }
50
- `;
51
-
52
- export const CheckboxLabel = styled.label`
53
- display: block;
54
-
55
- &:hover {
56
- background-color: #6690ff;
57
- }
58
- `;
59
-
60
- export const SelectedValues = styled.div`
61
- position: absolute;
62
- top: 9px;
63
- display: flex;
64
- flex-wrap: wrap;
65
- margin-left: 5px;
66
- right: 30px;
67
- `;
68
-
69
- export const SelectedValue = styled.div`
70
- background-color: #254EDB;
71
- color: white;
72
- border-radius: 15px;
73
- padding: 5px 10px;
74
- margin-right: 5px;
75
- margin-bottom: 5px;
76
- white-space: nowrap;
77
- `;
@@ -1,53 +0,0 @@
1
- import React, { useState } from 'react';
2
- import * as S from './styles';
3
-
4
- interface SelectOption {
5
- value: string | number;
6
- label: string;
7
- }
8
-
9
- interface SelectProps {
10
- options: SelectOption[];
11
- onSelect: (value: string) => void;
12
- placeholder?: string;
13
- }
14
-
15
- const CustomSelect: React.FC<SelectProps> = ({ options, onSelect, placeholder }) => {
16
- const [isOpen, setIsOpen] = useState(false);
17
- const [selectedValue, setSelectedValue] = useState<string | number>('');
18
-
19
- const handleSelectOption = (value: string | number) => {
20
- const selected = String(value);
21
- setSelectedValue(selected);
22
- onSelect(selected);
23
- setIsOpen(false);
24
- };
25
-
26
- return (
27
- <S.Container>
28
- <div className="custom-select" onClick={() => setIsOpen(!isOpen)}>
29
- <div className="selected-option">
30
- {selectedValue || placeholder}
31
- <span className="arrow">&#9660;</span>
32
- </div>
33
- {isOpen && (
34
- <div className="options">
35
- {options.map(option => (
36
- <div
37
- key={option.value}
38
- style={{ background: option.value === selectedValue ? '#a0b7f5' : undefined,
39
- color: option.value === selectedValue ? 'white' : undefined }}
40
- className="option"
41
- onClick={() => handleSelectOption(option.value)}
42
- >
43
- {option.label}
44
- </div>
45
- ))}
46
- </div>
47
- )}
48
- </div>
49
- </S.Container>
50
- );
51
- };
52
-
53
- export default CustomSelect;
@@ -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;