sbwb-ds 2.2.2 → 2.3.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/index.d.ts +1 -1
- package/dist/sbwb-ds.js +12967 -13114
- package/dist/sbwb-ds.umd.cjs +1907 -2024
- package/dist/src/presentation/components/atoms/ActionButton/index.d.ts +3 -7
- package/dist/src/presentation/components/atoms/ActionButton/styles.d.ts +15 -4
- package/dist/src/presentation/components/atoms/ProgresBar/index.d.ts +11 -0
- package/dist/src/presentation/components/atoms/ProgresBar/styles.d.ts +14 -0
- package/dist/src/presentation/components/atoms/Tag/index.d.ts +3 -1
- package/package.json +1 -1
- package/src/presentation/components/atoms/ActionButton/ActionButton.stories.tsx +8 -8
- package/src/presentation/components/atoms/ActionButton/index.tsx +82 -75
- package/src/presentation/components/atoms/ActionButton/styles.ts +95 -192
- package/src/presentation/components/atoms/ProgresBar/Progressbar.stories.tsx +37 -0
- package/src/presentation/components/atoms/ProgresBar/index.tsx +63 -0
- package/src/presentation/components/atoms/ProgresBar/styles.ts +91 -0
- package/src/presentation/components/atoms/{Progressbar → ProgressbarDepreciated}/Progressbar.stories.tsx +2 -1
- package/src/presentation/components/atoms/Tag/index.tsx +33 -26
- package/src/presentation/components/atoms/Tag/styles.ts +1 -0
- package/src/presentation/components/atoms/Tooltip/index.tsx +24 -19
- package/src/presentation/components/molecules/DataTable/Components/ActionButtonCell/index.tsx +2 -2
- /package/dist/src/presentation/components/atoms/{Progressbar → ProgressbarDepreciated}/index.d.ts +0 -0
- /package/dist/src/presentation/components/atoms/{Progressbar → ProgressbarDepreciated}/styles.d.ts +0 -0
- /package/src/presentation/components/atoms/{Progressbar → ProgressbarDepreciated}/index.tsx +0 -0
- /package/src/presentation/components/atoms/{Progressbar → ProgressbarDepreciated}/styles.ts +0 -0
|
@@ -9,18 +9,14 @@ export interface ActionButtonElementProps {
|
|
|
9
9
|
type?: 'button' | 'submit' | 'reset';
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
iconName?: keyof typeof Icons;
|
|
12
|
-
onClick?: () =>
|
|
12
|
+
onClick?: () => void;
|
|
13
13
|
tooltipProps?: TooltipProps;
|
|
14
14
|
buttonType?: 'primary' | 'secondary';
|
|
15
15
|
iconColor?: string;
|
|
16
16
|
selectedIconName?: keyof typeof Icons;
|
|
17
17
|
badgeProps?: BadgeProps;
|
|
18
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
19
18
|
isSelected?: boolean;
|
|
20
|
-
|
|
21
|
-
selectVariantLabel?: string;
|
|
19
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
declare const ActionButton: ({ id, name, size, type, disabled, onClick, iconName, tooltipProps, buttonType, iconColor, selectedIconName, badgeProps, ref, isSelected, selectVariant, selectVariantLabel, }: ActionButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonElementProps & React.RefAttributes<HTMLButtonElement>>;
|
|
26
22
|
export default ActionButton;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
interface ActionButtonStyleProps {
|
|
2
|
+
sizeProp: 'Small' | 'Large';
|
|
3
|
+
buttonType: 'primary' | 'secondary';
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
isSelected: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const ActionButton: import("styled-components").StyledComponent<"button", any, ActionButtonStyleProps, never>;
|
|
2
9
|
export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
5
|
-
|
|
10
|
+
export declare const SelectVariantLabel: import("styled-components").StyledComponent<"span", any, {
|
|
11
|
+
size: 'Small' | 'Large';
|
|
12
|
+
}, never>;
|
|
13
|
+
export declare const Indicator: import("styled-components").StyledComponent<"div", any, {
|
|
14
|
+
indicatorColor?: string;
|
|
15
|
+
}, never>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface ProgressbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
id?: string;
|
|
4
|
+
title: string;
|
|
5
|
+
progress: number;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
width?: string;
|
|
8
|
+
size?: 'large' | 'medium' | 'small';
|
|
9
|
+
}
|
|
10
|
+
declare const Progressbar: ({ id, title, progress, subtitle, width, size, ...rest }: ProgressbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default Progressbar;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const ProgressbarContainer: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
width?: string;
|
|
3
|
+
height?: string;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const ProgressbarHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
6
|
+
export declare const ProgressbarTitle: import("styled-components").StyledComponent<"h3", any, {}, never>;
|
|
7
|
+
export declare const ProgressbarBarContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
+
export declare const ProgressbarBar: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
9
|
+
export declare const ProgressbarBarInner: import("styled-components").StyledComponent<"div", any, {
|
|
10
|
+
progress: number;
|
|
11
|
+
}, never>;
|
|
12
|
+
export declare const ProgressbarPercent: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
13
|
+
export declare const ProgressbarSubtitleSection: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
+
export declare const ProgressbarSubtitle: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { AvatarProps } from '../Avatar/Avatar.types';
|
|
3
|
+
import { TooltipProps } from '../Tooltip';
|
|
3
4
|
interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
5
|
label: string;
|
|
5
6
|
onClose?: (e: any) => void;
|
|
@@ -12,6 +13,7 @@ interface TagProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
13
|
iconName?: string;
|
|
13
14
|
tableTag?: boolean;
|
|
14
15
|
avatarProps?: AvatarProps;
|
|
16
|
+
tooltipProps?: TooltipProps;
|
|
15
17
|
}
|
|
16
|
-
declare const Tag: ({ label, closeButton, onClose, onClick, disabled, readOnly, selected, size, iconName, tableTag, avatarProps, ...rest }: TagProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const Tag: ({ label, closeButton, onClose, onClick, disabled, readOnly, selected, size, iconName, tableTag, avatarProps, tooltipProps, ...rest }: TagProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
export default Tag;
|
package/package.json
CHANGED
|
@@ -62,7 +62,7 @@ export default {
|
|
|
62
62
|
},
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
const Template = () => {
|
|
65
|
+
const Template = (args) => {
|
|
66
66
|
return (
|
|
67
67
|
<div
|
|
68
68
|
style={{
|
|
@@ -73,13 +73,13 @@ const Template = () => {
|
|
|
73
73
|
>
|
|
74
74
|
<ActionButton
|
|
75
75
|
id="actionbutton-1"
|
|
76
|
-
iconName="
|
|
77
|
-
selectedIconName="
|
|
78
|
-
showIndicator={false}
|
|
76
|
+
iconName="AddAnt"
|
|
77
|
+
selectedIconName="AddAnt"
|
|
79
78
|
tooltipProps={{
|
|
80
79
|
label: 'Default',
|
|
81
80
|
position: 'right',
|
|
82
81
|
}}
|
|
82
|
+
{...args}
|
|
83
83
|
/>
|
|
84
84
|
</div>
|
|
85
85
|
);
|
|
@@ -87,7 +87,7 @@ const Template = () => {
|
|
|
87
87
|
|
|
88
88
|
export const Default = Template.bind({});
|
|
89
89
|
|
|
90
|
-
const TemplateSecondary = () => {
|
|
90
|
+
const TemplateSecondary = (args) => {
|
|
91
91
|
return (
|
|
92
92
|
<div
|
|
93
93
|
style={{
|
|
@@ -98,14 +98,14 @@ const TemplateSecondary = () => {
|
|
|
98
98
|
>
|
|
99
99
|
<ActionButton
|
|
100
100
|
id="actionbutton-secondary-1"
|
|
101
|
-
iconName="
|
|
101
|
+
iconName="AddAnt"
|
|
102
|
+
selectedIconName="AddAnt"
|
|
102
103
|
buttonType="secondary"
|
|
103
|
-
selectedIconName="NotificationsActiveFILL1Ant"
|
|
104
|
-
showIndicator={false}
|
|
105
104
|
tooltipProps={{
|
|
106
105
|
label: 'Secondary',
|
|
107
106
|
position: 'right',
|
|
108
107
|
}}
|
|
108
|
+
{...args}
|
|
109
109
|
/>
|
|
110
110
|
</div>
|
|
111
111
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState, forwardRef } from 'react';
|
|
2
2
|
import * as C from './styles';
|
|
3
3
|
import { Icons } from '../../../../main/helpers/functions/icons';
|
|
4
4
|
import Tooltip, { TooltipProps } from '../Tooltip';
|
|
@@ -11,93 +11,100 @@ export interface ActionButtonElementProps {
|
|
|
11
11
|
type?: 'button' | 'submit' | 'reset';
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
iconName?: keyof typeof Icons;
|
|
14
|
-
onClick?: () =>
|
|
14
|
+
onClick?: () => void;
|
|
15
15
|
tooltipProps?: TooltipProps;
|
|
16
16
|
buttonType?: 'primary' | 'secondary';
|
|
17
17
|
iconColor?: string;
|
|
18
18
|
selectedIconName?: keyof typeof Icons;
|
|
19
19
|
badgeProps?: BadgeProps;
|
|
20
|
-
ref?: React.Ref<HTMLButtonElement>;
|
|
21
20
|
isSelected?: boolean;
|
|
22
|
-
|
|
23
|
-
selectVariantLabel?: string;
|
|
21
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
const ActionButton = forwardRef<HTMLButtonElement, ActionButtonElementProps>(
|
|
25
|
+
(
|
|
26
|
+
{
|
|
27
|
+
id,
|
|
28
|
+
name,
|
|
29
|
+
size = 'Small',
|
|
30
|
+
type = 'button',
|
|
31
|
+
disabled = false,
|
|
32
|
+
onClick,
|
|
33
|
+
iconName,
|
|
34
|
+
tooltipProps,
|
|
35
|
+
buttonType = 'primary',
|
|
36
|
+
iconColor,
|
|
37
|
+
selectedIconName,
|
|
38
|
+
badgeProps,
|
|
39
|
+
isSelected: isSelectedProp,
|
|
40
|
+
onSelectedChange,
|
|
41
|
+
},
|
|
42
|
+
ref
|
|
43
|
+
) => {
|
|
44
|
+
const [isSelectedState, setIsSelectedState] = useState(false);
|
|
27
45
|
|
|
28
|
-
const
|
|
29
|
-
id,
|
|
30
|
-
name,
|
|
31
|
-
size = 'Small',
|
|
32
|
-
type,
|
|
33
|
-
disabled,
|
|
34
|
-
onClick,
|
|
35
|
-
iconName,
|
|
36
|
-
tooltipProps,
|
|
37
|
-
buttonType = 'primary',
|
|
38
|
-
iconColor,
|
|
39
|
-
selectedIconName,
|
|
40
|
-
badgeProps,
|
|
41
|
-
ref,
|
|
42
|
-
isSelected = false,
|
|
43
|
-
selectVariant = false,
|
|
44
|
-
selectVariantLabel,
|
|
45
|
-
}: ActionButtonProps) => {
|
|
46
|
-
const IconSelected = Icons[iconName];
|
|
47
|
-
const SelectedIcon = Icons[selectedIconName];
|
|
46
|
+
const isControlled = isSelectedProp !== undefined;
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
if (onClick) onClick();
|
|
51
|
-
};
|
|
48
|
+
const isSelected = isControlled ? isSelectedProp : isSelectedState;
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<C.ActionButton
|
|
56
|
-
ref={ref}
|
|
57
|
-
id={`actionbutton-${id}`}
|
|
58
|
-
name={`actionbutton-${name}`}
|
|
59
|
-
type={type}
|
|
60
|
-
onClick={handleButtonClick}
|
|
61
|
-
size={size}
|
|
62
|
-
disabled={disabled}
|
|
63
|
-
data-testid="action-button"
|
|
64
|
-
buttonType={buttonType}
|
|
65
|
-
iconColor={iconColor}
|
|
66
|
-
isSelected={isSelected}
|
|
67
|
-
selectedIconName={selectedIconName}
|
|
68
|
-
selectVariant={selectVariant}
|
|
69
|
-
>
|
|
70
|
-
{iconName && !isSelected && (
|
|
71
|
-
<C.IconWrapper className="default-icon">
|
|
72
|
-
<IconSelected data-testid="action-icon" />
|
|
73
|
-
</C.IconWrapper>
|
|
74
|
-
)}
|
|
50
|
+
const IconDefault = iconName ? Icons[iconName] : null;
|
|
51
|
+
const IconSelected = selectedIconName ? Icons[selectedIconName] : null;
|
|
75
52
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
className={`active-icon ${isSelected ? 'visible' : ''}`}
|
|
79
|
-
>
|
|
80
|
-
<SelectedIcon data-testid="selected-icon" />
|
|
81
|
-
</C.ActiveIconWrapper>
|
|
82
|
-
)}
|
|
53
|
+
const handleButtonClick = () => {
|
|
54
|
+
if (disabled) return;
|
|
83
55
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
content={badgeProps.content}
|
|
92
|
-
/>
|
|
93
|
-
)}
|
|
56
|
+
if (isControlled) {
|
|
57
|
+
if (onSelectedChange) {
|
|
58
|
+
onSelectedChange(!isSelected);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
setIsSelectedState((prev) => !prev);
|
|
62
|
+
}
|
|
94
63
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
64
|
+
if (onClick) onClick();
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Tooltip {...tooltipProps}>
|
|
69
|
+
<C.ActionButton
|
|
70
|
+
ref={ref}
|
|
71
|
+
id={`actionbutton-${id}`}
|
|
72
|
+
name={`actionbutton-${name}`}
|
|
73
|
+
type={type}
|
|
74
|
+
onClick={handleButtonClick}
|
|
75
|
+
sizeProp={size}
|
|
76
|
+
disabled={disabled}
|
|
77
|
+
data-testid="action-button"
|
|
78
|
+
buttonType={buttonType}
|
|
79
|
+
iconColor={iconColor}
|
|
80
|
+
isSelected={isSelected}
|
|
81
|
+
>
|
|
82
|
+
{IconDefault && !isSelected && (
|
|
83
|
+
<C.IconWrapper className="default-icon">
|
|
84
|
+
<IconDefault data-testid="action-icon" />
|
|
85
|
+
</C.IconWrapper>
|
|
86
|
+
)}
|
|
87
|
+
|
|
88
|
+
{IconSelected && isSelected && (
|
|
89
|
+
<C.IconWrapper className="selected-icon">
|
|
90
|
+
<IconSelected data-testid="selected-icon" />
|
|
91
|
+
</C.IconWrapper>
|
|
92
|
+
)}
|
|
93
|
+
|
|
94
|
+
{badgeProps && (
|
|
95
|
+
<Badge
|
|
96
|
+
size={badgeProps.size}
|
|
97
|
+
color={badgeProps.color}
|
|
98
|
+
hasBorder={badgeProps.hasBorder}
|
|
99
|
+
top={badgeProps.top}
|
|
100
|
+
right={badgeProps.right}
|
|
101
|
+
content={badgeProps.content}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
104
|
+
</C.ActionButton>
|
|
105
|
+
</Tooltip>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
);
|
|
102
109
|
|
|
103
110
|
export default ActionButton;
|