pixel-react-excel-sheet 1.0.20 → 1.0.22
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/Chip/types.d.ts +1 -1
- package/lib/components/ConditionalDropdown/OptionsDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/types.d.ts +50 -4
- package/lib/components/LabelEditTextField/types.d.ts +1 -0
- package/lib/components/MachineInputField/types.d.ts +1 -0
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +2 -1
- package/lib/components/MiniModal/types.d.ts +1 -0
- package/lib/components/NLPInput/NlpInput.d.ts +2 -2
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +6 -3
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +1 -1
- package/lib/components/NLPInput/sampleData.d.ts +104 -0
- package/lib/components/NLPInput/types.d.ts +80 -0
- package/lib/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/lib/components/ProgressBar/index.d.ts +1 -0
- package/lib/components/ProgressBar/types.d.ts +12 -0
- 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 -1
- package/lib/components/TableTree/types.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver.d.ts +9 -0
- package/lib/index.d.ts +80 -28
- package/lib/index.esm.js +725 -408
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +725 -407
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/functionCheck/functionCheck.d.ts +2 -0
- package/package.json +1 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +5 -0
- package/src/assets/Themes/BaseTheme.scss +18 -3
- package/src/assets/Themes/DarkTheme.scss +15 -2
- package/src/assets/icons/ai_search.svg +9 -0
- package/src/assets/icons/help_icon.svg +10 -0
- package/src/assets/icons/ios_icon.svg +11 -0
- package/src/assets/icons/plus_round_icon.svg +38 -0
- package/src/assets/icons/tick_icon.svg +2 -2
- package/src/assets/styles/_colors.scss +1 -1
- package/src/components/AttachmentButton/AttachmentButton.tsx +1 -1
- package/src/components/Checkbox/Checkbox.scss +3 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +32 -77
- package/src/components/Checkbox/Checkbox.tsx +3 -4
- package/src/components/Chip/Chip.scss +15 -5
- package/src/components/Chip/Chip.stories.tsx +10 -1
- package/src/components/Chip/Chip.tsx +5 -1
- package/src/components/Chip/types.ts +1 -1
- package/src/components/ConditionalDropdown/ConditionalDropdown.scss +4 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +67 -2
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +58 -28
- package/src/components/ConditionalDropdown/OptionsDropdown.tsx +44 -0
- package/src/components/ConditionalDropdown/types.ts +61 -4
- package/src/components/EditTextField/EditTextField.scss +1 -1
- package/src/components/EditTextField/EditTextField.tsx +14 -20
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +0 -3
- package/src/components/Excel/ExcelFile/ExcelFileComponents/HeaderRow.tsx +1 -1
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +1 -0
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.tsx +30 -1
- package/src/components/Form/Forms.tsx +0 -2
- package/src/components/Icon/iconList.ts +9 -0
- package/src/components/LabelEditTextField/LabelEditTextField.scss +1 -1
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +29 -36
- package/src/components/LabelEditTextField/types.ts +1 -0
- package/src/components/MachineInputField/MachineInputField.scss +1 -5
- package/src/components/MachineInputField/MachineInputField.stories.tsx +4 -4
- package/src/components/MachineInputField/MachineInputField.tsx +4 -1
- package/src/components/MachineInputField/types.ts +1 -0
- package/src/components/MenuOption/MenuOption.scss +7 -7
- package/src/components/MenuOption/MenuOption.stories.tsx +83 -28
- package/src/components/MenuOption/MenuOption.tsx +9 -13
- package/src/components/MenuOption/types.ts +3 -2
- package/src/components/MiniModal/MiniModal.scss +0 -1
- package/src/components/MiniModal/MiniModal.stories.tsx +6 -1
- package/src/components/MiniModal/MiniModal.tsx +3 -1
- package/src/components/MiniModal/types.ts +1 -0
- package/src/components/MultiSelect/Dropdown.scss +3 -4
- package/src/components/MultiSelect/Dropdown.tsx +4 -3
- package/src/components/MultiSelect/MultiSelect.scss +1 -0
- package/src/components/MultiSelect/MultiSelect.tsx +1 -0
- package/src/components/NLPInput/NLPInput.scss +77 -21
- package/src/components/NLPInput/NlpInput.stories.tsx +43 -109
- package/src/components/NLPInput/NlpInput.tsx +95 -59
- package/src/components/NLPInput/components/NlpDropDown/NlpDropDownType.ts +6 -4
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.scss +86 -35
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.tsx +220 -80
- package/src/components/NLPInput/sampleData.ts +162 -0
- package/src/components/NLPInput/{type.tsx → types.tsx} +23 -11
- package/src/components/ProgressBar/ProgressBar.scss +46 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +22 -0
- package/src/components/ProgressBar/ProgressBar.tsx +61 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/ProgressBar/types.ts +12 -0
- package/src/components/Search/Search.tsx +9 -1
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +8 -0
- 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 +1 -1
- package/src/components/Table/Table.scss +1 -0
- package/src/components/TableTree/Components/TableBody.tsx +3 -1
- package/src/components/TableTree/TableTree.stories.tsx +2 -2
- package/src/components/TableTree/TableTree.tsx +24 -14
- package/src/components/TableTree/data.ts +45 -0
- package/src/components/TableTree/types.ts +1 -1
- package/src/hooks/useIntersectionObserver.tsx +56 -0
- package/src/index.ts +2 -0
- package/src/utils/functionCheck/functionCheck.ts +8 -0
|
@@ -5,6 +5,8 @@ import Typography from '../Typography';
|
|
|
5
5
|
import HighlightText from '../HighlightText';
|
|
6
6
|
import Icon from '../Icon';
|
|
7
7
|
import Tooltip from '../Tooltip';
|
|
8
|
+
import Input from '../Input/Input';
|
|
9
|
+
import Select from '../Select/Select';
|
|
8
10
|
|
|
9
11
|
const getErrorMessage = (
|
|
10
12
|
inputValue: string,
|
|
@@ -25,6 +27,7 @@ const getErrorMessage = (
|
|
|
25
27
|
};
|
|
26
28
|
const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
27
29
|
label,
|
|
30
|
+
placeholder,
|
|
28
31
|
text,
|
|
29
32
|
highlightText,
|
|
30
33
|
customError,
|
|
@@ -33,7 +36,7 @@ const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
|
33
36
|
cancelIcon,
|
|
34
37
|
variant = 'textField',
|
|
35
38
|
dropdownData = [],
|
|
36
|
-
width,
|
|
39
|
+
// width,
|
|
37
40
|
height,
|
|
38
41
|
isOpen = false,
|
|
39
42
|
confirmAction,
|
|
@@ -47,7 +50,8 @@ const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
|
47
50
|
);
|
|
48
51
|
const [showError, setShowError] = useState('');
|
|
49
52
|
const [isTextFieldModified, setIsTextFieldModified] = useState(false);
|
|
50
|
-
const
|
|
53
|
+
const isThrowingError = showError && isEditing ? true : false;
|
|
54
|
+
|
|
51
55
|
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
52
56
|
const cancelRef = useRef<HTMLDivElement | null>(null); // New ref for cancel icon
|
|
53
57
|
const [clickTimeout, setClickTimeout] = useState<number | null>(null);
|
|
@@ -105,7 +109,6 @@ const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
|
105
109
|
setIsEditing(false);
|
|
106
110
|
setShowError('');
|
|
107
111
|
setIsTextFieldModified(false);
|
|
108
|
-
setIsDropdownModified(false);
|
|
109
112
|
};
|
|
110
113
|
|
|
111
114
|
const handleTextFieldChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
@@ -114,12 +117,6 @@ const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
|
114
117
|
setShowError('');
|
|
115
118
|
};
|
|
116
119
|
|
|
117
|
-
const handleDropdownChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
|
118
|
-
setDropdownValue(e.target.value);
|
|
119
|
-
setIsDropdownModified(true);
|
|
120
|
-
setShowError('');
|
|
121
|
-
};
|
|
122
|
-
|
|
123
120
|
const handleBlur = (e: MouseEvent) => {
|
|
124
121
|
if (
|
|
125
122
|
containerRef.current &&
|
|
@@ -155,44 +152,40 @@ const LabelEditTextField: FC<LabelEditTextFieldTypes> = ({
|
|
|
155
152
|
}`}
|
|
156
153
|
style={{ height }}
|
|
157
154
|
>
|
|
158
|
-
<
|
|
155
|
+
<Input
|
|
156
|
+
name="input"
|
|
159
157
|
type="text"
|
|
158
|
+
label={label ? label : ''}
|
|
159
|
+
disabled={false}
|
|
160
|
+
error={isThrowingError}
|
|
161
|
+
placeholder={placeholder ? placeholder : ''}
|
|
160
162
|
value={inputValue}
|
|
161
163
|
onChange={handleTextFieldChange}
|
|
162
|
-
className={`
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
164
|
+
className={`
|
|
165
|
+
|
|
166
|
+
${isTextFieldModified ? 'modified' : ''}`}
|
|
167
|
+
/>
|
|
168
|
+
<Select
|
|
169
|
+
label={''}
|
|
170
|
+
optionsList={dropdownData}
|
|
171
|
+
selectedOption={{ value: dropdownValue, label: dropdownValue }}
|
|
172
|
+
onChange={(option) => setDropdownValue(option.value)}
|
|
169
173
|
/>
|
|
170
|
-
{label && <label className="ff-label">{label}</label>}
|
|
171
|
-
<select
|
|
172
|
-
value={dropdownValue}
|
|
173
|
-
onChange={handleDropdownChange}
|
|
174
|
-
className={`dropdown ${isDropdownModified ? 'modified' : ''}`}
|
|
175
|
-
>
|
|
176
|
-
{dropdownData.map((item) => (
|
|
177
|
-
<option key={item.id} value={item.value}>
|
|
178
|
-
{item.label}
|
|
179
|
-
</option>
|
|
180
|
-
))}
|
|
181
|
-
</select>
|
|
182
174
|
</div>
|
|
183
175
|
) : (
|
|
184
176
|
<div className="ff-label-text-field-without-dropdown">
|
|
185
|
-
<
|
|
177
|
+
<Input
|
|
178
|
+
name="input"
|
|
186
179
|
type="text"
|
|
180
|
+
label={label ? label : ''}
|
|
181
|
+
disabled={false}
|
|
182
|
+
placeholder={placeholder ? placeholder : ''}
|
|
187
183
|
value={inputValue}
|
|
188
184
|
onChange={handleTextFieldChange}
|
|
189
|
-
className={`
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
placeholder=" "
|
|
193
|
-
style={{ width, height }}
|
|
185
|
+
className={`
|
|
186
|
+
|
|
187
|
+
${isTextFieldModified ? 'modified' : ''}`}
|
|
194
188
|
/>
|
|
195
|
-
<label className="ff-textfield-label">{label}</label>
|
|
196
189
|
</div>
|
|
197
190
|
)}
|
|
198
191
|
<div className="ff-icon-container">
|
|
@@ -15,15 +15,15 @@ type Story = StoryObj<typeof MachineInputField>;
|
|
|
15
15
|
|
|
16
16
|
// Sample data for the MachineInputField
|
|
17
17
|
const sampleOptions: MachineType[] = [
|
|
18
|
-
{ label: 'Local', type: 'Local' },
|
|
19
|
-
{ label: '121.25.
|
|
20
|
-
{ label: '17, iPhone 15', type: 'mac' },
|
|
18
|
+
{ label: 'Local Environment', type: 'Local' },
|
|
19
|
+
{ label: '121.25.333.344.2', type: 'Google Chrome' },
|
|
20
|
+
{ label: '17, iPhone 15 pro max', type: 'mac' },
|
|
21
21
|
{ label: 'Samsung Galaxy S23', type: 'android' },
|
|
22
22
|
];
|
|
23
23
|
|
|
24
24
|
export const Primary: Story = {
|
|
25
25
|
args: {
|
|
26
|
-
width: '
|
|
26
|
+
width: '530px', // Example width
|
|
27
27
|
options: sampleOptions,
|
|
28
28
|
runCount: 1,
|
|
29
29
|
},
|
|
@@ -4,6 +4,7 @@ import Typography from '../Typography';
|
|
|
4
4
|
import Icon from '../Icon';
|
|
5
5
|
import { MachineInputFieldProps, MachineType } from './types';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { truncateText } from '../../utils/truncateText/truncateText';
|
|
7
8
|
|
|
8
9
|
const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
|
|
9
10
|
(
|
|
@@ -14,6 +15,7 @@ const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
|
|
|
14
15
|
className = '',
|
|
15
16
|
contentReverse = false,
|
|
16
17
|
onClick = () => {},
|
|
18
|
+
modalId = '',
|
|
17
19
|
},
|
|
18
20
|
ref
|
|
19
21
|
) => {
|
|
@@ -36,6 +38,7 @@ const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
|
|
|
36
38
|
return (
|
|
37
39
|
<div
|
|
38
40
|
ref={ref}
|
|
41
|
+
id={modalId}
|
|
39
42
|
style={{ width: width }}
|
|
40
43
|
className={classNames('ff-machine-input-field-wrapper', className)}
|
|
41
44
|
onClick={onClick}
|
|
@@ -72,7 +75,7 @@ const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
|
|
|
72
75
|
})}
|
|
73
76
|
color="var(--ff-machine-input-field-text-color)"
|
|
74
77
|
>
|
|
75
|
-
{label}
|
|
78
|
+
{truncateText(label, 15)}
|
|
76
79
|
</Typography>
|
|
77
80
|
</div>
|
|
78
81
|
))}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
.ff-option-card {
|
|
48
|
-
position:
|
|
48
|
+
position: absolute;
|
|
49
49
|
margin: 4px;
|
|
50
50
|
border: 1px solid var(--option-card-border-color);
|
|
51
51
|
background: var(--option-card-bg-color);
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
min-width: 110px;
|
|
55
55
|
width: max-content;
|
|
56
56
|
border-radius: 4px;
|
|
57
|
-
&--primary{
|
|
57
|
+
&--primary {
|
|
58
58
|
background: var(--brand-color);
|
|
59
59
|
color: var(--primary-button-text-color);
|
|
60
60
|
svg {
|
|
@@ -62,14 +62,14 @@
|
|
|
62
62
|
fill: var(--primary-icon-color);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
:hover{
|
|
65
|
+
:hover {
|
|
66
66
|
color: var(--brand-color);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
svg {
|
|
68
|
+
path {
|
|
69
|
+
fill: var(--brand-color);
|
|
70
|
+
}
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
|
-
}
|
|
73
73
|
}
|
|
74
74
|
.ff-options {
|
|
75
75
|
@extend .fontSm;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import MenuOption from './MenuOption';
|
|
3
3
|
import './MenuOption.scss';
|
|
4
|
-
import React, { ReactNode } from 'react';
|
|
4
|
+
import React, { ReactNode, useRef } from 'react';
|
|
5
5
|
import Icon from '../Icon';
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof MenuOption> = {
|
|
@@ -29,16 +29,16 @@ const meta: Meta<typeof MenuOption> = {
|
|
|
29
29
|
},
|
|
30
30
|
tooltipPlacement: {
|
|
31
31
|
control: {
|
|
32
|
-
type: '
|
|
33
|
-
options: ['top', 'down', 'left', 'right'],
|
|
32
|
+
type: 'select',
|
|
33
|
+
options: ['top', 'down', 'left', 'right'],
|
|
34
34
|
},
|
|
35
35
|
description: 'Placement of the tooltip relative to the button.',
|
|
36
36
|
defaultValue: 'top',
|
|
37
37
|
},
|
|
38
38
|
dropdownPlacement: {
|
|
39
39
|
control: {
|
|
40
|
-
type: '
|
|
41
|
-
options: ['top', 'down', 'left', 'right'],
|
|
40
|
+
type: 'select',
|
|
41
|
+
options: ['top', 'down', 'left', 'right'],
|
|
42
42
|
},
|
|
43
43
|
description: 'Placement of the dropdown menu relative to the button.',
|
|
44
44
|
defaultValue: 'down',
|
|
@@ -49,7 +49,15 @@ const meta: Meta<typeof MenuOption> = {
|
|
|
49
49
|
type Story = StoryObj<typeof MenuOption>;
|
|
50
50
|
|
|
51
51
|
const options = [
|
|
52
|
-
{
|
|
52
|
+
{
|
|
53
|
+
label: (
|
|
54
|
+
<div>
|
|
55
|
+
hello <Icon name="edit" />
|
|
56
|
+
</div>
|
|
57
|
+
),
|
|
58
|
+
value: 'opt1',
|
|
59
|
+
icon: 'success',
|
|
60
|
+
},
|
|
53
61
|
{ label: 'Option 2', value: 'opt2', icon: 'success' },
|
|
54
62
|
{
|
|
55
63
|
label: 'Delete',
|
|
@@ -59,21 +67,31 @@ const options = [
|
|
|
59
67
|
},
|
|
60
68
|
];
|
|
61
69
|
|
|
62
|
-
const handleOptionClick = (option: { label: string|ReactNode }) => {
|
|
70
|
+
const handleOptionClick = (option: { label: string | ReactNode }) => {
|
|
63
71
|
alert(`Option clicked: ${option.label}`);
|
|
64
72
|
};
|
|
65
73
|
|
|
66
|
-
|
|
67
74
|
export const ControlledMenuOption: Story = {
|
|
68
75
|
args: {
|
|
69
76
|
iconName: 'more',
|
|
70
77
|
labelName: 'Controlled Menu',
|
|
71
78
|
tooltipTitle: 'Select an option',
|
|
72
|
-
dropdownPlacement:
|
|
79
|
+
dropdownPlacement: 'top',
|
|
80
|
+
},
|
|
81
|
+
render: (args) => {
|
|
82
|
+
const moreRef = useRef<HTMLDivElement>(null);
|
|
83
|
+
return (
|
|
84
|
+
<div ref={moreRef}>
|
|
85
|
+
<MenuOption
|
|
86
|
+
{...args}
|
|
87
|
+
options={options}
|
|
88
|
+
targetRef={moreRef} // Make sure targetRef is passed properly here
|
|
89
|
+
onOptionClick={handleOptionClick}
|
|
90
|
+
dropdownPlacement="left" // Dropdown placement for testing
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
73
94
|
},
|
|
74
|
-
render: (args) => (
|
|
75
|
-
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
|
76
|
-
),
|
|
77
95
|
parameters: {
|
|
78
96
|
docs: {
|
|
79
97
|
description: {
|
|
@@ -84,15 +102,24 @@ export const ControlledMenuOption: Story = {
|
|
|
84
102
|
},
|
|
85
103
|
};
|
|
86
104
|
|
|
87
|
-
|
|
88
105
|
export const MenuOptionTop: Story = {
|
|
89
106
|
args: {
|
|
90
107
|
...ControlledMenuOption.args,
|
|
91
108
|
dropdownPlacement: 'top',
|
|
92
109
|
},
|
|
93
|
-
render: (args) =>
|
|
94
|
-
|
|
95
|
-
|
|
110
|
+
render: (args) => {
|
|
111
|
+
const moreRef = useRef<HTMLDivElement>(null);
|
|
112
|
+
return (
|
|
113
|
+
<div ref={moreRef}>
|
|
114
|
+
<MenuOption
|
|
115
|
+
{...args}
|
|
116
|
+
options={options}
|
|
117
|
+
targetRef={moreRef}
|
|
118
|
+
onOptionClick={handleOptionClick}
|
|
119
|
+
/>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
},
|
|
96
123
|
parameters: {
|
|
97
124
|
docs: {
|
|
98
125
|
description: {
|
|
@@ -102,15 +129,24 @@ export const MenuOptionTop: Story = {
|
|
|
102
129
|
},
|
|
103
130
|
};
|
|
104
131
|
|
|
105
|
-
|
|
106
132
|
export const MenuOptionBottom: Story = {
|
|
107
133
|
args: {
|
|
108
134
|
...ControlledMenuOption.args,
|
|
109
135
|
dropdownPlacement: 'down',
|
|
110
136
|
},
|
|
111
|
-
render: (args) =>
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
render: (args) => {
|
|
138
|
+
const moreRef = useRef<HTMLDivElement>(null);
|
|
139
|
+
return (
|
|
140
|
+
<div ref={moreRef}>
|
|
141
|
+
<MenuOption
|
|
142
|
+
{...args}
|
|
143
|
+
options={options}
|
|
144
|
+
targetRef={moreRef}
|
|
145
|
+
onOptionClick={handleOptionClick}
|
|
146
|
+
/>
|
|
147
|
+
</div>
|
|
148
|
+
);
|
|
149
|
+
},
|
|
114
150
|
parameters: {
|
|
115
151
|
docs: {
|
|
116
152
|
description: {
|
|
@@ -120,15 +156,24 @@ export const MenuOptionBottom: Story = {
|
|
|
120
156
|
},
|
|
121
157
|
};
|
|
122
158
|
|
|
123
|
-
|
|
124
159
|
export const MenuOptionLeft: Story = {
|
|
125
160
|
args: {
|
|
126
161
|
...ControlledMenuOption.args,
|
|
127
162
|
dropdownPlacement: 'left',
|
|
128
163
|
},
|
|
129
|
-
render: (args) =>
|
|
130
|
-
|
|
131
|
-
|
|
164
|
+
render: (args) => {
|
|
165
|
+
const moreRef = useRef<HTMLDivElement>(null);
|
|
166
|
+
return (
|
|
167
|
+
<div ref={moreRef}>
|
|
168
|
+
<MenuOption
|
|
169
|
+
{...args}
|
|
170
|
+
options={options}
|
|
171
|
+
targetRef={moreRef}
|
|
172
|
+
onOptionClick={handleOptionClick}
|
|
173
|
+
/>
|
|
174
|
+
</div>
|
|
175
|
+
);
|
|
176
|
+
},
|
|
132
177
|
parameters: {
|
|
133
178
|
docs: {
|
|
134
179
|
description: {
|
|
@@ -141,11 +186,21 @@ export const MenuOptionLeft: Story = {
|
|
|
141
186
|
export const MenuOptionRight: Story = {
|
|
142
187
|
args: {
|
|
143
188
|
...ControlledMenuOption.args,
|
|
144
|
-
dropdownPlacement: 'right',
|
|
189
|
+
dropdownPlacement: 'right', // Proper dropdown placement
|
|
190
|
+
},
|
|
191
|
+
render: (args) => {
|
|
192
|
+
const moreRef = useRef<HTMLDivElement>(null);
|
|
193
|
+
return (
|
|
194
|
+
<div ref={moreRef}>
|
|
195
|
+
<MenuOption
|
|
196
|
+
{...args}
|
|
197
|
+
options={options}
|
|
198
|
+
targetRef={moreRef} // Properly pass ref to targetRef
|
|
199
|
+
onOptionClick={handleOptionClick}
|
|
200
|
+
/>
|
|
201
|
+
</div>
|
|
202
|
+
);
|
|
145
203
|
},
|
|
146
|
-
render: (args) => (
|
|
147
|
-
<MenuOption {...args} options={options} onOptionClick={handleOptionClick} />
|
|
148
|
-
),
|
|
149
204
|
parameters: {
|
|
150
205
|
docs: {
|
|
151
206
|
description: {
|
|
@@ -31,7 +31,7 @@ const Option = ({ option, onClick }: OptionProps) => (
|
|
|
31
31
|
)}
|
|
32
32
|
<Typography
|
|
33
33
|
as="label"
|
|
34
|
-
lineHeight=
|
|
34
|
+
lineHeight="18px"
|
|
35
35
|
color={option.icon === 'delete' ? 'var(--delete-text-color)' : ''}
|
|
36
36
|
>
|
|
37
37
|
{option.label}
|
|
@@ -74,13 +74,13 @@ const OptionCard = ({
|
|
|
74
74
|
};
|
|
75
75
|
case 'down':
|
|
76
76
|
return {
|
|
77
|
-
top: menuPosition.top +
|
|
77
|
+
top: menuPosition.top + 20,
|
|
78
78
|
left: menuPosition.left - 4,
|
|
79
79
|
};
|
|
80
80
|
case 'left':
|
|
81
81
|
return {
|
|
82
82
|
top: menuPosition.top - 4,
|
|
83
|
-
left: menuPosition.left - optionsWidth -
|
|
83
|
+
left: menuPosition.left - optionsWidth - 8,
|
|
84
84
|
};
|
|
85
85
|
case 'right':
|
|
86
86
|
return {
|
|
@@ -127,7 +127,8 @@ const MenuOption = ({
|
|
|
127
127
|
variant = 'light',
|
|
128
128
|
zIndex = 99,
|
|
129
129
|
dropdownPlacement = 'down',
|
|
130
|
-
optionCardVariant
|
|
130
|
+
optionCardVariant,
|
|
131
|
+
targetRef,
|
|
131
132
|
}: MenuOptionProps) => {
|
|
132
133
|
const [isClicked, setIsClicked] = useState(false);
|
|
133
134
|
const menuRef = useRef<HTMLDivElement>(null);
|
|
@@ -136,8 +137,6 @@ const MenuOption = ({
|
|
|
136
137
|
left: 0,
|
|
137
138
|
height: 0,
|
|
138
139
|
right: 0,
|
|
139
|
-
rightSpaceAvailable: 0,
|
|
140
|
-
bottomSpaceAvailable: 0,
|
|
141
140
|
});
|
|
142
141
|
|
|
143
142
|
const closeDropDown = () => setIsClicked(false);
|
|
@@ -154,20 +153,17 @@ const MenuOption = ({
|
|
|
154
153
|
};
|
|
155
154
|
|
|
156
155
|
const calculateDims = () => {
|
|
157
|
-
if (
|
|
158
|
-
const rect =
|
|
156
|
+
if (targetRef?.current) {
|
|
157
|
+
const rect = targetRef.current.getBoundingClientRect();
|
|
159
158
|
|
|
160
159
|
setMenuPosition({
|
|
161
|
-
top: rect.top,
|
|
162
|
-
left: rect.left,
|
|
160
|
+
top: rect.top + window.scrollY,
|
|
161
|
+
left: rect.left + window.scrollX,
|
|
163
162
|
height: rect.height,
|
|
164
163
|
right: rect.right,
|
|
165
|
-
rightSpaceAvailable: document.body.clientWidth - rect.right,
|
|
166
|
-
bottomSpaceAvailable: window.innerHeight - menuRef.current.offsetTop,
|
|
167
164
|
});
|
|
168
165
|
}
|
|
169
166
|
};
|
|
170
|
-
|
|
171
167
|
return (
|
|
172
168
|
<div className="ff-menu-option-container" ref={menuRef}>
|
|
173
169
|
<Tooltip title={tooltipTitle} placement={tooltipPlacement}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
interface OptionClick {
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ interface OptionClick {
|
|
|
6
6
|
* @type {string}
|
|
7
7
|
* @required
|
|
8
8
|
*/
|
|
9
|
-
label: string |ReactNode;
|
|
9
|
+
label: string | ReactNode;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The value(s) associated with the option, which can be a single string or an array of strings.
|
|
@@ -208,6 +208,7 @@ interface MenuOptionProps {
|
|
|
208
208
|
* @optional
|
|
209
209
|
*/
|
|
210
210
|
optionCardVariant?: 'primary';
|
|
211
|
+
targetRef?: React.RefObject<HTMLElement>;
|
|
211
212
|
}
|
|
212
213
|
|
|
213
214
|
interface OptionProps {
|
|
@@ -55,7 +55,12 @@ const BasicModalComponent = () => {
|
|
|
55
55
|
isOverlay: true,
|
|
56
56
|
zIndexOverlay: 99,
|
|
57
57
|
}}
|
|
58
|
-
modalProperties={{
|
|
58
|
+
modalProperties={{
|
|
59
|
+
width: 300,
|
|
60
|
+
height: 180,
|
|
61
|
+
left: 180,
|
|
62
|
+
top: 250,
|
|
63
|
+
}}
|
|
59
64
|
headerProps={
|
|
60
65
|
<>
|
|
61
66
|
<Typography as="p">Modal 1</Typography>
|
|
@@ -52,6 +52,7 @@ const MiniModal = forwardRef<HTMLDivElement, MiniEditModalProps>(
|
|
|
52
52
|
boxShadow: modalBoxShadow,
|
|
53
53
|
left: modalLeft,
|
|
54
54
|
top: modalTop,
|
|
55
|
+
padding: modalPadding,
|
|
55
56
|
} = modalProperties || {};
|
|
56
57
|
|
|
57
58
|
const {
|
|
@@ -300,6 +301,7 @@ const MiniModal = forwardRef<HTMLDivElement, MiniEditModalProps>(
|
|
|
300
301
|
modalBoxShadow ??
|
|
301
302
|
'0px 4px 8px var(--ff-mini-modal-arrow-shadow)'
|
|
302
303
|
}`,
|
|
304
|
+
padding: `${modalPadding ?? 4}px`,
|
|
303
305
|
}}
|
|
304
306
|
>
|
|
305
307
|
{headerProps ? (
|
|
@@ -312,7 +314,7 @@ const MiniModal = forwardRef<HTMLDivElement, MiniEditModalProps>(
|
|
|
312
314
|
<hr />
|
|
313
315
|
</Typography>
|
|
314
316
|
)}
|
|
315
|
-
|
|
317
|
+
{childContent}
|
|
316
318
|
{footerContent ? (
|
|
317
319
|
<Typography as="footer">{footerContent}</Typography>
|
|
318
320
|
) : isIconModel ? (
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
box-sizing: border-box;
|
|
11
11
|
margin-block: 4px;
|
|
12
12
|
max-height: 160px;
|
|
13
|
-
|
|
14
13
|
.ff-multiselect-options-wrapper {
|
|
15
14
|
max-height: 128px;
|
|
16
15
|
overflow-y: auto;
|
|
17
16
|
border-radius: 2px;
|
|
17
|
+
overflow-x: hidden;
|
|
18
18
|
&::-webkit-scrollbar {
|
|
19
19
|
width: 4px;
|
|
20
20
|
height: 40px;
|
|
@@ -37,11 +37,10 @@
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.no-options {
|
|
40
|
-
|
|
41
|
-
color: var(--pop-up-background-blur);
|
|
40
|
+
color: var(--ff-select-text-color);
|
|
42
41
|
text-align: center;
|
|
43
42
|
margin: 0;
|
|
44
|
-
padding:
|
|
43
|
+
padding: 7px;
|
|
45
44
|
line-height: 12px;
|
|
46
45
|
}
|
|
47
46
|
.dropdown-option-container {
|
|
@@ -89,9 +89,10 @@ const Dropdown = forwardRef<HTMLDivElement, DropdownProps>(
|
|
|
89
89
|
style={{ maxHeight: withSelectButton ? '128px' : '160px' }}
|
|
90
90
|
>
|
|
91
91
|
{filteredOptions.length === 0 ? (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
<Typography textAlign='center' as='p' className='no-options'>
|
|
93
|
+
No Result Found
|
|
94
|
+
</Typography>
|
|
95
|
+
|
|
95
96
|
) : (
|
|
96
97
|
filteredOptions.map((info) => (
|
|
97
98
|
<div
|