sbwb-ds 3.0.18 → 3.0.21
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 +7419 -7405
- package/dist/sbwb-ds.umd.cjs +691 -700
- package/dist/src/presentation/components/atoms/Icon/index.d.ts +1 -1
- package/dist/src/presentation/components/atoms/Select/index.d.ts +1 -0
- package/dist/src/presentation/components/molecules/DataTable/Components/ActionButtonCell/index.d.ts +2 -1
- package/dist/src/presentation/components/molecules/MenuSelect/index.d.ts +4 -0
- package/dist/src/presentation/components/molecules/MenuSelect/styles.d.ts +4 -0
- package/dist/src/presentation/components/molecules/Tree/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/presentation/components/atoms/Button/styles.ts +8 -1
- package/src/presentation/components/atoms/Icon/index.tsx +1 -1
- package/src/presentation/components/atoms/Input/styles.ts +6 -12
- package/src/presentation/components/atoms/Select/Select.stories.tsx +3 -0
- package/src/presentation/components/atoms/Select/index.tsx +3 -0
- package/src/presentation/components/molecules/Autocomplete/index.tsx +5 -1
- package/src/presentation/components/molecules/DataTable/Components/ActionButtonCell/index.tsx +21 -12
- package/src/presentation/components/molecules/DataTable/Components/TableCell/TableCell.stories.tsx +88 -5
- package/src/presentation/components/molecules/MenuSelect/index.tsx +13 -7
- package/src/presentation/components/molecules/MenuSelect/styles.ts +14 -11
- package/src/presentation/components/molecules/Tree/index.tsx +24 -1
package/dist/src/presentation/components/molecules/DataTable/Components/ActionButtonCell/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface ActionButtonCellProps {
|
|
|
12
12
|
selectedOption?: SelectOption | null;
|
|
13
13
|
onOptionSelect: (option: SelectOption | any) => void;
|
|
14
14
|
prioritizeButtons?: (buttons: ActionButtonProps[]) => ActionButtonProps[];
|
|
15
|
+
menuLateralPadding?: string;
|
|
15
16
|
}
|
|
16
|
-
declare const ActionButtonCell: ({ buttonsProps, size, density, disabled, editable, selectedOption, onOptionSelect, prioritizeButtons, }: ActionButtonCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const ActionButtonCell: ({ buttonsProps, size, density, disabled, editable, selectedOption, onOptionSelect, prioritizeButtons, menuLateralPadding, }: ActionButtonCellProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export default ActionButtonCell;
|
|
@@ -18,6 +18,10 @@ export interface MenuSelectProps {
|
|
|
18
18
|
topOffset?: number;
|
|
19
19
|
bottomOffset?: number;
|
|
20
20
|
truncateText?: boolean;
|
|
21
|
+
menuJustifyContent?: 'center' | 'flex-start';
|
|
22
|
+
tableActionButton?: boolean;
|
|
23
|
+
menuLateralPadding?: string;
|
|
24
|
+
menuOptionFlexDirection?: 'row' | 'column';
|
|
21
25
|
}
|
|
22
26
|
declare const MenuSelect: React.FC<MenuSelectProps>;
|
|
23
27
|
export default MenuSelect;
|
|
@@ -17,6 +17,9 @@ interface OptionProps {
|
|
|
17
17
|
truncateText?: boolean;
|
|
18
18
|
disabled?: boolean;
|
|
19
19
|
iconName?: string;
|
|
20
|
+
menuJustifyContent: 'center' | 'flex-start';
|
|
21
|
+
tableActionButton?: boolean;
|
|
22
|
+
menuOptionFlexDirection?: 'row' | 'column';
|
|
20
23
|
}
|
|
21
24
|
export declare const Option: import("styled-components").StyledComponent<"li", any, OptionProps, never>;
|
|
22
25
|
export declare const SectionOptions: import("styled-components").StyledComponent<"li", any, EmptyOptionProps, never>;
|
|
@@ -30,6 +33,7 @@ interface ContainerProps {
|
|
|
30
33
|
highlightedIndex?: boolean;
|
|
31
34
|
disabled?: boolean;
|
|
32
35
|
size?: 'Small' | 'Medium';
|
|
36
|
+
menuLateralPadding?: string;
|
|
33
37
|
}
|
|
34
38
|
export declare const Container: import("styled-components").StyledComponent<"div", any, ContainerProps, never>;
|
|
35
39
|
interface IconContainerProps {
|
|
@@ -24,6 +24,7 @@ export interface TreeProps {
|
|
|
24
24
|
width?: string;
|
|
25
25
|
height?: string;
|
|
26
26
|
flex?: string;
|
|
27
|
+
toggleOnFolderClick?: boolean;
|
|
27
28
|
}
|
|
28
29
|
export interface TreeListProps {
|
|
29
30
|
nodes: TreeItem[];
|
|
@@ -37,6 +38,7 @@ export interface TreeListProps {
|
|
|
37
38
|
width?: string;
|
|
38
39
|
height?: string;
|
|
39
40
|
flex?: string;
|
|
41
|
+
toggleOnFolderClick?: boolean;
|
|
40
42
|
}
|
|
41
43
|
declare const TreeList: React.FC<TreeListProps>;
|
|
42
44
|
export default TreeList;
|
package/package.json
CHANGED
|
@@ -34,6 +34,8 @@ export const Button = styled.button<ButtonProps>`
|
|
|
34
34
|
padding: ${({ size }) => {
|
|
35
35
|
if (size === 'Small') {
|
|
36
36
|
return `0 ${sg.spacings.spacingInline.spacingInlineAnt}`;
|
|
37
|
+
} else if (size === 'Extra Small') {
|
|
38
|
+
return sg.spacings.spacingInline.spacingInlineAnt;
|
|
37
39
|
} else {
|
|
38
40
|
return `0 ${sg.spacings.spacingInline.spacingInlineSm}`;
|
|
39
41
|
}
|
|
@@ -124,7 +126,12 @@ export const Button = styled.button<ButtonProps>`
|
|
|
124
126
|
return sg.spacings.spacingStack.spacingStackXl;
|
|
125
127
|
}
|
|
126
128
|
}};
|
|
127
|
-
border-radius: ${
|
|
129
|
+
border-radius: ${({ size }) => {
|
|
130
|
+
if (size !== 'Extra Small') {
|
|
131
|
+
return sg.borders.borderRadius.borderRadiusSm;
|
|
132
|
+
}
|
|
133
|
+
return sg.borders.borderRadius.borderRadiusXs;
|
|
134
|
+
}};
|
|
128
135
|
& > svg {
|
|
129
136
|
width: ${({ size }) => {
|
|
130
137
|
if (size === 'Small') {
|
|
@@ -213,12 +213,6 @@ export const InputShape = styled.label<InputShapeProps>`
|
|
|
213
213
|
${sg.colors.feedbackColors.colorFeedbackSuccess};
|
|
214
214
|
background-color: ${sg.colors.brandColors.colorBrandSeSoft};
|
|
215
215
|
`;
|
|
216
|
-
} else if (!success && !disabled) {
|
|
217
|
-
return css`
|
|
218
|
-
border: ${sg.borders.borderWidth.borderWidthThinner} solid
|
|
219
|
-
${sg.colors.neutralColors.colorNeutralCleanest};
|
|
220
|
-
background-color: ${sg.colors.neutralColors.colorNeutralSnow};
|
|
221
|
-
`;
|
|
222
216
|
}
|
|
223
217
|
}}
|
|
224
218
|
|
|
@@ -318,9 +312,9 @@ export const Input = styled.input<InputProps>`
|
|
|
318
312
|
font-family: ${sg.fonts.fontFamily.fontFamilyPrimary};
|
|
319
313
|
font-size: ${({ size, variant }) => {
|
|
320
314
|
if (variant === 'table') {
|
|
321
|
-
if (size === 'ExtraSmall') return
|
|
322
|
-
if (size === 'Small') return
|
|
323
|
-
return
|
|
315
|
+
if (size === 'ExtraSmall') return sg.fonts.fontSize.fontSizeBodySm;
|
|
316
|
+
if (size === 'Small') return sg.fonts.fontSize.fontSizeBodySm;
|
|
317
|
+
return sg.fonts.fontSize.fontSizeBodyMd;
|
|
324
318
|
} else {
|
|
325
319
|
if (size === 'ExtraSmall') return sg.fonts.fontSize.fontSizeBodyMd;
|
|
326
320
|
if (size === 'Small') return sg.fonts.fontSize.fontSizeBodyMd;
|
|
@@ -338,9 +332,9 @@ export const Input = styled.input<InputProps>`
|
|
|
338
332
|
font-family: ${sg.fonts.fontFamily.fontFamilyPrimary};
|
|
339
333
|
font-size: ${({ size, variant }) => {
|
|
340
334
|
if (variant === 'table') {
|
|
341
|
-
if (size === 'ExtraSmall'
|
|
342
|
-
|
|
343
|
-
return
|
|
335
|
+
if (size === 'ExtraSmall' || size === 'Small')
|
|
336
|
+
return sg.fonts.fontSize.fontSizeBodySm;
|
|
337
|
+
return sg.fonts.fontSize.fontSizeBodyMd;
|
|
344
338
|
} else {
|
|
345
339
|
if (size === 'ExtraSmall') return sg.fonts.fontSize.fontSizeBodyMd;
|
|
346
340
|
if (size === 'Small') return sg.fonts.fontSize.fontSizeBodyMd;
|
|
@@ -47,6 +47,7 @@ export type SelectProps = {
|
|
|
47
47
|
fontSize?: string;
|
|
48
48
|
fontWeight?: string;
|
|
49
49
|
successMessage?: string;
|
|
50
|
+
maxHeightMenu?: string;
|
|
50
51
|
|
|
51
52
|
/** @deprecated Use `onSelect` instead */
|
|
52
53
|
handleOption?: (value: SelectOption | undefined) => void;
|
|
@@ -88,6 +89,7 @@ const Select: React.FC<SelectProps> = forwardRef<
|
|
|
88
89
|
fontSize,
|
|
89
90
|
fontWeight = '400',
|
|
90
91
|
successMessage,
|
|
92
|
+
maxHeightMenu,
|
|
91
93
|
},
|
|
92
94
|
ref
|
|
93
95
|
) => {
|
|
@@ -329,6 +331,7 @@ const Select: React.FC<SelectProps> = forwardRef<
|
|
|
329
331
|
.width.toString()}px`}
|
|
330
332
|
bottomOffset={bottomOffset}
|
|
331
333
|
topOffset={topOffset}
|
|
334
|
+
maxHeightMenu={maxHeightMenu}
|
|
332
335
|
/>
|
|
333
336
|
)}
|
|
334
337
|
</C.Container>
|
|
@@ -2,7 +2,7 @@ import { Icons } from '../../../../main/helpers/functions/icons';
|
|
|
2
2
|
import { SelectOption } from '../../../../models/select-option';
|
|
3
3
|
import * as C from './styles';
|
|
4
4
|
import { useAutocomplete } from './hooks/useAutocomplete';
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useEffect } from 'react';
|
|
6
6
|
import MenuSelect from '../MenuSelect';
|
|
7
7
|
import MenuMultiSelect from '../../atoms/MenuMultiSelect';
|
|
8
8
|
import Tag from '../../atoms/Tag';
|
|
@@ -144,6 +144,10 @@ const Autocomplete: React.FC<AutocompleteProps> = forwardRef<
|
|
|
144
144
|
|
|
145
145
|
const hasError = !!errorMessage;
|
|
146
146
|
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
setOptionAutocomplete(options);
|
|
149
|
+
}, [options]);
|
|
150
|
+
|
|
147
151
|
return (
|
|
148
152
|
<C.AutocompleteContainer
|
|
149
153
|
ref={autocompleteContainerRef}
|
package/src/presentation/components/molecules/DataTable/Components/ActionButtonCell/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import ActionButton, {
|
|
|
5
5
|
import { DraggableHandle, MenuSelect } from '../../../../atoms';
|
|
6
6
|
import { useRef, useState, useEffect } from 'react';
|
|
7
7
|
import { SelectOption } from '../../../../../../models/select-option'; // Verifique o caminho de importação
|
|
8
|
+
import { sg } from '../../../../../styles';
|
|
8
9
|
|
|
9
10
|
interface ActionButtonProps extends ActionButtonElementProps {
|
|
10
11
|
isDragHandle?: boolean;
|
|
@@ -19,6 +20,7 @@ export interface ActionButtonCellProps {
|
|
|
19
20
|
selectedOption?: SelectOption | null;
|
|
20
21
|
onOptionSelect: (option: SelectOption | any) => void;
|
|
21
22
|
prioritizeButtons?: (buttons: ActionButtonProps[]) => ActionButtonProps[];
|
|
23
|
+
menuLateralPadding?: string;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const ActionButtonCell = ({
|
|
@@ -30,6 +32,7 @@ const ActionButtonCell = ({
|
|
|
30
32
|
selectedOption,
|
|
31
33
|
onOptionSelect,
|
|
32
34
|
prioritizeButtons,
|
|
35
|
+
menuLateralPadding,
|
|
33
36
|
}: ActionButtonCellProps) => {
|
|
34
37
|
const divRef = useRef<HTMLDivElement>(null);
|
|
35
38
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -77,18 +80,20 @@ const ActionButtonCell = ({
|
|
|
77
80
|
label: button.tooltipProps?.label || `Action ${index + 3}`,
|
|
78
81
|
value: button.iconName || `Action ${index + 3}`,
|
|
79
82
|
render: () => (
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
<div style={{ paddingRight: sg.spacings.spacingStack.spacingStackNano }}>
|
|
84
|
+
<ActionButton
|
|
85
|
+
buttonType="secondary"
|
|
86
|
+
iconName={button.iconName}
|
|
87
|
+
selectedIconName={button.selectedIconName}
|
|
88
|
+
onClick={() => handleButtonClick(button.iconName)}
|
|
89
|
+
disabled={disabled}
|
|
90
|
+
size={size}
|
|
91
|
+
isSelected={button.isSelected}
|
|
92
|
+
data-icon-name={button.iconName}
|
|
93
|
+
// selectVariant={true}
|
|
94
|
+
// selectVariantLabel={button.selectVariantLabel || `Action ${index + 3}`}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
92
97
|
),
|
|
93
98
|
}));
|
|
94
99
|
|
|
@@ -141,6 +146,10 @@ const ActionButtonCell = ({
|
|
|
141
146
|
selectOption={handleOptionSelected}
|
|
142
147
|
optionsSelect={moreOptions}
|
|
143
148
|
menuIsOpen={isOpen}
|
|
149
|
+
menuJustifyContent="center"
|
|
150
|
+
tableActionButton
|
|
151
|
+
menuLateralPadding={menuLateralPadding}
|
|
152
|
+
menuOptionFlexDirection="row"
|
|
144
153
|
/>
|
|
145
154
|
)}
|
|
146
155
|
</>
|
package/src/presentation/components/molecules/DataTable/Components/TableCell/TableCell.stories.tsx
CHANGED
|
@@ -7,6 +7,8 @@ import TableSelect from '../../../../atoms/Select';
|
|
|
7
7
|
import TableMultiSelect from '../../../../molecules/MultiSelect';
|
|
8
8
|
import TableRow from '../TableRow';
|
|
9
9
|
import { error } from 'echarts/types/src/util/log.js';
|
|
10
|
+
import { Container } from '../../../../atoms';
|
|
11
|
+
import { sg } from '../../../../../styles';
|
|
10
12
|
|
|
11
13
|
export default {
|
|
12
14
|
title: 'Table/TableCell',
|
|
@@ -108,6 +110,10 @@ export default {
|
|
|
108
110
|
control: 'text',
|
|
109
111
|
description: 'Padding of the cell.',
|
|
110
112
|
},
|
|
113
|
+
maxHeightMenu: {
|
|
114
|
+
control: 'text',
|
|
115
|
+
description: 'Max height of the menu.',
|
|
116
|
+
},
|
|
111
117
|
},
|
|
112
118
|
};
|
|
113
119
|
|
|
@@ -606,27 +612,36 @@ export const SuccessCell = SuccessCellTemplate.bind({});
|
|
|
606
612
|
|
|
607
613
|
const DropdownCellTemplate = (args) => {
|
|
608
614
|
const options = [
|
|
609
|
-
{ label: '
|
|
610
|
-
{ label: '
|
|
611
|
-
{ label: '
|
|
615
|
+
{ label: 'Option 1', value: '1' },
|
|
616
|
+
{ label: 'Option 2', value: '2' },
|
|
617
|
+
{ label: 'Option 3', value: '3' },
|
|
618
|
+
{ label: 'Option 4', value: '4' },
|
|
619
|
+
{ label: 'Option 5', value: '5' },
|
|
620
|
+
{ label: 'Option 6', value: '6' },
|
|
621
|
+
{ label: 'Option 7', value: '7' },
|
|
622
|
+
{ label: 'Option 8', value: '8' },
|
|
623
|
+
{ label: 'Option 9', value: '9' },
|
|
624
|
+
{ label: 'Option 10', value: '10' },
|
|
612
625
|
];
|
|
613
626
|
const [selectedOption, setSelectedOption] = useState<
|
|
614
627
|
SelectOption | undefined
|
|
615
628
|
>(undefined);
|
|
629
|
+
|
|
616
630
|
return (
|
|
617
|
-
<div style={{ padding: '100px' }}>
|
|
631
|
+
<div style={{ padding: '100px', height: '100px' }}>
|
|
618
632
|
<TableSelect
|
|
619
633
|
options={options}
|
|
620
634
|
value={selectedOption}
|
|
621
635
|
onSelect={setSelectedOption}
|
|
622
636
|
variant="table"
|
|
623
|
-
width="
|
|
637
|
+
width="143px"
|
|
624
638
|
disabled={args.disabled}
|
|
625
639
|
placeholder="Text"
|
|
626
640
|
errorMessage={args.errorMessage}
|
|
627
641
|
successMessage={args.successMessage}
|
|
628
642
|
size={args.size === 'large' ? 'Medium' : 'Small'}
|
|
629
643
|
tableDensity={args.density}
|
|
644
|
+
{...args}
|
|
630
645
|
/>
|
|
631
646
|
</div>
|
|
632
647
|
);
|
|
@@ -637,4 +652,72 @@ export const DropdownCell = DropdownCellTemplate.bind({});
|
|
|
637
652
|
DropdownCell.args = {
|
|
638
653
|
errorMessage: '',
|
|
639
654
|
successMessage: '',
|
|
655
|
+
maxHeightMenu: '180px',
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
const DropdownCellTemplateIcons = (args) => {
|
|
659
|
+
const options = [
|
|
660
|
+
{ label: 'Option 1', value: '1' },
|
|
661
|
+
{ label: 'Option 2', value: '2' },
|
|
662
|
+
{ label: 'Option 3', value: '3' },
|
|
663
|
+
{ label: 'Option 4', value: '4' },
|
|
664
|
+
{ label: 'Option 5', value: '5' },
|
|
665
|
+
{ label: 'Option 6', value: '6' },
|
|
666
|
+
{ label: 'Option 7', value: '7' },
|
|
667
|
+
{ label: 'Option 8', value: '8' },
|
|
668
|
+
{ label: 'Option 9', value: '9' },
|
|
669
|
+
{ label: 'Option 10', value: '10' },
|
|
670
|
+
];
|
|
671
|
+
const [selectedOption, setSelectedOption] = useState<
|
|
672
|
+
SelectOption | undefined
|
|
673
|
+
>(undefined);
|
|
674
|
+
|
|
675
|
+
return (
|
|
676
|
+
<div style={{ padding: '100px', height: '100px' }}>
|
|
677
|
+
<Container direction="row" width="104px">
|
|
678
|
+
<ActionButtonCell
|
|
679
|
+
onOptionSelect={setSelectedOption}
|
|
680
|
+
size="Small"
|
|
681
|
+
buttonsProps={[
|
|
682
|
+
{
|
|
683
|
+
iconName: 'EditAnt',
|
|
684
|
+
iconColor: sg.colors.neutralColors.colorNeutralCloudy,
|
|
685
|
+
buttonType: 'secondary',
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
iconName: 'DownloadAnt',
|
|
689
|
+
iconColor: sg.colors.neutralColors.colorNeutralCloudy,
|
|
690
|
+
buttonType: 'secondary',
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
iconName: 'DeleteFILL0Sm',
|
|
694
|
+
iconColor: sg.colors.neutralColors.colorNeutralCloudy,
|
|
695
|
+
buttonType: 'secondary',
|
|
696
|
+
tooltipProps: { label: 'Excluir' },
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
iconName: 'AttachFileSm',
|
|
700
|
+
iconColor: sg.colors.neutralColors.colorNeutralCloudy,
|
|
701
|
+
buttonType: 'secondary',
|
|
702
|
+
tooltipProps: { label: 'Anexar' },
|
|
703
|
+
},
|
|
704
|
+
{
|
|
705
|
+
iconName: 'VisibilitySm',
|
|
706
|
+
iconColor: sg.colors.neutralColors.colorNeutralCloudy,
|
|
707
|
+
buttonType: 'secondary',
|
|
708
|
+
tooltipProps: { label: 'Visualizar' },
|
|
709
|
+
},
|
|
710
|
+
]}
|
|
711
|
+
{...args}
|
|
712
|
+
/>
|
|
713
|
+
</Container>
|
|
714
|
+
</div>
|
|
715
|
+
);
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
export const DropdownCellIcons = DropdownCellTemplateIcons.bind({});
|
|
719
|
+
|
|
720
|
+
DropdownCellIcons.args = {
|
|
721
|
+
menuLateralPadding: '0',
|
|
722
|
+
menuJustifyContent: 'flex-start',
|
|
640
723
|
};
|
|
@@ -25,6 +25,10 @@ export interface MenuSelectProps {
|
|
|
25
25
|
topOffset?: number;
|
|
26
26
|
bottomOffset?: number;
|
|
27
27
|
truncateText?: boolean;
|
|
28
|
+
menuJustifyContent?: 'center' | 'flex-start';
|
|
29
|
+
tableActionButton?: boolean;
|
|
30
|
+
menuLateralPadding?: string;
|
|
31
|
+
menuOptionFlexDirection?: 'row' | 'column';
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
@@ -50,6 +54,10 @@ const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
|
50
54
|
topOffset = 0,
|
|
51
55
|
bottomOffset = 0,
|
|
52
56
|
truncateText = true,
|
|
57
|
+
menuJustifyContent = 'flex-start',
|
|
58
|
+
tableActionButton,
|
|
59
|
+
menuLateralPadding = '8px',
|
|
60
|
+
menuOptionFlexDirection = 'column',
|
|
53
61
|
},
|
|
54
62
|
ref
|
|
55
63
|
) => {
|
|
@@ -135,6 +143,7 @@ const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
|
135
143
|
onMouseEnter={() => setHighlightedIndex(index)}
|
|
136
144
|
disabled={option.disabled}
|
|
137
145
|
size={size}
|
|
146
|
+
menuLateralPadding={menuLateralPadding}
|
|
138
147
|
>
|
|
139
148
|
{iconPosition === 'left' && (
|
|
140
149
|
<C.IconContainer
|
|
@@ -154,6 +163,8 @@ const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
|
154
163
|
</C.IconContainer>
|
|
155
164
|
)}
|
|
156
165
|
<C.Option
|
|
166
|
+
menuOptionFlexDirection={menuOptionFlexDirection}
|
|
167
|
+
menuJustifyContent={menuJustifyContent}
|
|
157
168
|
iconName={iconName}
|
|
158
169
|
isOptionSelected={isOptionSelected(option)}
|
|
159
170
|
highlightedIndex={index === highlightedIndex}
|
|
@@ -163,6 +174,7 @@ const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
|
163
174
|
optionValue={option.value}
|
|
164
175
|
disabled={option.disabled}
|
|
165
176
|
truncateText={truncateText}
|
|
177
|
+
tableActionButton={tableActionButton}
|
|
166
178
|
>
|
|
167
179
|
<C.ContentHighlightedText
|
|
168
180
|
truncateText={
|
|
@@ -173,13 +185,7 @@ const MenuSelect: React.FC<MenuSelectProps> = forwardRef<
|
|
|
173
185
|
{React.isValidElement(option.label) ? (
|
|
174
186
|
<p title={getLabelText(option.label)}>{option.label}</p>
|
|
175
187
|
) : (
|
|
176
|
-
<p
|
|
177
|
-
title={labelText}
|
|
178
|
-
style={{
|
|
179
|
-
paddingLeft:
|
|
180
|
-
sg.spacings.spacingStack.spacingStackNano,
|
|
181
|
-
}}
|
|
182
|
-
>
|
|
188
|
+
<p title={labelText}>
|
|
183
189
|
{labelText.substring(0, indexMatch)}
|
|
184
190
|
<C.HighlightedText size={size}>
|
|
185
191
|
{labelText.substring(
|
|
@@ -20,6 +20,7 @@ export const Options = styled.ul<OptionsProps>`
|
|
|
20
20
|
border-radius: ${sg.borders.borderRadius.borderRadiusSm};
|
|
21
21
|
box-shadow: ${sg.shadows.shadowLevelNear};
|
|
22
22
|
width: ${({ width }) => width};
|
|
23
|
+
height: ${({ maxHeight }) => maxHeight};
|
|
23
24
|
max-height: ${({ maxHeight }) => maxHeight};
|
|
24
25
|
z-index: 1000;
|
|
25
26
|
background-color: ${sg.colors.backgroundColors.colorBackgroundSnow};
|
|
@@ -65,14 +66,19 @@ interface OptionProps {
|
|
|
65
66
|
truncateText?: boolean;
|
|
66
67
|
disabled?: boolean;
|
|
67
68
|
iconName?: string;
|
|
69
|
+
menuJustifyContent: 'center' | 'flex-start';
|
|
70
|
+
tableActionButton?: boolean;
|
|
71
|
+
menuOptionFlexDirection?: 'row' | 'column';
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
export const Option = styled.li<OptionProps>`
|
|
71
75
|
${resetStyles}
|
|
72
|
-
width: 100%;
|
|
73
76
|
display: flex;
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
flex: 2;
|
|
78
|
+
flex-direction: ${({ menuOptionFlexDirection }) => menuOptionFlexDirection};
|
|
79
|
+
align-items: ${({ menuJustifyContent }) => menuJustifyContent};
|
|
80
|
+
justify-content: ${({ tableActionButton }) =>
|
|
81
|
+
tableActionButton ? 'flex-start' : 'center'};
|
|
76
82
|
font-size: ${({ size }) =>
|
|
77
83
|
size === 'Small'
|
|
78
84
|
? sg.fonts.fontSize.fontSizeBodyMd
|
|
@@ -108,7 +114,6 @@ export const Option = styled.li<OptionProps>`
|
|
|
108
114
|
${({ hasDescription }) =>
|
|
109
115
|
hasDescription &&
|
|
110
116
|
css`
|
|
111
|
-
margin: ${sg.spacings.spacingStack.spacingStackXs};
|
|
112
117
|
line-height: ${sg.fonts.lineHeight.lineHeightMd(
|
|
113
118
|
sg.fonts.fontSize.fontSizeBodyMd
|
|
114
119
|
)};
|
|
@@ -170,10 +175,7 @@ interface ContentHighlightedTextProps {
|
|
|
170
175
|
export const ContentHighlightedText = styled.div<ContentHighlightedTextProps>`
|
|
171
176
|
${resetStyles}
|
|
172
177
|
display: flex;
|
|
173
|
-
width: fit-content;
|
|
174
178
|
font-family: ${sg.fonts.fontFamily.fontFamilyPrimary};
|
|
175
|
-
justify-content: center;
|
|
176
|
-
align-items: center;
|
|
177
179
|
|
|
178
180
|
& > p {
|
|
179
181
|
width: 100%;
|
|
@@ -195,16 +197,17 @@ interface ContainerProps {
|
|
|
195
197
|
highlightedIndex?: boolean;
|
|
196
198
|
disabled?: boolean;
|
|
197
199
|
size?: 'Small' | 'Medium';
|
|
200
|
+
menuLateralPadding?: string;
|
|
198
201
|
}
|
|
199
202
|
|
|
200
203
|
export const Container = styled.div<ContainerProps>`
|
|
201
204
|
${resetStyles}
|
|
202
205
|
display: flex;
|
|
203
|
-
width: calc(100% - 16px);
|
|
204
|
-
justify-content: center;
|
|
205
|
-
align-items: center;
|
|
206
206
|
flex-direction: row;
|
|
207
|
-
padding: ${() =>
|
|
207
|
+
padding: ${({ menuLateralPadding }) =>
|
|
208
|
+
menuLateralPadding
|
|
209
|
+
? `0 ${menuLateralPadding}`
|
|
210
|
+
: `0 ${sg.spacings.spacingInline.spacingInlineXs}`};
|
|
208
211
|
margin: 0 ${sg.spacings.spacingInline.spacingInlineXs};
|
|
209
212
|
cursor: ${({ isOptionSelected, disabled }) =>
|
|
210
213
|
isOptionSelected || disabled ? 'default' : 'pointer'};
|
|
@@ -49,6 +49,7 @@ export interface TreeProps {
|
|
|
49
49
|
width?: string;
|
|
50
50
|
height?: string;
|
|
51
51
|
flex?: string;
|
|
52
|
+
toggleOnFolderClick?: boolean;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const Tree: React.FC<TreeProps> = React.memo(
|
|
@@ -67,6 +68,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
67
68
|
width,
|
|
68
69
|
height,
|
|
69
70
|
flex,
|
|
71
|
+
toggleOnFolderClick = true,
|
|
70
72
|
}) => {
|
|
71
73
|
const {
|
|
72
74
|
id,
|
|
@@ -132,7 +134,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
132
134
|
onClickNode?.(node);
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
if (!isLeaf) {
|
|
137
|
+
if (!isLeaf && toggleOnFolderClick) {
|
|
136
138
|
handleToggle();
|
|
137
139
|
}
|
|
138
140
|
}
|
|
@@ -146,6 +148,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
146
148
|
onClickNode,
|
|
147
149
|
handleToggle,
|
|
148
150
|
onFocus,
|
|
151
|
+
toggleOnFolderClick, // Adicionada na lista de dependências
|
|
149
152
|
]);
|
|
150
153
|
|
|
151
154
|
const getIconColor = useCallback(
|
|
@@ -170,6 +173,16 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
170
173
|
[]
|
|
171
174
|
);
|
|
172
175
|
|
|
176
|
+
const handleArrowClick = useCallback(
|
|
177
|
+
(e: React.MouseEvent) => {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
if (!disabled && !isLeaf) {
|
|
180
|
+
handleToggle();
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
[disabled, isLeaf, handleToggle]
|
|
184
|
+
);
|
|
185
|
+
|
|
173
186
|
const getIconColorArrow = useCallback(
|
|
174
187
|
(
|
|
175
188
|
isSelected: boolean,
|
|
@@ -234,6 +247,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
234
247
|
customStyles={disabled ? { cursor: 'default' } : {}}
|
|
235
248
|
width="16px"
|
|
236
249
|
height="16px"
|
|
250
|
+
onClick={handleArrowClick}
|
|
237
251
|
/>
|
|
238
252
|
<Icon
|
|
239
253
|
iconName={folderIconName()}
|
|
@@ -277,6 +291,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
277
291
|
isFocused,
|
|
278
292
|
childLeafSelected,
|
|
279
293
|
iconProps,
|
|
294
|
+
handleArrowClick,
|
|
280
295
|
]);
|
|
281
296
|
|
|
282
297
|
useEffect(() => {
|
|
@@ -364,6 +379,7 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
364
379
|
width={width}
|
|
365
380
|
height={height}
|
|
366
381
|
flex={flex}
|
|
382
|
+
toggleOnFolderClick={toggleOnFolderClick}
|
|
367
383
|
/>
|
|
368
384
|
))}
|
|
369
385
|
</C.Content>
|
|
@@ -373,6 +389,8 @@ const Tree: React.FC<TreeProps> = React.memo(
|
|
|
373
389
|
}
|
|
374
390
|
);
|
|
375
391
|
|
|
392
|
+
Tree.displayName = 'Tree';
|
|
393
|
+
|
|
376
394
|
export interface TreeListProps {
|
|
377
395
|
nodes: TreeItem[];
|
|
378
396
|
checkboxActive: boolean;
|
|
@@ -385,6 +403,7 @@ export interface TreeListProps {
|
|
|
385
403
|
width?: string;
|
|
386
404
|
height?: string;
|
|
387
405
|
flex?: string;
|
|
406
|
+
toggleOnFolderClick?: boolean;
|
|
388
407
|
}
|
|
389
408
|
|
|
390
409
|
const TreeList: React.FC<TreeListProps> = ({
|
|
@@ -399,6 +418,7 @@ const TreeList: React.FC<TreeListProps> = ({
|
|
|
399
418
|
width = '152px',
|
|
400
419
|
height = '100%',
|
|
401
420
|
flex,
|
|
421
|
+
toggleOnFolderClick = true,
|
|
402
422
|
}) => {
|
|
403
423
|
const [focusedId, setFocusedId] = useState<string | null>(null);
|
|
404
424
|
|
|
@@ -425,10 +445,13 @@ const TreeList: React.FC<TreeListProps> = ({
|
|
|
425
445
|
width={width}
|
|
426
446
|
height={height}
|
|
427
447
|
flex={flex}
|
|
448
|
+
toggleOnFolderClick={toggleOnFolderClick}
|
|
428
449
|
/>
|
|
429
450
|
))}
|
|
430
451
|
</>
|
|
431
452
|
);
|
|
432
453
|
};
|
|
433
454
|
|
|
455
|
+
TreeList.displayName = 'TreeList';
|
|
456
|
+
|
|
434
457
|
export default TreeList;
|