pixel-react 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- package/.yarn/install-state.gz +0 -0
- package/lib/components/AddResourceButton/type.d.ts +1 -1
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.d.ts +2 -1
- package/lib/components/AllProjectsDropdown/AllProjectsDropdown.stories.d.ts +1 -0
- package/lib/components/AllProjectsDropdown/types.d.ts +10 -0
- package/lib/components/Button/Button.stories.d.ts +1 -0
- package/lib/components/Button/types.d.ts +1 -1
- package/lib/components/Drawer/Drawer.stories.d.ts +3 -0
- package/lib/components/Drawer/Types.d.ts +25 -1
- package/lib/components/Icon/Icon.d.ts +1 -1
- package/lib/components/MachineInputField/MachineInputField.d.ts +4 -0
- package/lib/components/MachineInputField/MachineInputField.stories.d.ts +6 -0
- package/lib/components/MachineInputField/index.d.ts +1 -0
- package/lib/components/MachineInputField/types.d.ts +11 -0
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/MenuOption.stories.d.ts +1 -0
- package/lib/components/MenuOption/types.d.ts +7 -0
- package/lib/components/Modal/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.d.ts +6 -0
- package/lib/components/SequentialConnectingBranch/components/AddBrowserModal/AddBrowserModal.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/AddBrowserModal/types.d.ts +3 -0
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/Branches/types.d.ts +16 -0
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/types.d.ts +9 -0
- package/lib/components/SequentialConnectingBranch/components/DatasetListModal/DatasetListModal.d.ts +4 -0
- package/lib/components/SequentialConnectingBranch/components/DatasetListModal/types.d.ts +3 -0
- package/lib/components/SequentialConnectingBranch/index.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/types.d.ts +32 -0
- package/lib/components/TableTree/TableTree.d.ts +4 -2
- package/lib/components/Tabs/types.d.ts +1 -0
- package/lib/index.d.ts +103 -9
- package/lib/index.esm.js +890 -572
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +891 -571
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +5 -1
- package/src/assets/Themes/BaseTheme.scss +18 -2
- package/src/assets/Themes/DarkTheme.scss +11 -3
- package/src/assets/icons/add_locator.svg +5 -0
- package/src/assets/icons/android.svg +9 -0
- package/src/assets/icons/browser_stack.svg +9 -0
- package/src/assets/icons/chrome.svg +12 -0
- package/src/assets/icons/dataset_list.svg +3 -0
- package/src/assets/icons/drag_icon.svg +5 -0
- package/src/assets/icons/label_plus.svg +3 -0
- package/src/assets/icons/mac.svg +9 -0
- package/src/assets/icons/manual_locator.svg +8 -0
- package/src/assets/icons/windows.svg +6 -0
- package/src/assets/styles/_colors.scss +4 -4
- package/src/components/AddResourceButton/type.ts +1 -1
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +2 -2
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +99 -1
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +30 -56
- package/src/components/AllProjectsDropdown/types.ts +10 -0
- package/src/components/Button/Button.scss +4 -0
- package/src/components/Button/Button.stories.tsx +7 -0
- package/src/components/Button/types.ts +2 -2
- package/src/components/Drawer/Drawer.scss +22 -11
- package/src/components/Drawer/Drawer.stories.tsx +41 -0
- package/src/components/Drawer/Drawer.tsx +67 -40
- package/src/components/Drawer/Types.ts +25 -1
- package/src/components/GridLayout/GridLayout.scss +0 -2
- package/src/components/GridLayout/GridLayout.tsx +15 -8
- package/src/components/Icon/Icon.tsx +39 -33
- package/src/components/Icon/iconList.ts +25 -6
- package/src/components/InputWithDropdown/InputWithDropdown.scss +1 -1
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +2 -1
- package/src/components/MachineInputField/MachineInputField.scss +44 -0
- package/src/components/MachineInputField/MachineInputField.stories.tsx +32 -0
- package/src/components/MachineInputField/MachineInputField.tsx +71 -0
- package/src/components/MachineInputField/index.ts +1 -0
- package/src/components/MachineInputField/types.ts +12 -0
- package/src/components/MenuOption/MenuOption.scss +14 -0
- package/src/components/MenuOption/MenuOption.stories.tsx +21 -0
- package/src/components/MenuOption/MenuOption.tsx +5 -3
- package/src/components/MenuOption/types.ts +9 -0
- package/src/components/MiniModal/MiniModal.tsx +1 -1
- package/src/components/Modal/Modal.tsx +2 -0
- package/src/components/Modal/modal.scss +2 -2
- package/src/components/Modal/types.ts +1 -0
- package/src/components/Select/Select.tsx +2 -2
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.scss +117 -0
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.tsx +62 -0
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +210 -0
- package/src/components/SequentialConnectingBranch/components/AddBrowserModal/AddBrowserModal.scss +51 -0
- package/src/components/SequentialConnectingBranch/components/AddBrowserModal/AddBrowserModal.tsx +107 -0
- package/src/components/SequentialConnectingBranch/components/AddBrowserModal/types.ts +5 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.scss +184 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +203 -0
- package/src/components/SequentialConnectingBranch/components/Branches/types.ts +18 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.scss +3 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.tsx +66 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/types.ts +10 -0
- package/src/components/SequentialConnectingBranch/components/DatasetListModal/DatasetListModal.scss +31 -0
- package/src/components/SequentialConnectingBranch/components/DatasetListModal/DatasetListModal.tsx +85 -0
- package/src/components/SequentialConnectingBranch/components/DatasetListModal/types.ts +4 -0
- package/src/components/SequentialConnectingBranch/index.ts +1 -0
- package/src/components/SequentialConnectingBranch/types.ts +42 -0
- package/src/components/TableTree/TableTree.stories.tsx +8 -1
- package/src/components/TableTree/TableTree.tsx +25 -3
- package/src/components/Tabs/Tabs.stories.tsx +24 -25
- package/src/components/Tabs/Tabs.tsx +3 -10
- package/src/components/Tabs/types.ts +7 -1
- package/src/index.ts +5 -6
- package/lib/components/AddButton/AddButton.d.ts +0 -5
- package/lib/components/AddButton/AddButton.stories.d.ts +0 -6
- package/lib/components/AddButton/index.d.ts +0 -1
- package/lib/components/AddButton/types.d.ts +0 -4
- package/lib/utils/find/findAndInsert.d.ts +0 -7
- package/lib/utils/find/findAndInsert.stories.d.ts +0 -7
@@ -1,5 +1,7 @@
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
2
2
|
import AllProjectsDropdown from './AllProjectsDropdown';
|
3
|
+
import { useState } from 'react';
|
4
|
+
import { optionsType } from './types';
|
3
5
|
|
4
6
|
const meta: Meta<typeof AllProjectsDropdown> = {
|
5
7
|
title: 'Components/AllProjectsDropdown',
|
@@ -12,9 +14,105 @@ const meta: Meta<typeof AllProjectsDropdown> = {
|
|
12
14
|
|
13
15
|
type Story = StoryObj<typeof AllProjectsDropdown>;
|
14
16
|
|
17
|
+
export const Default: Story = {
|
18
|
+
args: {
|
19
|
+
options: [
|
20
|
+
{
|
21
|
+
label: 'All Projects',
|
22
|
+
value: 'All Projects',
|
23
|
+
iconName: 'all_projects',
|
24
|
+
},
|
25
|
+
{
|
26
|
+
label: 'Pantaloon Project',
|
27
|
+
value: 'Pantaloon Web Project',
|
28
|
+
iconName: 'web_icon',
|
29
|
+
},
|
30
|
+
{
|
31
|
+
label: 'Mobile Project',
|
32
|
+
value: 'Mobile Project',
|
33
|
+
iconName: 'mobile_icon',
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: 'Web & Mobile Project',
|
37
|
+
value: 'Web & Mobile Project',
|
38
|
+
iconName: 'web&mobile_icon',
|
39
|
+
},
|
40
|
+
{
|
41
|
+
label: 'Sales Force',
|
42
|
+
value: 'Sales Force',
|
43
|
+
iconName: 'sales_force',
|
44
|
+
},
|
45
|
+
{
|
46
|
+
label: 'MS Dynamic',
|
47
|
+
value: 'MS Dynamic',
|
48
|
+
iconName: 'ms_dynamic',
|
49
|
+
},
|
50
|
+
{
|
51
|
+
label: 'Web Service',
|
52
|
+
value: 'Web Service',
|
53
|
+
iconName: '',
|
54
|
+
},
|
55
|
+
],
|
56
|
+
},
|
57
|
+
};
|
58
|
+
|
15
59
|
export const PrimaryIconButton: Story = {
|
16
60
|
render: () => {
|
17
|
-
|
61
|
+
const [selectedOption, setSelectedOption] = useState({
|
62
|
+
label: 'All Projects',
|
63
|
+
value: 'All Projects',
|
64
|
+
iconName: 'all_projects',
|
65
|
+
});
|
66
|
+
|
67
|
+
const handleSelectedOption = (option: optionsType) => {
|
68
|
+
setSelectedOption(option);
|
69
|
+
};
|
70
|
+
|
71
|
+
const options = [
|
72
|
+
{
|
73
|
+
label: 'All Projects',
|
74
|
+
value: 'All Projects',
|
75
|
+
iconName: 'all_projects',
|
76
|
+
},
|
77
|
+
{
|
78
|
+
label: 'Pantaloon Project',
|
79
|
+
value: 'Pantaloon Web Project',
|
80
|
+
iconName: 'web_icon',
|
81
|
+
},
|
82
|
+
{
|
83
|
+
label: 'Mobile Project',
|
84
|
+
value: 'Mobile Project',
|
85
|
+
iconName: 'mobile_icon',
|
86
|
+
},
|
87
|
+
{
|
88
|
+
label: 'Web & Mobile Project',
|
89
|
+
value: 'Web & Mobile Project',
|
90
|
+
iconName: 'web&mobile_icon',
|
91
|
+
},
|
92
|
+
{
|
93
|
+
label: 'Sales Force',
|
94
|
+
value: 'Sales Force',
|
95
|
+
iconName: 'sales_force',
|
96
|
+
},
|
97
|
+
{
|
98
|
+
label: 'MS Dynamic',
|
99
|
+
value: 'MS Dynamic',
|
100
|
+
iconName: 'ms_dynamic',
|
101
|
+
},
|
102
|
+
{
|
103
|
+
label: 'Web Service',
|
104
|
+
value: 'Web Service',
|
105
|
+
iconName: '',
|
106
|
+
},
|
107
|
+
];
|
108
|
+
|
109
|
+
return (
|
110
|
+
<AllProjectsDropdown
|
111
|
+
options={options}
|
112
|
+
onClick={handleSelectedOption}
|
113
|
+
selectedOption={selectedOption}
|
114
|
+
/>
|
115
|
+
);
|
18
116
|
},
|
19
117
|
};
|
20
118
|
|
@@ -1,79 +1,49 @@
|
|
1
1
|
import { useState } from 'react';
|
2
2
|
import Icon from '../Icon';
|
3
3
|
import Typography from '../Typography';
|
4
|
-
import { ffid } from '../../utils/ffID/ffid';
|
5
4
|
import { truncateText } from '../../utils/truncateText/truncateText';
|
6
5
|
import './AllProjectsDropdown.scss';
|
7
6
|
import classNames from 'classnames';
|
7
|
+
import { AllProjectsDropdownProps, optionsType } from './types';
|
8
8
|
|
9
|
-
const AllProjectsDropdown = (
|
10
|
-
|
11
|
-
|
9
|
+
const AllProjectsDropdown = ({
|
10
|
+
onClick = () => {},
|
11
|
+
options,
|
12
|
+
selectedOption = {
|
12
13
|
label: 'All Projects',
|
13
14
|
value: 'All Projects',
|
14
15
|
iconName: 'all_projects',
|
15
|
-
}
|
16
|
+
},
|
17
|
+
}: AllProjectsDropdownProps) => {
|
18
|
+
const [showOptions, setShowOptions] = useState(false);
|
19
|
+
const [selectedOptions, setSelectedOptions] = useState(selectedOption);
|
16
20
|
const [search, setSearch] = useState(true);
|
17
21
|
|
18
|
-
|
19
|
-
{
|
20
|
-
label: 'All Projects',
|
21
|
-
value: 'All Projects',
|
22
|
-
iconName: 'all_projects',
|
23
|
-
},
|
24
|
-
{
|
25
|
-
label: 'Pantaloon Project',
|
26
|
-
value: 'Pantaloon Web Project',
|
27
|
-
iconName: 'web_icon',
|
28
|
-
},
|
29
|
-
{
|
30
|
-
label: 'Mobile Project',
|
31
|
-
value: 'Mobile Project',
|
32
|
-
iconName: 'mobile_icon',
|
33
|
-
},
|
34
|
-
{
|
35
|
-
label: 'Web & Mobile Project',
|
36
|
-
value: 'Web & Mobile Project',
|
37
|
-
iconName: 'web&mobile_icon',
|
38
|
-
},
|
39
|
-
{
|
40
|
-
label: 'Sales Force',
|
41
|
-
value: 'Sales Force',
|
42
|
-
iconName: 'sales_force',
|
43
|
-
},
|
44
|
-
{
|
45
|
-
label: 'MS Dynamic',
|
46
|
-
value: 'MS Dynamic',
|
47
|
-
iconName: 'ms_dynamic',
|
48
|
-
},
|
49
|
-
{
|
50
|
-
label: 'Web Service',
|
51
|
-
value: 'Web Service',
|
52
|
-
iconName: '',
|
53
|
-
},
|
54
|
-
];
|
55
|
-
|
56
|
-
const handleSelect = () => {
|
22
|
+
const handleShowOption = () => {
|
57
23
|
setShowOptions(!showOptions);
|
58
24
|
};
|
59
25
|
|
60
|
-
const handleSelectOption = (option: {
|
61
|
-
label: string;
|
62
|
-
value: string;
|
63
|
-
iconName: string;
|
64
|
-
}) => {
|
26
|
+
const handleSelectOption = (option: optionsType) => {
|
65
27
|
setSelectedOptions(option);
|
66
28
|
setShowOptions(false);
|
29
|
+
() => onClick(option);
|
67
30
|
};
|
68
31
|
|
69
32
|
const handleInput = () => {
|
70
33
|
setSearch(false);
|
71
34
|
};
|
72
35
|
|
36
|
+
const handleSearchEnter = () => {
|
37
|
+
setSearch(false);
|
38
|
+
};
|
39
|
+
const handleSearchLeave = () => {
|
40
|
+
setSearch(true);
|
41
|
+
};
|
42
|
+
|
73
43
|
return (
|
74
44
|
<div className={classNames('ff-all-project')}>
|
75
45
|
<div
|
76
|
-
onClick={
|
46
|
+
onClick={handleShowOption}
|
77
47
|
className={classNames('ff-all-project-dropdown')}
|
78
48
|
>
|
79
49
|
<Typography
|
@@ -83,7 +53,7 @@ const AllProjectsDropdown = () => {
|
|
83
53
|
fontWeight={'regular'}
|
84
54
|
className={classNames('projects-label')}
|
85
55
|
>
|
86
|
-
{truncateText(selectedOptions
|
56
|
+
{truncateText(selectedOptions?.label, 12)}
|
87
57
|
</Typography>
|
88
58
|
<div className={classNames('label-icon')}>
|
89
59
|
<Icon
|
@@ -96,11 +66,15 @@ const AllProjectsDropdown = () => {
|
|
96
66
|
</div>
|
97
67
|
{showOptions && (
|
98
68
|
<div className={classNames('ff-dropdown')}>
|
99
|
-
<div
|
69
|
+
<div
|
70
|
+
className={classNames('ff-search')}
|
71
|
+
onMouseEnter={() => handleSearchEnter()}
|
72
|
+
onMouseLeave={() => handleSearchLeave()}
|
73
|
+
>
|
100
74
|
{search && <Icon name="search" height={8} width={8} />}
|
101
75
|
<input
|
102
76
|
type="text"
|
103
|
-
placeholder=
|
77
|
+
placeholder={`${search ? 'Search Project' : ''}`}
|
104
78
|
onClick={() => handleInput()}
|
105
79
|
/>
|
106
80
|
</div>
|
@@ -110,9 +84,9 @@ const AllProjectsDropdown = () => {
|
|
110
84
|
`${options.length > 4 ? 'scroll' : ''}`
|
111
85
|
)}
|
112
86
|
>
|
113
|
-
{options.map((option) => (
|
87
|
+
{options.map((option, index) => (
|
114
88
|
<div
|
115
|
-
key={
|
89
|
+
key={index}
|
116
90
|
onClick={() => handleSelectOption(option)}
|
117
91
|
className={classNames(
|
118
92
|
'projects-options',
|
@@ -133,7 +107,7 @@ const AllProjectsDropdown = () => {
|
|
133
107
|
}
|
134
108
|
/>
|
135
109
|
</div>
|
136
|
-
<Typography key={
|
110
|
+
<Typography key={index} as={'div'} lineHeight={'30px'}>
|
137
111
|
{option.label}
|
138
112
|
</Typography>
|
139
113
|
</div>
|
@@ -45,6 +45,13 @@ export const Delete: Story = {
|
|
45
45
|
variant: 'delete',
|
46
46
|
},
|
47
47
|
};
|
48
|
+
export const Warning: Story = {
|
49
|
+
args: {
|
50
|
+
...defaultArgs,
|
51
|
+
label: 'Warning',
|
52
|
+
variant: 'warning',
|
53
|
+
},
|
54
|
+
};
|
48
55
|
export const PrimaryWithIcon: Story = {
|
49
56
|
args: {
|
50
57
|
...defaultArgs,
|
@@ -4,7 +4,7 @@ export interface ButtonProps {
|
|
4
4
|
/**
|
5
5
|
* Variant of the button
|
6
6
|
*/
|
7
|
-
variant: 'primary' | 'secondary' | 'tertiary' | 'delete';
|
7
|
+
variant: 'primary' | 'secondary' | 'tertiary' | 'delete'| 'warning';
|
8
8
|
/**
|
9
9
|
* What background color to use
|
10
10
|
*/
|
@@ -61,5 +61,5 @@ export interface ButtonProps {
|
|
61
61
|
* Give icon name availble in storybook that to be on left side of button
|
62
62
|
*/
|
63
63
|
iconPosition?: 'left' | 'right';
|
64
|
-
transparentBackground?:boolean;
|
64
|
+
transparentBackground?: boolean;
|
65
65
|
}
|
@@ -9,10 +9,9 @@
|
|
9
9
|
}
|
10
10
|
|
11
11
|
.ff-drawer {
|
12
|
-
height: 100vh;
|
13
12
|
position: fixed;
|
14
13
|
right: 0;
|
15
|
-
top:
|
14
|
+
top: 80px;
|
16
15
|
bottom: 0;
|
17
16
|
min-width: 450px;
|
18
17
|
background-color: var(--primary-button-text-color);
|
@@ -42,14 +41,14 @@
|
|
42
41
|
&--x-large {
|
43
42
|
transition: all 0.4s ease-in-out;
|
44
43
|
border-radius: 5px;
|
45
|
-
border:
|
44
|
+
border: 1px solid var(--border-color);
|
46
45
|
}
|
47
46
|
|
48
47
|
.ff-drawer-header {
|
49
|
-
padding:
|
48
|
+
padding: 4px 8px 4px 8px;
|
50
49
|
display: flex;
|
51
50
|
gap: 10px;
|
52
|
-
border-bottom:
|
51
|
+
border-bottom: 1px solid var(--border-color);
|
53
52
|
|
54
53
|
.ff-drawer-title {
|
55
54
|
@extend .fontSm;
|
@@ -59,6 +58,15 @@
|
|
59
58
|
align-items: center;
|
60
59
|
gap: 12px;
|
61
60
|
}
|
61
|
+
.ff-close-icon {
|
62
|
+
height: 16px;
|
63
|
+
width: 16px;
|
64
|
+
background-color: var(--button-bg-color);
|
65
|
+
border-radius: 4px;
|
66
|
+
display: flex;
|
67
|
+
align-items: center;
|
68
|
+
justify-content: center;
|
69
|
+
}
|
62
70
|
|
63
71
|
.ff-drawer-action-section {
|
64
72
|
width: 100%;
|
@@ -66,14 +74,17 @@
|
|
66
74
|
align-items: center;
|
67
75
|
justify-content: space-between;
|
68
76
|
gap: 12px;
|
77
|
+
height: 24px;
|
69
78
|
|
70
79
|
.ff-action-button {
|
71
80
|
display: flex;
|
72
81
|
align-items: center;
|
73
|
-
gap:
|
82
|
+
gap: 5px;
|
74
83
|
|
75
84
|
.ff-expand-collapse-button {
|
76
85
|
cursor: pointer;
|
86
|
+
height: 24px;
|
87
|
+
width: 24px;
|
77
88
|
background-color: var(--button-bg-color);
|
78
89
|
outline: none;
|
79
90
|
border: none;
|
@@ -82,8 +93,7 @@
|
|
82
93
|
display: flex;
|
83
94
|
align-items: center;
|
84
95
|
justify-content: center;
|
85
|
-
border-radius:
|
86
|
-
padding: 6px;
|
96
|
+
border-radius: 8px;
|
87
97
|
}
|
88
98
|
}
|
89
99
|
}
|
@@ -100,19 +110,20 @@
|
|
100
110
|
}
|
101
111
|
|
102
112
|
.ff-drawer-footer {
|
113
|
+
height: 24px;
|
103
114
|
position: absolute;
|
104
115
|
bottom: 0;
|
105
116
|
left: 0;
|
106
117
|
right: 0;
|
107
|
-
padding:
|
118
|
+
padding: 4px 8px 4px 8px;
|
108
119
|
display: flex;
|
109
120
|
justify-content: space-between;
|
110
|
-
border-top:
|
121
|
+
border-top: 1px solid var(--drawer-footer-border);
|
111
122
|
|
112
123
|
.button-container {
|
113
124
|
display: flex;
|
114
125
|
justify-content: flex-end;
|
115
|
-
gap:
|
126
|
+
gap: 10px;
|
116
127
|
}
|
117
128
|
}
|
118
129
|
}
|
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import Drawer from './Drawer';
|
3
3
|
import { useState } from 'react';
|
4
4
|
import Button from '../Button';
|
5
|
+
import Icon from '../Icon';
|
5
6
|
|
6
7
|
const meta: Meta<typeof Drawer> = {
|
7
8
|
title: 'Components/Drawer',
|
@@ -20,6 +21,7 @@ const defaultArgs = {
|
|
20
21
|
title: 'Drawer Title',
|
21
22
|
showEditButton: false,
|
22
23
|
_isExpanded: false,
|
24
|
+
showHeader: true,
|
23
25
|
onClose: () => {},
|
24
26
|
primaryButtonProps: {
|
25
27
|
label: 'Create',
|
@@ -49,12 +51,51 @@ const defaultArgs = {
|
|
49
51
|
overlay: false,
|
50
52
|
isFooterRequired: true,
|
51
53
|
footerContent: null,
|
54
|
+
backButtonIcon: <Icon name="error" height={16} width={16} />,
|
55
|
+
onCloseIconClick: () => alert('Close icon clicked!'),
|
52
56
|
};
|
53
57
|
|
54
58
|
export const Default: Story = {
|
55
59
|
args: {
|
56
60
|
...defaultArgs,
|
57
61
|
size: 'medium',
|
62
|
+
showHeader: true,
|
63
|
+
},
|
64
|
+
};
|
65
|
+
export const WithoutHeader: Story = {
|
66
|
+
args: {
|
67
|
+
...defaultArgs,
|
68
|
+
showHeader: false,
|
69
|
+
size: 'medium',
|
70
|
+
},
|
71
|
+
parameters: {
|
72
|
+
docs: { disable: true },
|
73
|
+
},
|
74
|
+
};
|
75
|
+
export const WithCustomHeader: Story = {
|
76
|
+
args: {
|
77
|
+
...defaultArgs,
|
78
|
+
customHeader: (
|
79
|
+
<div>
|
80
|
+
<h3>My Custom Header</h3>
|
81
|
+
</div>
|
82
|
+
),
|
83
|
+
},
|
84
|
+
parameters: {
|
85
|
+
docs: { disable: true },
|
86
|
+
},
|
87
|
+
};
|
88
|
+
export const WithCustomFooter: Story = {
|
89
|
+
args: {
|
90
|
+
...defaultArgs,
|
91
|
+
customFooter: (
|
92
|
+
<div>
|
93
|
+
<h3>My Custom Footer</h3>
|
94
|
+
</div>
|
95
|
+
),
|
96
|
+
},
|
97
|
+
parameters: {
|
98
|
+
docs: { disable: true },
|
58
99
|
},
|
59
100
|
};
|
60
101
|
|
@@ -25,6 +25,11 @@ const Drawer: FC<DrawerProps> = ({
|
|
25
25
|
_isExpanded = false,
|
26
26
|
isBackButtonVisible = false,
|
27
27
|
_isCloseModalButtonVisible = true,
|
28
|
+
showHeader = true,
|
29
|
+
backButtonIcon,
|
30
|
+
onCloseIconClick,
|
31
|
+
customHeader,
|
32
|
+
customFooter,
|
28
33
|
}: DrawerProps) => {
|
29
34
|
const [isExpanded, setIsExpanded] = useState(_isExpanded);
|
30
35
|
|
@@ -68,45 +73,69 @@ const Drawer: FC<DrawerProps> = ({
|
|
68
73
|
'ff-drawer--open': isOpen,
|
69
74
|
})}
|
70
75
|
>
|
71
|
-
|
72
|
-
<div className="ff-drawer-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
76
|
+
{showHeader && (
|
77
|
+
<div className="ff-drawer-header">
|
78
|
+
{customHeader ? (
|
79
|
+
customHeader
|
80
|
+
) : (
|
81
|
+
<div className="ff-drawer-action-section">
|
82
|
+
<div className="ff-action-button">
|
83
|
+
{showEditButton && (
|
84
|
+
<button
|
85
|
+
className="ff-expand-collapse-button"
|
86
|
+
onClick={onEdit}
|
87
|
+
>
|
88
|
+
<Icon name="logo" height={16} width={16} />
|
89
|
+
Edit
|
90
|
+
</button>
|
91
|
+
)}
|
92
|
+
{_isExpanded && (
|
93
|
+
<button
|
94
|
+
className="ff-expand-collapse-button"
|
95
|
+
onClick={toggleExpand}
|
96
|
+
>
|
97
|
+
<Icon
|
98
|
+
name={isExpanded ? 'logo' : 'logo'}
|
99
|
+
height={16}
|
100
|
+
width={16}
|
101
|
+
/>
|
102
|
+
</button>
|
103
|
+
)}
|
104
|
+
{isBackButtonVisible && (
|
105
|
+
<button
|
106
|
+
className="ff-expand-collapse-button"
|
107
|
+
onClick={onClose}
|
108
|
+
>
|
109
|
+
{backButtonIcon ? (
|
110
|
+
backButtonIcon
|
111
|
+
) : (
|
112
|
+
<Icon
|
113
|
+
name="error"
|
114
|
+
height={16}
|
115
|
+
width={16}
|
116
|
+
hoverEffect={false}
|
117
|
+
/>
|
118
|
+
)}
|
119
|
+
</button>
|
120
|
+
)}
|
121
|
+
{title && <div className="ff-drawer-title">{title}</div>}
|
122
|
+
</div>
|
123
|
+
{_isCloseModalButtonVisible && (
|
124
|
+
<div className="ff-close-icon">
|
125
|
+
<Icon
|
126
|
+
name="close"
|
127
|
+
hoverEffect={false}
|
128
|
+
onClick={onCloseIconClick || onClose}
|
129
|
+
height={6}
|
130
|
+
width={6}
|
131
|
+
color="var(--tabs-label-active-color)"
|
132
|
+
/>
|
133
|
+
</div>
|
134
|
+
)}
|
135
|
+
</div>
|
107
136
|
)}
|
108
137
|
</div>
|
109
|
-
|
138
|
+
)}
|
110
139
|
|
111
140
|
<div
|
112
141
|
className={classNames('ff-drawer-body', {
|
@@ -118,9 +147,7 @@ const Drawer: FC<DrawerProps> = ({
|
|
118
147
|
|
119
148
|
{isFooterRequired && (
|
120
149
|
<div className="ff-drawer-footer">
|
121
|
-
{footerContent
|
122
|
-
footerContent
|
123
|
-
) : (
|
150
|
+
{customFooter || footerContent || (
|
124
151
|
<>
|
125
152
|
<div className="button-container">
|
126
153
|
{leftSecondaryButtonProps.label && (
|
@@ -48,7 +48,7 @@ export interface DrawerProps {
|
|
48
48
|
/**
|
49
49
|
* Header title for the drawer
|
50
50
|
*/
|
51
|
-
title
|
51
|
+
title?: string | ReactNode;
|
52
52
|
/**
|
53
53
|
* To show the edit button on the header
|
54
54
|
*/
|
@@ -85,4 +85,28 @@ export interface DrawerProps {
|
|
85
85
|
* footer Content
|
86
86
|
*/
|
87
87
|
footerContent?: ReactNode;
|
88
|
+
/**
|
89
|
+
* To show or hide the header
|
90
|
+
*/
|
91
|
+
showHeader?: boolean;
|
92
|
+
/**
|
93
|
+
* Custom back button icon
|
94
|
+
* The icon to display for the back button.
|
95
|
+
* If not provided, a default icon will be used.
|
96
|
+
*/
|
97
|
+
backButtonIcon?: ReactNode;
|
98
|
+
/**
|
99
|
+
* Callback function when the close icon is clicked
|
100
|
+
*/
|
101
|
+
onCloseIconClick?: () => void;
|
102
|
+
/**
|
103
|
+
* Custom header for the drawer, replacing the default header.
|
104
|
+
* If provided, this will render in place of the default header.
|
105
|
+
*/
|
106
|
+
customHeader?: ReactNode;
|
107
|
+
/**
|
108
|
+
* Custom footer for the drawer, replacing the default footer.
|
109
|
+
* If provided, this will render in place of the default footer.
|
110
|
+
*/
|
111
|
+
customFooter?: ReactNode;
|
88
112
|
}
|