pixel-react-excel-sheet 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Chip/types.d.ts +1 -1
- package/lib/components/ConditionalDropdown/ConditionalDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/OptionsDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/index.d.ts +1 -0
- package/lib/components/ConditionalDropdown/types.d.ts +145 -0
- package/lib/components/CreateVariable/types.d.ts +2 -2
- package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +1 -1
- 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/Modal/types.d.ts +1 -1
- 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/PopUpModal/types.d.ts +2 -1
- 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/TableTree.d.ts +2 -2
- package/lib/components/TableTree/Utils/getAllChildIds.d.ts +1 -0
- package/lib/components/TableTree/types.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver.d.ts +9 -0
- package/lib/index.d.ts +154 -37
- package/lib/index.esm.js +817 -516
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +818 -516
- 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/import_icon.svg +4 -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/{AddVariables/AddVariables.scss → ConditionalDropdown/ConditionalDropdown.scss} +4 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +147 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +159 -0
- package/src/components/ConditionalDropdown/OptionsDropdown.tsx +44 -0
- package/src/components/ConditionalDropdown/index.ts +1 -0
- package/src/components/ConditionalDropdown/types.ts +160 -0
- package/src/components/CreateVariable/CreateVariableSlider.tsx +2 -2
- package/src/components/CreateVariable/types.ts +2 -2
- package/src/components/EditTextField/EditTextField.scss +1 -1
- package/src/components/EditTextField/EditTextField.tsx +14 -20
- package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +9 -26
- package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +4 -2
- package/src/components/Excel/ExcelFile.stories.tsx +1 -1
- package/src/components/Form/Forms.tsx +0 -2
- package/src/components/Icon/iconList.ts +12 -0
- package/src/components/InputWithDropdown/InputWithDropdown.tsx +102 -95
- 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/Modal/types.ts +1 -1
- 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/PopUpModal/PopUpModal.stories.tsx +15 -10
- package/src/components/PopUpModal/PopUpModal.tsx +5 -4
- package/src/components/PopUpModal/types.ts +2 -1
- 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 +4 -7
- package/src/components/TableTree/TableTree.tsx +29 -181
- package/src/components/TableTree/Utils/getAllChildIds.ts +2 -0
- 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 +4 -3
- package/src/utils/functionCheck/functionCheck.ts +8 -0
- package/src/components/AddVariables/AddVariables.stories.tsx +0 -44
- package/src/components/AddVariables/AddVariables.tsx +0 -113
- package/src/components/AddVariables/index.ts +0 -1
- package/src/components/AddVariables/types.ts +0 -36
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseIntersectionObserverOptions {
|
|
4
|
+
root?: Element | null;
|
|
5
|
+
rootMargin?: string;
|
|
6
|
+
threshold?: number | number[];
|
|
7
|
+
onIntersect: (
|
|
8
|
+
entry: IntersectionObserverEntry,
|
|
9
|
+
observer: IntersectionObserver
|
|
10
|
+
) => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function useIntersectionObserver(
|
|
14
|
+
elements: (Element | string)[] | null, // Accepts Element or id strings
|
|
15
|
+
options: UseIntersectionObserverOptions
|
|
16
|
+
): void {
|
|
17
|
+
const observerRef = useRef<IntersectionObserver | null>(null);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (!elements || elements.length === 0) return;
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
root = null,
|
|
24
|
+
rootMargin = '0px',
|
|
25
|
+
threshold = 0,
|
|
26
|
+
onIntersect,
|
|
27
|
+
} = options;
|
|
28
|
+
|
|
29
|
+
// Resolve elements: convert ids to DOM elements
|
|
30
|
+
const resolvedElements = elements
|
|
31
|
+
.map((element) =>
|
|
32
|
+
typeof element === 'string' ? document.getElementById(element) : element
|
|
33
|
+
)
|
|
34
|
+
.filter((el): el is Element => el !== null); // Ensure valid elements
|
|
35
|
+
|
|
36
|
+
if (resolvedElements.length === 0) {
|
|
37
|
+
console.warn('No valid elements to observe.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
observerRef.current = new IntersectionObserver(
|
|
42
|
+
(entries, observer) => {
|
|
43
|
+
entries.forEach((entry) => onIntersect(entry, observer));
|
|
44
|
+
},
|
|
45
|
+
{ root, rootMargin, threshold }
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
resolvedElements.forEach((element) =>
|
|
49
|
+
observerRef.current?.observe(element)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return () => {
|
|
53
|
+
observerRef.current?.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, [elements, options]);
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -70,6 +70,7 @@ import DownloadClient from './components/DownloadClient/DownloadClient';
|
|
|
70
70
|
import FieldSet from './components/FieldSet';
|
|
71
71
|
import CreateVariableSlider from './components/CreateVariable/CreateVariableSlider';
|
|
72
72
|
import TableWithAccordion from './components/TableWithAccordion/TableWithAccordion';
|
|
73
|
+
import ProgressBar from './components/ProgressBar';
|
|
73
74
|
|
|
74
75
|
// Utils imports
|
|
75
76
|
import { checkEmpty } from './utils/checkEmpty/checkEmpty';
|
|
@@ -96,7 +97,7 @@ import Comments from './components/Comment/Comments';
|
|
|
96
97
|
import useFileDropzone from './hooks/useFileDropzone';
|
|
97
98
|
import PopUpModal from './components/PopUpModal/PopUpModal';
|
|
98
99
|
import FormatString from './utils/FormatString/FormatString';
|
|
99
|
-
import
|
|
100
|
+
import ConditionalDropdown from './components/ConditionalDropdown/ConditionalDropdown';
|
|
100
101
|
import { hasDuplicateFile } from './utils/checkDuplicates/checkDuplicates';
|
|
101
102
|
import PhoneInputField from './components/PhoneInput';
|
|
102
103
|
|
|
@@ -179,10 +180,10 @@ export {
|
|
|
179
180
|
Comments,
|
|
180
181
|
PopUpModal,
|
|
181
182
|
CreateVariableSlider,
|
|
182
|
-
|
|
183
|
+
ConditionalDropdown,
|
|
183
184
|
PhoneInputField,
|
|
184
|
-
|
|
185
185
|
TableWithAccordion,
|
|
186
|
+
ProgressBar,
|
|
186
187
|
// utils exports
|
|
187
188
|
checkEmpty,
|
|
188
189
|
getExtension,
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
-
import AddVariables from './AddVariables';
|
|
4
|
-
import { AddVariableProps } from './types';
|
|
5
|
-
import { variableList } from '../Editor/constants';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Components/AddVariables',
|
|
9
|
-
component: AddVariables,
|
|
10
|
-
args: {
|
|
11
|
-
label: 'Add Variables',
|
|
12
|
-
placeholder: 'Enter text',
|
|
13
|
-
variableList,
|
|
14
|
-
dropdownWidth: '138px',
|
|
15
|
-
},
|
|
16
|
-
parameters: {
|
|
17
|
-
layout: 'centered',
|
|
18
|
-
},
|
|
19
|
-
} as Meta<AddVariableProps>;
|
|
20
|
-
|
|
21
|
-
// Wrapper component to handle state inside Storybook stories
|
|
22
|
-
const Template: StoryFn<AddVariableProps> = (args) => {
|
|
23
|
-
const [inputValue, setInputValue] = useState<string>('');
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<AddVariables
|
|
27
|
-
{...args}
|
|
28
|
-
onChange={(value: string) => setInputValue(value)}
|
|
29
|
-
value={inputValue}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const Default = Template.bind({});
|
|
35
|
-
Default.args = {
|
|
36
|
-
onCreateVariableClick: () => alert('Create Variable clicked'),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// Customized story with pre-filled input value
|
|
40
|
-
export const WithInitialValue = Template.bind({});
|
|
41
|
-
WithInitialValue.args = {
|
|
42
|
-
inputValue: 'Initial Text with $',
|
|
43
|
-
onCreateVariableClick: () => alert('Create Variable clicked'),
|
|
44
|
-
};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
2
|
-
import VariableDropdown from '../Editor/VariableDropdown';
|
|
3
|
-
import Icon from '../Icon';
|
|
4
|
-
import Input from '../Input';
|
|
5
|
-
import { AddVariableProps, dynamicObject } from './types';
|
|
6
|
-
import './AddVariables.scss';
|
|
7
|
-
import React, { useState, useRef, useEffect } from 'react';
|
|
8
|
-
|
|
9
|
-
const AddVariables: React.FC<AddVariableProps> = ({
|
|
10
|
-
label = '',
|
|
11
|
-
variableList = [],
|
|
12
|
-
placeholder = 'Enter text',
|
|
13
|
-
onChange,
|
|
14
|
-
onCreateVariableClick,
|
|
15
|
-
value = '',
|
|
16
|
-
dropdownWidth = 'inherit',
|
|
17
|
-
}) => {
|
|
18
|
-
const [showDropdown, setShowDropdown] = useState<boolean>(false);
|
|
19
|
-
const [cursorPosition, setCursorPosition] = useState<number | null>(null);
|
|
20
|
-
const [showCreateVariableIcon, setShowCreateVariableIcon] =
|
|
21
|
-
useState<boolean>(false);
|
|
22
|
-
const inputRef = useRef<HTMLInputElement>(null);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (cursorPosition !== null && inputRef.current) {
|
|
26
|
-
inputRef.current.setSelectionRange(cursorPosition, cursorPosition);
|
|
27
|
-
inputRef.current.focus();
|
|
28
|
-
}
|
|
29
|
-
}, [cursorPosition]);
|
|
30
|
-
|
|
31
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
32
|
-
const value = event.target.value;
|
|
33
|
-
onChange?.(value);
|
|
34
|
-
|
|
35
|
-
// Show dropdown only if the last character typed is `$`
|
|
36
|
-
const cursorPos = inputRef.current?.selectionStart || 0;
|
|
37
|
-
const isDollarTyped = value[cursorPos - 1] === '$';
|
|
38
|
-
|
|
39
|
-
if (isDollarTyped) {
|
|
40
|
-
setShowDropdown(true);
|
|
41
|
-
} else {
|
|
42
|
-
setShowDropdown(false); // Close if it's a space or other characters
|
|
43
|
-
}
|
|
44
|
-
if (value?.includes('$')) {
|
|
45
|
-
setShowCreateVariableIcon(false);
|
|
46
|
-
} else {
|
|
47
|
-
setShowCreateVariableIcon(true);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const handleDropdownClick = (item: dynamicObject) => {
|
|
52
|
-
if (inputRef.current) {
|
|
53
|
-
const { selectionStart, selectionEnd } = inputRef.current;
|
|
54
|
-
const dollarSyntax = `{${
|
|
55
|
-
item.type === 'LOCAL'
|
|
56
|
-
? 'LV'
|
|
57
|
-
: item.type === 'GLOBAL'
|
|
58
|
-
? 'GV'
|
|
59
|
-
: item.type === 'GROUP'
|
|
60
|
-
? 'SG'
|
|
61
|
-
: 'PEV'
|
|
62
|
-
}_${item.name}}`;
|
|
63
|
-
|
|
64
|
-
const newValue =
|
|
65
|
-
value.slice(0, selectionStart || 0) +
|
|
66
|
-
dollarSyntax +
|
|
67
|
-
value.slice(selectionEnd || 0);
|
|
68
|
-
|
|
69
|
-
onChange(newValue);
|
|
70
|
-
setCursorPosition((selectionStart || 0) + dollarSyntax.length);
|
|
71
|
-
|
|
72
|
-
// Close the dropdown after inserting the variable
|
|
73
|
-
setShowDropdown(false);
|
|
74
|
-
onChange?.(newValue);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div className="ff-add-variable-container">
|
|
80
|
-
<div className="ff-add-variable-input">
|
|
81
|
-
<Input
|
|
82
|
-
name="add_variable"
|
|
83
|
-
ref={inputRef}
|
|
84
|
-
type="text"
|
|
85
|
-
value={value}
|
|
86
|
-
onChange={handleChange}
|
|
87
|
-
variant="primary"
|
|
88
|
-
label={label}
|
|
89
|
-
placeholder={placeholder}
|
|
90
|
-
/>
|
|
91
|
-
{!checkEmpty(value) && showCreateVariableIcon && (
|
|
92
|
-
<Icon
|
|
93
|
-
onClick={onCreateVariableClick}
|
|
94
|
-
name="add_variable"
|
|
95
|
-
width={24}
|
|
96
|
-
height={24}
|
|
97
|
-
hoverEffect
|
|
98
|
-
/>
|
|
99
|
-
)}
|
|
100
|
-
</div>
|
|
101
|
-
{showDropdown && (
|
|
102
|
-
<VariableDropdown
|
|
103
|
-
position="relative"
|
|
104
|
-
width={dropdownWidth}
|
|
105
|
-
optionsList={variableList}
|
|
106
|
-
onSelectVariable={handleDropdownClick}
|
|
107
|
-
/>
|
|
108
|
-
)}
|
|
109
|
-
</div>
|
|
110
|
-
);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
export default AddVariables;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './AddVariables';
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export type dynamicObject = {
|
|
2
|
-
[key: string]: any;
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
export interface AddVariableProps {
|
|
6
|
-
/**
|
|
7
|
-
* Label for the field
|
|
8
|
-
*/
|
|
9
|
-
label?: string;
|
|
10
|
-
/**
|
|
11
|
-
* List of variables
|
|
12
|
-
*/
|
|
13
|
-
variableList?: dynamicObject[];
|
|
14
|
-
/**
|
|
15
|
-
* Place holder for the input field
|
|
16
|
-
*/
|
|
17
|
-
placeholder?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Function to handle input change
|
|
20
|
-
* @param value
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
onChange: (value: string) => void;
|
|
24
|
-
/**
|
|
25
|
-
* Function to handle create variable icon click
|
|
26
|
-
*/
|
|
27
|
-
onCreateVariableClick?: () => void;
|
|
28
|
-
/**
|
|
29
|
-
* Value of the input field
|
|
30
|
-
*/
|
|
31
|
-
value: string;
|
|
32
|
-
/**
|
|
33
|
-
* Width of the dropdown
|
|
34
|
-
*/
|
|
35
|
-
dropdownWidth?: string;
|
|
36
|
-
}
|