pixel-react-excel-sheet 1.0.38 → 1.0.40
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/lib/components/Button/Button.d.ts +2 -2
- package/lib/components/Charts/DashboardDonutChart/types.d.ts +3 -0
- package/lib/components/Charts/LineChart/types.d.ts +1 -0
- package/lib/components/ChooseFile/ChooseFile.d.ts +3 -2
- package/lib/components/Comment/Comments.d.ts +1 -1
- package/lib/components/Comment/type.d.ts +3 -3
- package/lib/components/ConditionalDropdown/types.d.ts +4 -0
- package/lib/components/DatePicker/types.d.ts +2 -0
- package/lib/components/Drawer/Types.d.ts +3 -0
- package/lib/components/Excel/ExcelFile/ExcelFile.d.ts +11 -10
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.d.ts +10 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/DataViewer.d.ts +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.d.ts +9 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/types.d.ts +0 -3
- package/lib/components/Excel/Types.d.ts +15 -11
- package/lib/components/FF_Captcha/Recaptcha.d.ts +2 -1
- package/lib/components/FF_Captcha/types.d.ts +11 -2
- package/lib/components/Input/types.d.ts +4 -0
- package/lib/components/LabelEditTextField/types.d.ts +2 -0
- package/lib/components/MobileSkin/MobileSkin.d.ts +5 -0
- package/lib/components/MobileSkin/MobileSkinInterface.d.ts +13 -0
- package/lib/components/MobileSkin/index.d.ts +1 -0
- package/lib/components/MobileSkin/types.d.ts +32 -0
- package/lib/components/Search/Search.d.ts +1 -1
- package/lib/components/Search/types.d.ts +1 -0
- package/lib/components/Select/components/types.d.ts +3 -2
- package/lib/components/Select/types.d.ts +10 -2
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/Branches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/types.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +4 -4
- package/lib/components/Tabs/types.d.ts +1 -0
- package/lib/index.d.ts +96 -40
- package/lib/index.esm.js +4816 -1669
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +4829 -1669
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/formData/ConvertFormDataToObject.d.ts +1 -0
- package/lib/utils/keyBoardActionUtil/UseKeyboardActions.d.ts +2 -0
- package/lib/utils/keyBoardActionUtil/types.d.ts +4 -0
- package/lib/validations/regex.d.ts +11 -1
- package/package.json +6 -1
- package/src/assets/Themes/BaseTheme.scss +3 -1
- package/src/assets/Themes/DarkTheme.scss +10 -1
- package/src/assets/icons/clear_cache.svg +5 -0
- package/src/assets/icons/external_user.svg +13 -0
- package/src/assets/icons/group_user.svg +12 -0
- package/src/assets/icons/single_user.svg +12 -0
- package/src/assets/icons/test_freshers_logo.svg +8 -0
- package/src/assets/icons/unfollow_icon.svg +3 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.scss +7 -45
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.stories.tsx +5 -0
- package/src/components/AllProjectsDropdown/AllProjectsDropdown.tsx +76 -64
- package/src/components/Button/Button.scss +0 -1
- package/src/components/Button/Button.tsx +3 -4
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.tsx +38 -6
- package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +10 -4
- package/src/components/Charts/DashboardDonutChart/types.ts +4 -1
- package/src/components/Charts/LineChart/LineChart.stories.tsx +27 -88
- package/src/components/Charts/LineChart/LineChart.tsx +138 -42
- package/src/components/Charts/LineChart/types.ts +1 -0
- package/src/components/Charts/MultiRadialChart/MultiRadialChart.scss +3 -3
- package/src/components/Charts/MultiRadialChart/MultiRadialChart.tsx +47 -43
- package/src/components/ChooseFile/ChooseFile.tsx +3 -4
- package/src/components/Comment/Comments.scss +0 -1
- package/src/components/Comment/Comments.stories.tsx +22 -4
- package/src/components/Comment/Comments.tsx +20 -1
- package/src/components/Comment/type.ts +3 -3
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +1 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +2 -1
- package/src/components/ConditionalDropdown/types.ts +4 -0
- package/src/components/DatePicker/DatePicker.scss +307 -2
- package/src/components/DatePicker/DatePicker.tsx +27 -19
- package/src/components/DatePicker/types.ts +4 -0
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/Drawer/Types.ts +4 -2
- package/src/components/Editor/Editor.scss +23 -18
- package/src/components/Editor/Editor.tsx +2 -2
- package/src/components/Excel/ExcelContextMenu/ExcelContextMenu.tsx +6 -3
- package/src/components/Excel/ExcelFile/ExcelFile.scss +45 -41
- package/src/components/Excel/ExcelFile/ExcelFile.tsx +70 -64
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ActiveCell.tsx +29 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Cell.tsx +1 -37
- package/src/components/Excel/ExcelFile/ExcelFileComponents/DataViewer.tsx +1 -40
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +3 -3
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +14 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducer.ts +3 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/reducerFunctions.ts +8 -74
- package/src/components/Excel/ExcelFile/ExcelFileComponents/types.ts +0 -5
- package/src/components/Excel/ExcelFile.stories.tsx +116 -125
- package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +10 -11
- package/src/components/Excel/Types.ts +18 -16
- package/src/components/FF_Captcha/Recaptcha.tsx +19 -9
- package/src/components/FF_Captcha/types.ts +12 -4
- package/src/components/Icon/Icon.stories.tsx +56 -8
- package/src/components/Icon/iconList.ts +13 -1
- package/src/components/Input/Input.stories.tsx +12 -0
- package/src/components/Input/Input.tsx +3 -1
- package/src/components/Input/types.ts +4 -0
- package/src/components/InputWithDropdown/types.ts +1 -1
- package/src/components/LabelEditTextField/LabelEditTextField.scss +4 -0
- package/src/components/LabelEditTextField/LabelEditTextField.stories.tsx +2 -1
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +14 -10
- package/src/components/LabelEditTextField/types.ts +2 -0
- package/src/components/LazyLoad/LazyLoad.stories.tsx +1 -0
- package/src/components/LazyLoad/LazyLoading.tsx +10 -1
- package/src/components/MachineInputField/MachineInputField.scss +5 -1
- package/src/components/MachineInputField/MachineInputField.tsx +1 -0
- package/src/components/MobileSkin/MobileSkin.scss +67 -0
- package/src/components/MobileSkin/MobileSkin.stories.tsx +93 -0
- package/src/components/MobileSkin/MobileSkin.tsx +89 -0
- package/src/components/MobileSkin/MobileSkinInterface.ts +13 -0
- package/src/components/MobileSkin/index.ts +1 -0
- package/src/components/MobileSkin/types.ts +32 -0
- package/src/components/Modal/Modal.stories.tsx +7 -0
- package/src/components/Modal/Modal.tsx +17 -20
- package/src/components/Search/Search.scss +8 -0
- package/src/components/Search/Search.tsx +17 -6
- package/src/components/Search/types.ts +1 -0
- package/src/components/Select/Select.stories.tsx +85 -0
- package/src/components/Select/Select.tsx +10 -2
- package/src/components/Select/components/Dropdown.tsx +23 -15
- package/src/components/Select/components/types.ts +3 -2
- package/src/components/Select/types.ts +12 -2
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +65 -57
- package/src/components/SequentialConnectingBranch/components/Branches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/types.ts +5 -1
- package/src/components/TableTree/Components/TableCell.tsx +3 -3
- package/src/components/TableTree/TableTree.scss +0 -7
- package/src/components/TableTree/TableTree.tsx +3 -22
- package/src/components/TableTree/types.ts +4 -4
- package/src/components/Tabs/Tabs.scss +19 -0
- package/src/components/Tabs/Tabs.tsx +9 -0
- package/src/components/Tabs/types.ts +1 -0
- package/src/index.ts +27 -0
- package/src/utils/formData/ConvertFormDataToObject.stories.tsx +27 -0
- package/src/utils/formData/ConvertFormDataToObject.ts +14 -0
- package/src/utils/getExtension/getExtension.stories.tsx +1 -0
- package/src/utils/keyBoardActionUtil/UseKeyboardAction.stories.tsx +53 -0
- package/src/utils/keyBoardActionUtil/UseKeyboardActions.tsx +20 -0
- package/src/utils/keyBoardActionUtil/types.ts +4 -0
- package/src/validations/regex.stories.tsx +63 -0
- package/src/validations/regex.ts +34 -0
- package/src/assets/images/photo.png +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './MobileSkin.scss';
|
|
3
|
+
import Icon from '../Icon';
|
|
4
|
+
import Tooltip from '../Tooltip';
|
|
5
|
+
import { MobileSkinProps } from './MobileSkinInterface';
|
|
6
|
+
|
|
7
|
+
const MobileSkin: React.FC<MobileSkinProps> = ({
|
|
8
|
+
children,
|
|
9
|
+
orientation = '',
|
|
10
|
+
type = '',
|
|
11
|
+
navBarIcons,
|
|
12
|
+
mobileHeight = 448,
|
|
13
|
+
mobileWidth = 220,
|
|
14
|
+
}) => {
|
|
15
|
+
const notchHeight = (mobileHeight / 448) * 20;
|
|
16
|
+
const notchWidth = (mobileWidth / 220) * 60;
|
|
17
|
+
|
|
18
|
+
const isPortrait = orientation === 'portrait';
|
|
19
|
+
const isIos = type === 'ios';
|
|
20
|
+
const containerHeight = isPortrait ? mobileHeight : mobileWidth;
|
|
21
|
+
const containerWidth = isPortrait ? mobileWidth : mobileHeight;
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
className={`ff-mobileskin-wrapper ${
|
|
26
|
+
isPortrait ? 'portrait' : 'landscape'
|
|
27
|
+
}`}
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
className="ff-mobileskin-container"
|
|
31
|
+
style={{
|
|
32
|
+
height: containerHeight + 16,
|
|
33
|
+
width: containerWidth + 16,
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<div
|
|
37
|
+
className="ff-mobile-container"
|
|
38
|
+
style={{
|
|
39
|
+
width: containerWidth,
|
|
40
|
+
height: containerHeight,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<div className="ff-mobile-image-container">
|
|
44
|
+
{React.isValidElement(children) ? (
|
|
45
|
+
children
|
|
46
|
+
) : (
|
|
47
|
+
<img
|
|
48
|
+
src={children as string}
|
|
49
|
+
alt="Mobile content"
|
|
50
|
+
style={{
|
|
51
|
+
width: isPortrait ? '100%' : `${mobileWidth * 2.1}px`,
|
|
52
|
+
height: isPortrait ? '100%' : `${mobileHeight * 0.5}px`,
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
)}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
className={`ff-notch ${!isIos ? 'android-notch' : ''}`}
|
|
61
|
+
style={{
|
|
62
|
+
height: !isIos ? 15 : isPortrait ? notchHeight : notchWidth,
|
|
63
|
+
width: !isIos ? 15 : isPortrait ? notchWidth : notchHeight,
|
|
64
|
+
transform: isPortrait
|
|
65
|
+
? `translate(${mobileWidth * 0.01}px, ${mobileHeight * -0.43}px)`
|
|
66
|
+
: `translate(${containerWidth * -0.46}px, ${
|
|
67
|
+
containerHeight * -0.01
|
|
68
|
+
}px)`,
|
|
69
|
+
}}
|
|
70
|
+
></div>
|
|
71
|
+
</div>
|
|
72
|
+
<div className="ff-nav-bar">
|
|
73
|
+
{navBarIcons.map((icon, index) => (
|
|
74
|
+
<div
|
|
75
|
+
key={index}
|
|
76
|
+
className={`ff-nav-bar-icon ${icon?.className || ''} ${
|
|
77
|
+
index === navBarIcons.length - 1 ? 'last-icon' : ''
|
|
78
|
+
}`}
|
|
79
|
+
onClick={icon.onClick}
|
|
80
|
+
>
|
|
81
|
+
<Tooltip title={icon?.title} children={<Icon {...icon} />} />
|
|
82
|
+
</div>
|
|
83
|
+
))}
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default MobileSkin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface NavBarIcon {
|
|
2
|
+
name: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface MobileSkinProps {
|
|
7
|
+
children: React.ReactNode | string;
|
|
8
|
+
orientation?: 'portrait' | 'landscape';
|
|
9
|
+
type: 'ios' | 'android';
|
|
10
|
+
navBarIcons: NavBarIcon[];
|
|
11
|
+
mobileHeight?: number;
|
|
12
|
+
mobileWidth?: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MobileSkin';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface iconDetails {
|
|
2
|
+
/**
|
|
3
|
+
* details of each icon
|
|
4
|
+
*/
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export interface MobileSkinProps {
|
|
8
|
+
/**
|
|
9
|
+
* The content inside the mobile skin component
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode | string;
|
|
12
|
+
/**
|
|
13
|
+
* Portrait or landScape View of the Mobile
|
|
14
|
+
*/
|
|
15
|
+
orientation: "portrait" | "landscape";
|
|
16
|
+
/**
|
|
17
|
+
* type either it will be ios or android
|
|
18
|
+
*/
|
|
19
|
+
type: string;
|
|
20
|
+
/**
|
|
21
|
+
* height of the MobileSkin
|
|
22
|
+
*/
|
|
23
|
+
mobileHeight?: number;
|
|
24
|
+
/**
|
|
25
|
+
* width of the MobileSkin
|
|
26
|
+
*/
|
|
27
|
+
mobileWidth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* takes the icons details like icon name , title, onClick event, height , width, etc
|
|
30
|
+
*/
|
|
31
|
+
navbarIcons: Array<iconDetails>;
|
|
32
|
+
}
|
|
@@ -3,6 +3,7 @@ import React, { useState } from 'react';
|
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
import Modal from './Modal';
|
|
5
5
|
import Button from '../Button';
|
|
6
|
+
import { useKeyboardActions } from '../../utils/keyBoardActionUtil/UseKeyboardActions';
|
|
6
7
|
|
|
7
8
|
const meta: Meta<typeof Modal> = {
|
|
8
9
|
title: 'Components/Modal',
|
|
@@ -34,6 +35,12 @@ export const DefaultModalStory: Story = {
|
|
|
34
35
|
export const Controlled: Story = {
|
|
35
36
|
render: () => {
|
|
36
37
|
const [openModal, setModal] = useState(false);
|
|
38
|
+
useKeyboardActions([
|
|
39
|
+
{
|
|
40
|
+
key: 'Enter',
|
|
41
|
+
action: () => alert('Enter key was pressed.'),
|
|
42
|
+
},
|
|
43
|
+
]);
|
|
37
44
|
return (
|
|
38
45
|
<>
|
|
39
46
|
<Button
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React, { useContext
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import './modal.scss';
|
|
4
4
|
import { ModalProps } from './types';
|
|
5
5
|
import { ThemeContext } from '../ThemeProvider/ThemeProvider';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { useKeyboardActions } from '../../utils/keyBoardActionUtil/UseKeyboardActions';
|
|
7
8
|
|
|
8
9
|
const Modal: React.FC<ModalProps> = ({
|
|
9
10
|
isOpen,
|
|
@@ -26,27 +27,23 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
26
27
|
border = '',
|
|
27
28
|
background='',
|
|
28
29
|
}) => {
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
31
|
-
if (e.key === 'Escape' && shouldCloseOnEsc) {
|
|
32
|
-
onClose();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
}, [isOpen, onClose, ariaHideApp, shouldCloseOnEsc]);
|
|
31
|
+
useKeyboardActions(
|
|
32
|
+
shouldCloseOnEsc && isOpen
|
|
33
|
+
? [
|
|
34
|
+
{
|
|
35
|
+
key: 'Escape',
|
|
36
|
+
action: onClose,
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
: []
|
|
40
|
+
);
|
|
49
41
|
|
|
42
|
+
if (!isOpen) return null;
|
|
43
|
+
|
|
44
|
+
if (ariaHideApp) {
|
|
45
|
+
document.body.style.overflow = isOpen ? 'hidden' : '';
|
|
46
|
+
}
|
|
50
47
|
if (!isOpen) return null;
|
|
51
48
|
const themeContext = useContext(ThemeContext);
|
|
52
49
|
const currentTheme = themeContext?.currentTheme;
|
|
@@ -86,12 +86,20 @@
|
|
|
86
86
|
cursor: pointer;
|
|
87
87
|
width: 22px;
|
|
88
88
|
padding-top: 1px;
|
|
89
|
+
|
|
90
|
+
&.showClose {
|
|
91
|
+
display: none
|
|
92
|
+
}
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
.ff-search-close-icon {
|
|
92
96
|
margin: 4px;
|
|
93
97
|
cursor: pointer;
|
|
94
98
|
|
|
99
|
+
&.showClose {
|
|
100
|
+
display: none
|
|
101
|
+
}
|
|
102
|
+
|
|
95
103
|
.ff-icon-container {
|
|
96
104
|
svg {
|
|
97
105
|
path {
|
|
@@ -16,12 +16,13 @@ const Search = ({
|
|
|
16
16
|
isExpand = false,
|
|
17
17
|
onClose,
|
|
18
18
|
onExpand,
|
|
19
|
+
showClose = true,
|
|
19
20
|
}: SearchProps) => {
|
|
20
21
|
const [searchValue, setSearchValue] = useState<string>(value);
|
|
21
22
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
22
23
|
|
|
23
24
|
useEffect(() => {
|
|
24
|
-
if (isExpand && inputRef.current) {
|
|
25
|
+
if (isExpand && inputRef.current && showClose) {
|
|
25
26
|
inputRef.current.focus();
|
|
26
27
|
}
|
|
27
28
|
setSearchValue('');
|
|
@@ -45,7 +46,7 @@ const Search = ({
|
|
|
45
46
|
if (label === 'Close') {
|
|
46
47
|
onClose?.();
|
|
47
48
|
}
|
|
48
|
-
if (label === 'Clear' && isExpand && inputRef.current) {
|
|
49
|
+
if (label === 'Clear' && isExpand && inputRef.current && showClose) {
|
|
49
50
|
inputRef.current.focus();
|
|
50
51
|
}
|
|
51
52
|
};
|
|
@@ -57,8 +58,12 @@ const Search = ({
|
|
|
57
58
|
};
|
|
58
59
|
const handleChange = (data: string) => {
|
|
59
60
|
setSearchValue(data);
|
|
60
|
-
if (
|
|
61
|
-
|
|
61
|
+
if (showClose) {
|
|
62
|
+
if (data === '') {
|
|
63
|
+
onSearch('');
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
onSearch(data);
|
|
62
67
|
}
|
|
63
68
|
};
|
|
64
69
|
|
|
@@ -105,7 +110,9 @@ const Search = ({
|
|
|
105
110
|
{isExpand && (
|
|
106
111
|
<>
|
|
107
112
|
<div
|
|
108
|
-
className=
|
|
113
|
+
className={classNames('ff-search-clear-button', {
|
|
114
|
+
showClose: !showClose,
|
|
115
|
+
})}
|
|
109
116
|
onClick={() => handleSearchClearAndClose('Clear')}
|
|
110
117
|
>
|
|
111
118
|
{searchValue !== '' && (
|
|
@@ -117,7 +124,11 @@ const Search = ({
|
|
|
117
124
|
)}
|
|
118
125
|
</div>
|
|
119
126
|
<Tooltip title="Close">
|
|
120
|
-
<div
|
|
127
|
+
<div
|
|
128
|
+
className={classNames('ff-search-close-icon', {
|
|
129
|
+
showClose: !showClose,
|
|
130
|
+
})}
|
|
131
|
+
>
|
|
121
132
|
<Icon
|
|
122
133
|
height={6}
|
|
123
134
|
width={6}
|
|
@@ -352,4 +352,89 @@ export const IconOptionSelection: Story = {
|
|
|
352
352
|
},
|
|
353
353
|
};
|
|
354
354
|
|
|
355
|
+
export const SelectWithPlaceHolder: Story = {
|
|
356
|
+
render: () => {
|
|
357
|
+
const optionsList = [
|
|
358
|
+
{
|
|
359
|
+
label: 'fire-flink-LIC4900-onPrem',
|
|
360
|
+
value: 'fire-flink-LIC4900-onPrem',
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
label: 'fire-flink-LIC3179',
|
|
364
|
+
value: 'fire-flink-LIC3179',
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
label: 'fire-flink-LIC4937',
|
|
368
|
+
value: 'fire-flink-LIC4937',
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
label: 'fire-flink-LIC4999',
|
|
372
|
+
value: 'fire-flink-LIC4999',
|
|
373
|
+
},
|
|
374
|
+
];
|
|
375
|
+
|
|
376
|
+
const [selectedOption, setSelectedOption] = useState<Option>({
|
|
377
|
+
label: '',
|
|
378
|
+
value: '',
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
const handleChange = (option: Option) => {
|
|
382
|
+
setSelectedOption(option);
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
return (
|
|
386
|
+
<Select
|
|
387
|
+
optionsList={optionsList}
|
|
388
|
+
selectedOption={selectedOption}
|
|
389
|
+
onChange={handleChange}
|
|
390
|
+
placeHolder="Search"
|
|
391
|
+
showLabel={false}
|
|
392
|
+
label="test"
|
|
393
|
+
/>
|
|
394
|
+
);
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
export const SelectWithToolTip: Story = {
|
|
399
|
+
render: () => {
|
|
400
|
+
const optionsList = [
|
|
401
|
+
{
|
|
402
|
+
label: 'fire-flink-LIC4900-onPrem',
|
|
403
|
+
value: 'fire-flink-LIC4900-onPrem',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
label: 'fire-flink-LIC3179',
|
|
407
|
+
value: 'fire-flink-LIC3179',
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
label: 'fire-flink-LIC4937',
|
|
411
|
+
value: 'fire-flink-LIC4937',
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
label: 'fire-flink-LIC4999',
|
|
415
|
+
value: 'fire-flink-LIC4999',
|
|
416
|
+
},
|
|
417
|
+
];
|
|
418
|
+
|
|
419
|
+
const [selectedOption, setSelectedOption] = useState<Option>({
|
|
420
|
+
label: '',
|
|
421
|
+
value: '',
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
const handleChange = (option: Option) => {
|
|
425
|
+
setSelectedOption(option);
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
return (
|
|
429
|
+
<Select
|
|
430
|
+
optionsList={optionsList}
|
|
431
|
+
selectedOption={selectedOption}
|
|
432
|
+
onChange={handleChange}
|
|
433
|
+
label="Select Option"
|
|
434
|
+
showToolTip={true}
|
|
435
|
+
/>
|
|
436
|
+
);
|
|
437
|
+
},
|
|
438
|
+
};
|
|
439
|
+
|
|
355
440
|
export default meta;
|
|
@@ -2,7 +2,7 @@ import { ChangeEvent, FC, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import './Select.scss';
|
|
3
3
|
import Icon from '../Icon';
|
|
4
4
|
import Typography from '../Typography';
|
|
5
|
-
import {
|
|
5
|
+
import { DropdownPosition, Option, SelectProps } from './types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import Dropdown from './components/Dropdown';
|
|
@@ -31,6 +31,8 @@ const Select: FC<SelectProps> = ({
|
|
|
31
31
|
onBlur = () => {},
|
|
32
32
|
disableInput = false,
|
|
33
33
|
showIcon = false,
|
|
34
|
+
placeHolder = '',
|
|
35
|
+
showToolTip = false,
|
|
34
36
|
}) => {
|
|
35
37
|
const selectWidth = typeof width === 'number' ? `${width}px` : width;
|
|
36
38
|
|
|
@@ -41,7 +43,7 @@ const Select: FC<SelectProps> = ({
|
|
|
41
43
|
});
|
|
42
44
|
const { searchedText, searchedIcon } = searchedOption;
|
|
43
45
|
const [selectOptionList, setSelectOptionList] = useState<Option[] | []>([]);
|
|
44
|
-
const [dropdownPosition, setDropdownPosition] = useState<
|
|
46
|
+
const [dropdownPosition, setDropdownPosition] = useState<DropdownPosition>({
|
|
45
47
|
positionX: 0,
|
|
46
48
|
positionY: 0,
|
|
47
49
|
width: 0,
|
|
@@ -170,6 +172,10 @@ const Select: FC<SelectProps> = ({
|
|
|
170
172
|
setSelectOptionList(optionsList);
|
|
171
173
|
}, [optionsList]);
|
|
172
174
|
|
|
175
|
+
if (showLabel) {
|
|
176
|
+
placeHolder = '';
|
|
177
|
+
}
|
|
178
|
+
|
|
173
179
|
return (
|
|
174
180
|
<div
|
|
175
181
|
className={`ff-select-wrapper ${className}`}
|
|
@@ -206,6 +212,7 @@ const Select: FC<SelectProps> = ({
|
|
|
206
212
|
disabled={disabled}
|
|
207
213
|
onChange={handleChange}
|
|
208
214
|
readOnly={disableInput}
|
|
215
|
+
placeholder={placeHolder}
|
|
209
216
|
/>
|
|
210
217
|
{optionsRequired && (
|
|
211
218
|
<div
|
|
@@ -266,6 +273,7 @@ const Select: FC<SelectProps> = ({
|
|
|
266
273
|
heightFromTop={height}
|
|
267
274
|
selectedOption={searchedText}
|
|
268
275
|
showIcon={showIcon}
|
|
276
|
+
showToolTip={showToolTip}
|
|
269
277
|
/>,
|
|
270
278
|
document.body
|
|
271
279
|
)}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
} from '../../../utils/getSelectOptionValue/getSelectOptionValue';
|
|
13
13
|
import useClickOutside from '../../../hooks/useClickOutside';
|
|
14
14
|
import Icon from '../../Icon';
|
|
15
|
+
import Tooltip from '../../Tooltip';
|
|
15
16
|
|
|
16
17
|
const Dropdown: FC<DropdownProps> = ({
|
|
17
18
|
options = [],
|
|
@@ -26,6 +27,7 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
26
27
|
selectedOption,
|
|
27
28
|
valueAccessor,
|
|
28
29
|
showIcon = false,
|
|
30
|
+
showToolTip = false,
|
|
29
31
|
}) => {
|
|
30
32
|
const themeContext = useContext(ThemeContext);
|
|
31
33
|
const currentTheme = themeContext?.currentTheme;
|
|
@@ -72,22 +74,28 @@ const Dropdown: FC<DropdownProps> = ({
|
|
|
72
74
|
return label;
|
|
73
75
|
}
|
|
74
76
|
return (
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
className={classNames({
|
|
80
|
-
'ff-select-dropdown-icon-container': showIcon,
|
|
81
|
-
})}
|
|
77
|
+
<Tooltip
|
|
78
|
+
placement="bottom"
|
|
79
|
+
title={showToolTip ? label : ''}
|
|
80
|
+
zIndex={optionZIndex + 1}
|
|
82
81
|
>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
82
|
+
<Typography
|
|
83
|
+
as="div"
|
|
84
|
+
lineHeight="30px"
|
|
85
|
+
color="var(--ff-select-text-color)"
|
|
86
|
+
className={classNames({
|
|
87
|
+
'ff-select-dropdown-icon-container': showIcon,
|
|
88
|
+
})}
|
|
89
|
+
>
|
|
90
|
+
{showIcon && (
|
|
91
|
+
<Icon
|
|
92
|
+
name={icon}
|
|
93
|
+
className="ff-select-dropdown-icon-container__icon"
|
|
94
|
+
/>
|
|
95
|
+
)}
|
|
96
|
+
{label}
|
|
97
|
+
</Typography>
|
|
98
|
+
</Tooltip>
|
|
91
99
|
);
|
|
92
100
|
};
|
|
93
101
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DropdownPosition, Option } from '../types';
|
|
2
2
|
import { RefObject } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface DropdownProps {
|
|
5
5
|
options: Option[];
|
|
6
|
-
dropdownPosition:
|
|
6
|
+
dropdownPosition: DropdownPosition;
|
|
7
7
|
optionZIndex: number;
|
|
8
8
|
labelAccessor?: string;
|
|
9
9
|
valueAccessor?: string;
|
|
@@ -14,6 +14,7 @@ export interface DropdownProps {
|
|
|
14
14
|
heightFromTop: number;
|
|
15
15
|
selectedOption?: Option;
|
|
16
16
|
showIcon?: boolean;
|
|
17
|
+
showToolTip?: boolean
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export const dropdownDefaultCSSData = {
|
|
@@ -108,9 +108,19 @@ export interface SelectProps {
|
|
|
108
108
|
* Provide the icon name for the select
|
|
109
109
|
*/
|
|
110
110
|
iconName?: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Provide the placehoder for the select
|
|
114
|
+
*/
|
|
115
|
+
placeHolder?: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Provide the boolean value if tooltip is reuired or not
|
|
119
|
+
*/
|
|
120
|
+
showToolTip?: boolean
|
|
111
121
|
}
|
|
112
122
|
|
|
113
|
-
export interface
|
|
123
|
+
export interface DropdownPosition {
|
|
114
124
|
positionX: number;
|
|
115
125
|
positionY: number;
|
|
116
126
|
width: number;
|
|
@@ -124,7 +134,7 @@ export interface SelectState {
|
|
|
124
134
|
showOptions: boolean;
|
|
125
135
|
options: Option[];
|
|
126
136
|
option: string;
|
|
127
|
-
dropdownPosition:
|
|
137
|
+
dropdownPosition: DropdownPosition;
|
|
128
138
|
}
|
|
129
139
|
|
|
130
140
|
type OptionValue = any;
|
|
@@ -30,6 +30,7 @@ const SequentialConnectingBranch: FC<SequentialConnectingBranchProps> = ({
|
|
|
30
30
|
addInstanceLabel = 'Add Environment',
|
|
31
31
|
scriptType = 'Automation',
|
|
32
32
|
projectType = 'Web',
|
|
33
|
+
readOnly = true,
|
|
33
34
|
}) => {
|
|
34
35
|
const [selectedMachineInstance, setSelectedMachineInstance] = useState({});
|
|
35
36
|
const selectButtonRef = useRef<HTMLButtonElement>(null);
|
|
@@ -174,6 +175,7 @@ const SequentialConnectingBranch: FC<SequentialConnectingBranchProps> = ({
|
|
|
174
175
|
addInstanceLabel={addInstanceLabel}
|
|
175
176
|
scriptType={scriptType}
|
|
176
177
|
projectType={projectType}
|
|
178
|
+
readOnly={readOnly}
|
|
177
179
|
/>
|
|
178
180
|
)}
|
|
179
181
|
</div>
|