sbwb-ds 3.31.0 → 3.32.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.
- package/dist/sbwb-ds.js +5971 -5956
- package/dist/sbwb-ds.umd.cjs +418 -418
- package/dist/src/main/assets/icons/index.d.ts +1 -0
- package/dist/src/main/helpers/functions/icons.d.ts +30 -0
- package/package.json +12 -11
- package/src/main/assets/icons/ant/remove-done.svg +3 -0
- package/src/main/assets/icons/extraLarge/remove-done.svg +3 -0
- package/src/main/assets/icons/index.ts +1 -0
- package/src/main/assets/icons/large/remove-done.svg +3 -0
- package/src/main/assets/icons/medium/remove-done.svg +3 -0
- package/src/main/assets/icons/small/remove-done.svg +3 -0
- package/src/main/helpers/functions/icons.ts +11 -0
- package/src/presentation/components/atoms/Select/hooks/useSelect.tsx +55 -46
- package/src/presentation/components/atoms/Select/index.tsx +3 -3
|
@@ -215,3 +215,4 @@ export { default as Notifications } from './ant/notifications-off.svg';
|
|
|
215
215
|
export { default as NotificationsFill } from './ant/notifications-off-fill.svg';
|
|
216
216
|
export { default as PersonOff } from './ant/person-off.svg';
|
|
217
217
|
export { default as PersonOffFill } from './ant/person-off-fill.svg';
|
|
218
|
+
export { default as RemoveDone } from './ant/remove-done.svg';
|
|
@@ -7404,4 +7404,34 @@ export declare const Icons: {
|
|
|
7404
7404
|
desc?: string;
|
|
7405
7405
|
descId?: string;
|
|
7406
7406
|
}>;
|
|
7407
|
+
RemoveDoneAnt: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7408
|
+
title?: string;
|
|
7409
|
+
titleId?: string;
|
|
7410
|
+
desc?: string;
|
|
7411
|
+
descId?: string;
|
|
7412
|
+
}>;
|
|
7413
|
+
RemoveDoneEl: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7414
|
+
title?: string;
|
|
7415
|
+
titleId?: string;
|
|
7416
|
+
desc?: string;
|
|
7417
|
+
descId?: string;
|
|
7418
|
+
}>;
|
|
7419
|
+
RemoveDoneLg: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7420
|
+
title?: string;
|
|
7421
|
+
titleId?: string;
|
|
7422
|
+
desc?: string;
|
|
7423
|
+
descId?: string;
|
|
7424
|
+
}>;
|
|
7425
|
+
RemoveDoneMd: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7426
|
+
title?: string;
|
|
7427
|
+
titleId?: string;
|
|
7428
|
+
desc?: string;
|
|
7429
|
+
descId?: string;
|
|
7430
|
+
}>;
|
|
7431
|
+
RemoveDoneSm: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
|
|
7432
|
+
title?: string;
|
|
7433
|
+
titleId?: string;
|
|
7434
|
+
desc?: string;
|
|
7435
|
+
descId?: string;
|
|
7436
|
+
}>;
|
|
7407
7437
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbwb-ds",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.32.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Sistema de design para padronização dos processos visuais do portal SUBWEB",
|
|
6
6
|
"main": "dist/sbwb-ds.js",
|
|
@@ -28,24 +28,16 @@
|
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@types/react-window": "^1.8.8",
|
|
32
31
|
"color": "^4.2.3",
|
|
33
32
|
"dotenv": "^16.0.3",
|
|
34
33
|
"echarts": "^5.5.0",
|
|
35
34
|
"framer-motion": "^12.6.2",
|
|
36
|
-
"jest": "^29.7.0",
|
|
37
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
38
|
-
"jest-transform-stub": "^2.0.0",
|
|
39
35
|
"prismjs": "^1.29.0",
|
|
40
36
|
"react-beautiful-dnd": "^13.1.1",
|
|
41
37
|
"react-datepicker": "^4.18.0",
|
|
42
38
|
"react-mosaic-component": "^6.1.0",
|
|
43
|
-
"react-router-dom": "^6.9.0",
|
|
44
39
|
"react-syntax-highlighter": "^15.5.0",
|
|
45
|
-
"sbwb-icons": "^1.
|
|
46
|
-
"svgo": "^2.6.4",
|
|
47
|
-
"ts-node": "^10.9.1",
|
|
48
|
-
"vite-plugin-svgr": "^4.3.0"
|
|
40
|
+
"sbwb-icons": "^1.19.0"
|
|
49
41
|
},
|
|
50
42
|
"devDependencies": {
|
|
51
43
|
"@babel/core": "^7.21.3",
|
|
@@ -64,6 +56,7 @@
|
|
|
64
56
|
"@types/jest": "^29.4.2",
|
|
65
57
|
"@types/react": "^18.0.27",
|
|
66
58
|
"@types/react-dom": "^18.0.10",
|
|
59
|
+
"@types/react-window": "^1.8.8",
|
|
67
60
|
"@types/styled-components": "^5.1.34",
|
|
68
61
|
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
69
62
|
"@typescript-eslint/parser": "^5.0.0",
|
|
@@ -79,18 +72,26 @@
|
|
|
79
72
|
"eslint-plugin-promise": "^6.1.1",
|
|
80
73
|
"eslint-plugin-react": "^7.32.2",
|
|
81
74
|
"eslint-plugin-storybook": "^0.6.13",
|
|
75
|
+
"jest": "^29.7.0",
|
|
76
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
82
77
|
"jest-styled-components": "^7.2.0",
|
|
78
|
+
"jest-transform-stub": "^2.0.0",
|
|
83
79
|
"lint-staged": "^13.2.0",
|
|
84
80
|
"msw": "^1.1.0",
|
|
85
81
|
"prettier": "^2.8.4",
|
|
82
|
+
"react-router-dom": "^6.9.0",
|
|
86
83
|
"storybook": "^7.1.0",
|
|
87
84
|
"styled-components": "^5.3.9",
|
|
85
|
+
"svgo": "^2.6.4",
|
|
86
|
+
"ts-node": "^10.9.1",
|
|
88
87
|
"typescript": "^4.9.5",
|
|
89
|
-
"vite": "^4.2.1"
|
|
88
|
+
"vite": "^4.2.1",
|
|
89
|
+
"vite-plugin-svgr": "^4.3.0"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"react": "^18.3.1",
|
|
93
93
|
"react-dom": "^18.3.1",
|
|
94
|
+
"react-router-dom": ">=6.0.0",
|
|
94
95
|
"styled-components": ">=5"
|
|
95
96
|
},
|
|
96
97
|
"msw": {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M17.1458 18.2083L12.25 13.3125L10.3542 15.2083L6.8125 11.6667L7.875 10.6042L10.3542 13.0833L11.1875 12.25L3 4.0625L4.0625 3L18.2083 17.1458L17.1458 18.2083ZM6.10417 15.2083L2.5625 11.6667L3.625 10.6042L6.04167 13.0208L7.16667 14.1458L6.10417 15.2083ZM14.375 11.1875L13.3125 10.125L16.375 7.0625L17.4375 8.125L14.375 11.1875ZM12.25 9.0625L11.1875 8L12.125 7.08333L13.1875 8.14583L12.25 9.0625Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M35.9029 36.3333L24.5971 25L19.8471 29.75L10.4863 20.3887L12.4583 18.3887L19.8471 25.7779L22.5971 23.0279L4.90292 5.36124L6.875 3.36124L37.875 34.3612L35.9029 36.3333ZM11.9863 29.75L2.625 20.3887L4.59708 18.4167L11.9863 25.8054L13.9583 27.7779L11.9863 29.75ZM28.5138 21.0833L26.5417 19.1112L35.5971 10.0554L37.5971 12L28.5138 21.0833ZM24.5696 17.1387L22.5971 15.1667L27.7638 9.99999L29.7363 11.9721L24.5696 17.1387Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -215,3 +215,4 @@ export { default as Notifications } from './ant/notifications-off.svg';
|
|
|
215
215
|
export { default as NotificationsFill } from './ant/notifications-off-fill.svg';
|
|
216
216
|
export { default as PersonOff } from './ant/person-off.svg';
|
|
217
217
|
export { default as PersonOffFill } from './ant/person-off-fill.svg';
|
|
218
|
+
export { default as RemoveDone } from './ant/remove-done.svg';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M28.7223 29.0667L19.6776 20L15.8776 23.8L8.38898 16.311L9.96664 14.711L15.8776 20.6223L18.0776 18.4223L3.92231 4.289L5.49998 2.689L30.3 27.489L28.7223 29.0667ZM9.58898 23.8L2.09998 16.311L3.67764 14.7333L9.58898 20.6443L11.1666 22.2223L9.58898 23.8ZM22.811 16.8667L21.2333 15.289L28.4776 8.04433L30.0776 9.6L22.811 16.8667ZM19.6556 13.711L18.0776 12.1333L22.211 8L23.789 9.57766L19.6556 13.711Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M21.825 21.8L15.225 15.2L12.375 18.05L6.72495 12.4L8.12495 10.95L12.375 15.2L13.775 13.8L3.42495 3.45L4.82495 2L23.225 20.4L21.825 21.8ZM6.72495 18.05L1.07495 12.4L2.47495 11L6.72495 15.25L8.12495 16.65L6.72495 18.05ZM18.025 12.4L16.625 11L21.525 6.1L22.975 7.45L18.025 12.4ZM15.175 9.55L13.775 8.15L15.925 6L17.325 7.4L15.175 9.55Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M13.7167 14.5667L9.80005 10.65L8.28338 12.1667L5.45005 9.33333L6.30005 8.48333L8.28338 10.4667L8.95005 9.79999L2.40005 3.24999L3.25005 2.39999L14.5667 13.7167L13.7167 14.5667ZM4.88338 12.1667L2.05005 9.33333L2.90005 8.48333L4.83338 10.4167L5.73338 11.3167L4.88338 12.1667ZM11.5 8.94999L10.65 8.09999L13.1 5.64999L13.95 6.49999L11.5 8.94999ZM9.80005 7.24999L8.95005 6.39999L9.70005 5.66666L10.55 6.51666L9.80005 7.24999Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -1482,6 +1482,12 @@ import PersonOffFillLg from '../../assets/icons/large/person-off-fill.svg?react'
|
|
|
1482
1482
|
import PersonOffFillMd from '../../assets/icons/medium/person-off-fill.svg?react';
|
|
1483
1483
|
import PersonOffFillSm from '../../assets/icons/small/person-off-fill.svg?react';
|
|
1484
1484
|
|
|
1485
|
+
import RemoveDoneAnt from '../../assets/icons/ant/remove-done.svg?react';
|
|
1486
|
+
import RemoveDoneEl from '../../assets/icons/extraLarge/remove-done.svg?react';
|
|
1487
|
+
import RemoveDoneLg from '../../assets/icons/large/remove-done.svg?react';
|
|
1488
|
+
import RemoveDoneMd from '../../assets/icons/medium/remove-done.svg?react';
|
|
1489
|
+
import RemoveDoneSm from '../../assets/icons/small/remove-done.svg?react';
|
|
1490
|
+
|
|
1485
1491
|
export const Icons = {
|
|
1486
1492
|
ExpandedCircleDown,
|
|
1487
1493
|
ExpandedCircleRight,
|
|
@@ -2717,4 +2723,9 @@ export const Icons = {
|
|
|
2717
2723
|
PersonOffFillLg,
|
|
2718
2724
|
PersonOffFillMd,
|
|
2719
2725
|
PersonOffFillSm,
|
|
2726
|
+
RemoveDoneAnt,
|
|
2727
|
+
RemoveDoneEl,
|
|
2728
|
+
RemoveDoneLg,
|
|
2729
|
+
RemoveDoneMd,
|
|
2730
|
+
RemoveDoneSm,
|
|
2720
2731
|
};
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import { SelectOption } from '../../../../../models/select-option';
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { Icons } from '../../../../../main/helpers/functions/icons';
|
|
4
4
|
import { SelectProps } from '..';
|
|
5
5
|
import { getLabelText } from '../../../../../main/helpers/functions/getLabelText';
|
|
6
6
|
import { normalizeString } from '../../../../../main/helpers/functions/normalizeString';
|
|
7
7
|
|
|
8
|
+
const findScrollableContainers = (
|
|
9
|
+
element: HTMLElement | null
|
|
10
|
+
): HTMLElement[] => {
|
|
11
|
+
const scrollableContainers: HTMLElement[] = [];
|
|
12
|
+
let currentElement: HTMLElement | null = element;
|
|
13
|
+
|
|
14
|
+
while (currentElement && currentElement !== document.documentElement) {
|
|
15
|
+
const computedStyle = window.getComputedStyle(currentElement);
|
|
16
|
+
const overflowY = computedStyle.overflowY;
|
|
17
|
+
|
|
18
|
+
if (overflowY === 'scroll' || overflowY === 'auto') {
|
|
19
|
+
scrollableContainers.push(currentElement);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
currentElement = currentElement.parentElement;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return scrollableContainers;
|
|
26
|
+
};
|
|
27
|
+
|
|
8
28
|
export const useSelect = (
|
|
9
29
|
handleOption: (value: SelectOption | undefined) => void,
|
|
10
30
|
onSelect: (value: SelectOption | undefined) => void,
|
|
@@ -34,33 +54,12 @@ export const useSelect = (
|
|
|
34
54
|
return result;
|
|
35
55
|
}, [options, inputValue]);
|
|
36
56
|
|
|
37
|
-
// Função para encontrar contêineres com overflow e scroll
|
|
38
|
-
const findScrollableContainers = (
|
|
39
|
-
element: HTMLElement | null
|
|
40
|
-
): HTMLElement[] => {
|
|
41
|
-
const scrollableContainers: HTMLElement[] = [];
|
|
42
|
-
let currentElement: HTMLElement | null = element;
|
|
43
|
-
|
|
44
|
-
while (currentElement && currentElement !== document.documentElement) {
|
|
45
|
-
const computedStyle = window.getComputedStyle(currentElement);
|
|
46
|
-
const overflowY = computedStyle.overflowY;
|
|
47
|
-
|
|
48
|
-
if (overflowY === 'scroll' || overflowY === 'auto') {
|
|
49
|
-
scrollableContainers.push(currentElement);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
currentElement = currentElement.parentElement;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return scrollableContainers;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
57
|
useEffect(() => {
|
|
58
|
+
if (!isOpen && !expanded) return;
|
|
59
|
+
|
|
59
60
|
const handleScrollOrResize = () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
setExpanded(false);
|
|
63
|
-
}
|
|
61
|
+
setIsOpen(false);
|
|
62
|
+
setExpanded(false);
|
|
64
63
|
};
|
|
65
64
|
|
|
66
65
|
// Encontra todos os ancestrais scrolláveis
|
|
@@ -91,26 +90,36 @@ export const useSelect = (
|
|
|
91
90
|
};
|
|
92
91
|
}, [isOpen, expanded]);
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
const selectOption = useCallback(
|
|
94
|
+
(option: SelectOption) => {
|
|
95
|
+
setInputValue('');
|
|
96
|
+
setIsOpen((prev) => !prev);
|
|
97
|
+
setExpanded((prev) => !prev);
|
|
98
|
+
inputContainerRef?.current && inputContainerRef.current?.blur();
|
|
99
|
+
if (option !== value) {
|
|
100
|
+
handleOption && handleOption(option);
|
|
101
|
+
onSelect && onSelect(option);
|
|
102
|
+
} else {
|
|
103
|
+
handleOption && handleOption(undefined);
|
|
104
|
+
onSelect && onSelect(undefined);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
[value, handleOption, onSelect]
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const isValue = useCallback(
|
|
111
|
+
(valueSelected: SelectOption): boolean => !valueSelected,
|
|
112
|
+
[]
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
const ExpandLess = useMemo(
|
|
116
|
+
() => Icons[`ExpandLess${size === 'Small' ? 'Sm' : 'Ant'}`],
|
|
117
|
+
[size]
|
|
118
|
+
);
|
|
119
|
+
const ExpandMore = useMemo(
|
|
120
|
+
() => Icons[`ExpandMore${size === 'Small' ? 'Sm' : 'Ant'}`],
|
|
121
|
+
[size]
|
|
122
|
+
);
|
|
114
123
|
|
|
115
124
|
return {
|
|
116
125
|
isOpen,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectOption } from '../../../../models/select-option';
|
|
2
2
|
import { useSelect } from './hooks/useSelect';
|
|
3
|
-
import { forwardRef, ReactNode, useMemo } from 'react';
|
|
3
|
+
import { forwardRef, ReactNode, useCallback, useMemo } from 'react';
|
|
4
4
|
import MenuSelect from '../../molecules/MenuSelect';
|
|
5
5
|
import Tooltip, { TooltipProps } from '../Tooltip';
|
|
6
6
|
import { Icons } from '../../../../main/helpers/functions/icons';
|
|
@@ -139,11 +139,11 @@ const Select: React.FC<SelectProps> = forwardRef<
|
|
|
139
139
|
return undefined;
|
|
140
140
|
}, [hasError, hasSuccess, disabled]);
|
|
141
141
|
|
|
142
|
-
const handleInputBlur = () => {
|
|
142
|
+
const handleInputBlur = useCallback(() => {
|
|
143
143
|
if (!isOpen && !expanded) {
|
|
144
144
|
setInputValue('');
|
|
145
145
|
}
|
|
146
|
-
};
|
|
146
|
+
}, [isOpen, expanded, setInputValue]);
|
|
147
147
|
|
|
148
148
|
return (
|
|
149
149
|
<C.SelectContainer
|