pixel-react 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.d.ts +5 -0
  3. package/lib/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.d.ts +7 -0
  4. package/lib/components/Charts/DashboardDonutChart/index.d.ts +1 -0
  5. package/lib/components/Charts/DashboardDonutChart/types.d.ts +21 -0
  6. package/lib/components/Charts/PieChart/PieChart.d.ts +5 -0
  7. package/lib/components/Charts/PieChart/PieChart.stories.d.ts +7 -0
  8. package/lib/components/Charts/PieChart/index.d.ts +1 -0
  9. package/lib/components/Charts/PieChart/types.d.ts +27 -0
  10. package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
  11. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -1
  12. package/lib/components/NLPInput/NlpInput.d.ts +4 -0
  13. package/lib/components/NLPInput/NlpInput.stories.d.ts +7 -0
  14. package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +19 -0
  15. package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +4 -0
  16. package/lib/components/NLPInput/index.d.ts +1 -0
  17. package/lib/components/NLPInput/type.d.ts +70 -0
  18. package/lib/components/Table/Table.d.ts +1 -1
  19. package/lib/index.d.ts +73 -18
  20. package/lib/index.esm.js +1412 -774
  21. package/lib/index.esm.js.map +1 -1
  22. package/lib/index.js +1414 -773
  23. package/lib/index.js.map +1 -1
  24. package/lib/tsconfig.tsbuildinfo +1 -1
  25. package/lib/utils/getEncryptedData/getEncryptedData.d.ts +2 -0
  26. package/lib/utils/getEncryptedData/getEncryptedData.stories.d.ts +6 -0
  27. package/package.json +2 -1
  28. package/src/StyleGuide/ColorPalette/ColorPalette.tsx +2 -4
  29. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +95 -20
  30. package/src/assets/Themes/BaseTheme.scss +2 -3
  31. package/src/assets/Themes/DarkTheme.scss +9 -8
  32. package/src/assets/icons/wswb_delete_icon.svg +4 -0
  33. package/src/assets/icons/wswb_plus_icon.svg +5 -0
  34. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.scss +145 -0
  35. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.stories.tsx +52 -0
  36. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +335 -0
  37. package/src/components/Charts/DashboardDonutChart/index.ts +1 -0
  38. package/src/components/Charts/DashboardDonutChart/types.ts +33 -0
  39. package/src/components/Charts/PieChart/PieChart.scss +39 -0
  40. package/src/components/Charts/PieChart/PieChart.stories.tsx +46 -0
  41. package/src/components/Charts/PieChart/PieChart.tsx +193 -0
  42. package/src/components/Charts/PieChart/index.ts +1 -0
  43. package/src/components/Charts/PieChart/types.ts +28 -0
  44. package/src/components/Icon/iconList.ts +6 -0
  45. package/src/components/Modal/modal.scss +1 -1
  46. package/src/components/MultiSelect/MultiSelect.stories.tsx +2 -3
  47. package/src/components/MultiSelect/MultiSelect.tsx +35 -23
  48. package/src/components/MultiSelect/MultiSelectTypes.ts +1 -1
  49. package/src/components/NLPInput/NLPInput.scss +246 -0
  50. package/src/components/NLPInput/NlpInput.stories.tsx +136 -0
  51. package/src/components/NLPInput/NlpInput.tsx +374 -0
  52. package/src/components/NLPInput/components/NlpDropDown/NlpDropDownType.ts +60 -0
  53. package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.scss +83 -0
  54. package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.tsx +180 -0
  55. package/src/components/NLPInput/index.ts +1 -0
  56. package/src/components/NLPInput/type.tsx +124 -0
  57. package/src/components/Table/Table.scss +5 -0
  58. package/src/components/Table/Table.stories.tsx +12 -0
  59. package/src/components/Table/Table.tsx +25 -14
  60. package/src/components/TextArea/Textarea.scss +1 -1
  61. package/src/index.ts +6 -1
  62. package/src/utils/getEncryptedData/getEncryptedData.stories.tsx +55 -0
  63. package/src/utils/getEncryptedData/getEncryptedData.ts +10 -0
  64. package/lib/components/AddButton/AddButton.d.ts +0 -5
  65. package/lib/components/AddButton/AddButton.stories.d.ts +0 -6
  66. package/lib/components/AddButton/index.d.ts +0 -1
  67. package/lib/components/AddButton/types.d.ts +0 -4
@@ -0,0 +1,374 @@
1
+ import { useReducer, useRef, useEffect, useMemo } from 'react';
2
+ import { Option, SelectAction, SelectProps, SelectState } from './type';
3
+ import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
4
+ import { createPortal } from 'react-dom';
5
+ import classNames from 'classnames';
6
+ import Dropdown from './components/NlpDropDown/NlpDropdown';
7
+ import Icon from '../Icon';
8
+ import './NlpInput.scss';
9
+ import usePortalPosition from '../../hooks/usePortalPosition';
10
+ import Typography from '../Typography';
11
+
12
+ const nlpInputReducer = (
13
+ state: SelectState,
14
+ action: SelectAction
15
+ ): SelectState => {
16
+ switch (action.type) {
17
+ case 'FOCUS_INPUT':
18
+ return {
19
+ ...state,
20
+ isInputFocused: true,
21
+ iconColor: 'var(--ff-nlp-input-brand-color)',
22
+ isIconClick: true,
23
+ showOptions: true,
24
+ };
25
+ case 'BLUR_INPUT':
26
+ return {
27
+ ...state,
28
+ isInputFocused: false,
29
+ options: action.payload.optionsList,
30
+ option: action.payload.option,
31
+
32
+ // todo color need to be add in style guide
33
+ iconColor: 'var(--ff-nlp-input-default-color)',
34
+ isIconClick: false,
35
+ showOptions: false,
36
+ dropdownPosition: {
37
+ positionX: 0,
38
+ positionY: 0,
39
+ width: 0,
40
+ fromBottom: 0,
41
+ },
42
+ };
43
+ case 'MOUSE_ENTER':
44
+ return state.isInputFocused
45
+ ? state
46
+ : { ...state, iconColor: 'var(--ff-nlp-input-text-hover-color)' };
47
+ case 'MOUSE_LEAVE':
48
+ return state.isInputFocused
49
+ ? state
50
+ : // todo color need to be add in style guide
51
+ {
52
+ ...state,
53
+ iconColor: 'var(--ff-nlp-input-default-color)',
54
+ isIconClick: false,
55
+ };
56
+
57
+ case 'UPDATE_DROPDOWN_POSITION':
58
+ const { positionX, positionY, width, fromBottom } = action.payload || {};
59
+ return {
60
+ ...state,
61
+ dropdownPosition: {
62
+ positionX,
63
+ positionY,
64
+ width,
65
+ fromBottom,
66
+ },
67
+ };
68
+
69
+ case 'UPDATE_OPTION':
70
+ return {
71
+ ...state,
72
+ option: action.payload,
73
+ };
74
+
75
+ case 'UPDATE_OPTION_LIST':
76
+ return {
77
+ ...state,
78
+ options: action.payload,
79
+ };
80
+ case 'SHOW_ERROR':
81
+ return {
82
+ ...state,
83
+ isInputFocused: true,
84
+ isIconClick: false,
85
+ showOptions: false,
86
+ options: action.payload.optionsList,
87
+ option: action.payload.option,
88
+
89
+ iconColor: 'var(--ff-nlp-input-default-color)',
90
+ dropdownPosition: {
91
+ positionX: 0,
92
+ positionY: 0,
93
+ width: 0,
94
+ fromBottom: 0,
95
+ },
96
+ };
97
+
98
+ default:
99
+ return state;
100
+ }
101
+ };
102
+
103
+ const NlpInput = ({
104
+ label = '',
105
+ showLabel = true,
106
+ optionsList = [],
107
+ selectedOption = {
108
+ displayName: '',
109
+ projectId: '',
110
+ nlpType: '',
111
+ platform: '',
112
+ },
113
+ onChange = () => {},
114
+ errorMsg = '',
115
+ className = '',
116
+ optionZIndex = 100,
117
+ disabled = false,
118
+ borderRadius = true,
119
+ showBorder = true,
120
+ required = false,
121
+ }: SelectProps) => {
122
+ const initialState: SelectState = useMemo(
123
+ () => ({
124
+ isInputFocused: false,
125
+
126
+ // todo color need to be added in style guide
127
+ iconColor: 'var(--ff-nlp-input-default-color)',
128
+ isIconClick: false,
129
+ showOptions: false,
130
+ options: optionsList,
131
+ option: checkEmpty(selectedOption) ? '' : selectedOption?.projectId,
132
+ dropdownPosition: { positionX: 0, positionY: 0, width: 0, fromBottom: 0 },
133
+ }),
134
+ [optionsList, selectedOption]
135
+ );
136
+
137
+ const [selectControlState, dispatch] = useReducer(
138
+ nlpInputReducer,
139
+ initialState
140
+ );
141
+
142
+ const DropDownRef = useRef<HTMLDivElement>(null);
143
+ const InputRef = useRef<HTMLInputElement>(null);
144
+
145
+ const {
146
+ isInputFocused,
147
+ iconColor,
148
+ isIconClick,
149
+ showOptions,
150
+ dropdownPosition,
151
+ options,
152
+ option,
153
+ } = selectControlState;
154
+
155
+ const calculatePosition = usePortalPosition(DropDownRef, showOptions);
156
+
157
+ const handleSelectAction = (
158
+ actionType:
159
+ | 'FOCUS_INPUT'
160
+ | 'MOUSE_ENTER'
161
+ | 'MOUSE_LEAVE'
162
+ | 'SHOW_ERROR'
163
+ | 'BLUR_INPUT'
164
+ ) => {
165
+ if (!disabled) {
166
+ if (actionType === 'SHOW_ERROR' || actionType === 'BLUR_INPUT') {
167
+ dispatch({
168
+ type: actionType,
169
+ payload: { optionsList, option: selectedOption.projectId },
170
+ });
171
+ } else {
172
+ dispatch({ type: actionType });
173
+ }
174
+ }
175
+ };
176
+
177
+ const onSelectInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
178
+ if (disabled) return;
179
+ const { value } = e.target;
180
+
181
+ const filteredOptions = optionsList.filter((option) => {
182
+ return option.displayName
183
+ .toLowerCase()
184
+ .includes(value.toLowerCase().trim());
185
+ });
186
+
187
+ dispatch({ type: 'UPDATE_OPTION_LIST', payload: filteredOptions });
188
+ dispatch({ type: 'UPDATE_OPTION', payload: value });
189
+ };
190
+
191
+ const onSelectBlur = () => {
192
+ if (disabled) return;
193
+
194
+ if (errorMsg) {
195
+ handleSelectAction('SHOW_ERROR');
196
+ } else {
197
+ handleSelectAction('BLUR_INPUT');
198
+ }
199
+ };
200
+
201
+ const onSelectOptionSelector = (option: Option) => {
202
+ if (!disabled) {
203
+ onSelectBlur();
204
+ dispatch({ type: 'UPDATE_OPTION', payload: option.projectId });
205
+ if (onChange) {
206
+ onChange(option);
207
+ }
208
+ }
209
+ };
210
+
211
+ const onSelectUpdatePosition = () => {
212
+ if (!showOptions || !DropDownRef?.current || disabled) return;
213
+ const { positionX, positionY, width, fromBottom } =
214
+ calculatePosition(DropDownRef);
215
+ dispatch({
216
+ type: 'UPDATE_DROPDOWN_POSITION',
217
+ payload: { positionX, positionY, width, fromBottom },
218
+ });
219
+ };
220
+
221
+ const onSelectToggleScroll = (isEnabled: boolean) => {
222
+ const bodyScrollWidth = window.innerWidth - document.body.clientWidth;
223
+ document.body.style.paddingRight = isEnabled ? '' : `${bodyScrollWidth}px`;
224
+ document.body.style.overflow = isEnabled ? '' : 'hidden';
225
+ };
226
+
227
+ useEffect(() => {
228
+ if (disabled) return;
229
+ if (showOptions) {
230
+ onSelectToggleScroll(!showOptions);
231
+ }
232
+ onSelectUpdatePosition();
233
+
234
+ const handleResizeOrScroll = () => onSelectUpdatePosition();
235
+
236
+ window.addEventListener('resize', handleResizeOrScroll);
237
+ window.addEventListener('scroll', handleResizeOrScroll);
238
+ return () => {
239
+ onSelectToggleScroll(true);
240
+ window.removeEventListener('resize', handleResizeOrScroll);
241
+ window.removeEventListener('scroll', handleResizeOrScroll);
242
+ };
243
+ }, [showOptions]);
244
+
245
+ useEffect(() => {
246
+ if (errorMsg) {
247
+ handleSelectAction('SHOW_ERROR');
248
+ }
249
+ }, []);
250
+
251
+ const applyActiveOptionClasses = !isInputFocused && Boolean(option);
252
+
253
+ return (
254
+ <div className={classNames(`ff-nlp-input-wrapper ${className}`)}>
255
+ <div className="ff-nlp-input">
256
+ <input
257
+ type="text"
258
+ className={classNames('ff-nlp-input-input', {
259
+ 'ff-nlp-input-input--default': !isInputFocused,
260
+ 'ff-nlp-input-input--active': applyActiveOptionClasses,
261
+ 'ff-nlp-input-input--no-label': !showLabel,
262
+ 'ff-nlp-input-input--error':
263
+ errorMsg && !isInputFocused && !Boolean(option),
264
+ 'ff-nlp-input-input--border-radius': !borderRadius,
265
+ 'ff-nlp-input-input--disable': disabled,
266
+ 'ff-nlp-input-input--no-border': !showBorder,
267
+ })}
268
+ // inline css required due to multiple overlay scenarios are present
269
+ style={{ zIndex: optionZIndex }}
270
+ onFocus={() => handleSelectAction('FOCUS_INPUT')}
271
+ onMouseEnter={() => handleSelectAction('MOUSE_ENTER')}
272
+ onMouseLeave={() => handleSelectAction('MOUSE_LEAVE')}
273
+ onChange={onSelectInputChange}
274
+ value={option}
275
+ disabled={disabled}
276
+ autoComplete="off"
277
+ spellCheck="false"
278
+ ref={InputRef}
279
+ />
280
+
281
+ {showLabel && (
282
+ <div
283
+ className={classNames('ff-nlp-input-label', {
284
+ 'ff-nlp-input-label--default': !isInputFocused,
285
+ 'ff-nlp-input-label--active': isInputFocused || Boolean(option),
286
+ 'ff-nlp-input-label--error': errorMsg,
287
+ })}
288
+ >
289
+ {required && (
290
+ <Typography
291
+ color="var(--$error-light)"
292
+ className="ff-nlp-input-label--required"
293
+ >
294
+ *
295
+ </Typography>
296
+ )}
297
+ {label}
298
+ </div>
299
+ )}
300
+
301
+ <Icon
302
+ name="arrow_up"
303
+ height={7}
304
+ width={12}
305
+ className={classNames('ff-nlp-input-arrow', {
306
+ 'ff-nlp-input-arrow--down': isIconClick,
307
+ 'ff-nlp-input-arrow--no-label': !showLabel,
308
+ })}
309
+ color={iconColor}
310
+ />
311
+ <fieldset
312
+ className={classNames('ff-nlp-input-fieldset', {
313
+ 'ff-nlp-input-fieldset--no-label': !showLabel,
314
+ 'ff-nlp-input-fieldset--default': !isInputFocused,
315
+ 'ff-nlp-input-fieldset--active': isInputFocused,
316
+ 'ff-nlp-input-fieldset--option': applyActiveOptionClasses,
317
+ 'ff-nlp-input-fieldset--error': errorMsg,
318
+ 'ff-nlp-input-fieldset--border-radius': !borderRadius,
319
+ 'ff-nlp-input-fieldset--no-border': !showBorder,
320
+ })}
321
+ >
322
+ {/* {showLabel && (
323
+ <legend
324
+ className={classNames('ff-nlp-input-legend', {
325
+ 'ff-nlp-input-legend--default': !isInputFocused,
326
+ 'ff-nlp-input-legend--active': isInputFocused,
327
+ 'ff-nlp-input-legend--option': applyActiveOptionClasses,
328
+ 'ff-nlp-input-legend--error': errorMsg,
329
+ })}
330
+ >
331
+ {required && (
332
+ <Typography
333
+ fontSize={8}
334
+ color={'var(--$error-light)'}
335
+ className="ff-nlp-input-legend--required"
336
+ >
337
+ *
338
+ </Typography>
339
+ )}
340
+ {label}
341
+ </legend>
342
+ )} */}
343
+ </fieldset>
344
+ </div>
345
+
346
+ {errorMsg && (
347
+ <Typography
348
+ className="ff-nlp-input-wrapper-error-text"
349
+ fontSize={8}
350
+ color={'var(--error-light)'}
351
+ >
352
+ {errorMsg}
353
+ </Typography>
354
+ )}
355
+
356
+ <div ref={DropDownRef}>
357
+ {showOptions &&
358
+ createPortal(
359
+ <Dropdown
360
+ onSelectBlur={onSelectBlur}
361
+ onSelectOptionSelector={onSelectOptionSelector}
362
+ dropdownPosition={dropdownPosition}
363
+ options={options}
364
+ optionZIndex={optionZIndex}
365
+ inputRef={InputRef}
366
+ />,
367
+ document.body
368
+ )}
369
+ </div>
370
+ </div>
371
+ );
372
+ };
373
+
374
+ export default NlpInput;
@@ -0,0 +1,60 @@
1
+ import { DrowdownPosition, Option } from '../../type';
2
+
3
+ export interface NlpDropDownListProps {
4
+ /*
5
+ * Callback function triggered on blur event
6
+ */
7
+ onSelectBlur: () => void;
8
+
9
+ /*
10
+ * Callback function triggered when an option is selected
11
+ */
12
+ onSelectOptionSelector: (option: Option) => void;
13
+
14
+ /*
15
+ * Position of the dropdown relative to the input
16
+ */
17
+ dropdownPosition: DrowdownPosition;
18
+
19
+ /*
20
+ * List of options to display in the dropdown
21
+ */
22
+ options?: Option[];
23
+
24
+ /*
25
+ * Optional z-index for controlling the dropdown's stacking order
26
+ */
27
+ optionZIndex?: number;
28
+
29
+ /*
30
+ * Reference to the input element
31
+ */
32
+ inputRef?: React.RefObject<HTMLInputElement>;
33
+
34
+ /*
35
+ * Optional label for the dropdown
36
+ */
37
+ label?: string;
38
+
39
+ /*
40
+ * If true, shows an error message related to the dropdown
41
+ */
42
+ hasError?: boolean;
43
+
44
+ /*
45
+ * Error message to display when hasError is true
46
+ */
47
+ errorMessage?: string;
48
+
49
+ /*
50
+ * If true, disables the dropdown
51
+ */
52
+ disabled?: boolean;
53
+ }
54
+
55
+ export const nlpDropdownDefaultCSSData = {
56
+ margin: 6,
57
+ optionHeight: 32,
58
+ selectInputHeight: 38,
59
+ dropDownWrapperPadding: 0,
60
+ };
@@ -0,0 +1,83 @@
1
+ @use '../../../../assets/styles/fonts';
2
+
3
+ @mixin absolute-position($top: auto, $right: auto, $bottom: auto, $left: auto) {
4
+ position: absolute;
5
+ top: $top;
6
+ right: $right;
7
+ bottom: $bottom;
8
+ left: $left;
9
+ }
10
+
11
+ .ff-nlp-dropdown-wrapper {
12
+ .ff-nlp-options-wrapper {
13
+ max-height: 160px;
14
+ z-index: 100;
15
+ position: absolute;
16
+ min-width: 100px;
17
+ border: 1px solid var(--ff-select-option-border-color);
18
+ box-sizing: border-box;
19
+ margin-top: 4px;
20
+ border-radius: 4px;
21
+ background-color: var(--ff-select-background-color);
22
+ box-shadow: 0px 1px 4px 0px var(--ff-select-option-wrapper-box-shadow);
23
+ overflow: hidden auto;
24
+ display: flex;
25
+ justify-content: space-between;
26
+
27
+ .ff-nlp-options-wrapper1 {
28
+ max-height: 160px;
29
+ z-index: 100;
30
+ min-width: auto;
31
+ box-sizing: border-box;
32
+ }
33
+ &::-webkit-scrollbar {
34
+ width: 4px;
35
+ height: 12px;
36
+
37
+ &-thumb {
38
+ background-color: var(--ff-select-scroll-thumb-color);
39
+ border-radius: 4px;
40
+ }
41
+
42
+ &-track {
43
+ background-color: transparent;
44
+ border-radius: 4px;
45
+ }
46
+ }
47
+
48
+ .ff-nlp-option {
49
+ width: calc(100% - 18px);
50
+ border: 1px solid transparent;
51
+ border-radius: 4px;
52
+ padding: 0px 8px;
53
+ overflow: hidden;
54
+ white-space: nowrap;
55
+ text-overflow: ellipsis;
56
+ cursor: pointer;
57
+
58
+ &:hover {
59
+ border-color: var(--ff-select-background-color);
60
+ background-color: var(--ff-select-option-hover-color);
61
+ }
62
+ }
63
+
64
+ .ff-nlp-no-option {
65
+ width: calc(100% - 16px);
66
+ margin: 0;
67
+ overflow: hidden;
68
+ padding: 0px 8px;
69
+ white-space: nowrap;
70
+ text-overflow: ellipsis;
71
+ cursor: not-allowed;
72
+ }
73
+ }
74
+ .ff-nlp-data {
75
+ width: 200px;
76
+ height: 134px;
77
+
78
+ border: 1px solid transparent;
79
+ border-radius: 5px;
80
+ box-shadow: 0px 1px 4px 0px var(--ff-select-option-wrapper-box-shadow);
81
+ overflow: scroll;
82
+ }
83
+ }
@@ -0,0 +1,180 @@
1
+ import { ReactNode, useContext, useRef, useState } from 'react';
2
+ import {
3
+ NlpDropDownListProps,
4
+ nlpDropdownDefaultCSSData,
5
+ } from './NlpDropDownType';
6
+ import useClickOutside from '../../../../hooks/useClickOutside';
7
+ import { checkEmpty } from '../../../../utils/checkEmpty/checkEmpty';
8
+ import './NlpDropdown.scss';
9
+ import Typography from '../../../Typography';
10
+ import ffid from '../../../../utils/ffID/ffid';
11
+ import { ThemeContext } from '../../../ThemeProvider/ThemeProvider';
12
+ import classNames from 'classnames';
13
+
14
+ type OptionType = {
15
+ label: ReactNode;
16
+ value: string;
17
+ displayName?: string;
18
+ description?: string;
19
+ nlpType?: string;
20
+ path?: string;
21
+ stepInputs?: { type?: string; name?: string }[];
22
+ returnType?: string;
23
+ };
24
+
25
+ const NlpDropdown = ({
26
+ onSelectBlur,
27
+ onSelectOptionSelector,
28
+ dropdownPosition,
29
+ options = [],
30
+ optionZIndex = 100,
31
+ inputRef,
32
+ }: NlpDropDownListProps) => {
33
+ // const [nlpData, setNlpData] = useState<OptionType | null>(null); need to add setNlpData
34
+ const [nlpData] = useState<OptionType | null>(null);
35
+ const themeContext = useContext(ThemeContext);
36
+ const currentTheme = themeContext?.currentTheme;
37
+ const optionsWrapperRef = useRef<HTMLDivElement>(null);
38
+ useClickOutside(optionsWrapperRef, onSelectBlur, [inputRef]);
39
+
40
+ const { positionX, positionY, width, fromBottom } = dropdownPosition;
41
+ const { margin, optionHeight, selectInputHeight, dropDownWrapperPadding } =
42
+ nlpDropdownDefaultCSSData;
43
+
44
+ const updateDropdownPosition = () => {
45
+ let dropdownContainerHeight;
46
+
47
+ if (checkEmpty(options)) {
48
+ dropdownContainerHeight = optionHeight + 2 * dropDownWrapperPadding;
49
+ } else if (options.length > 5) {
50
+ dropdownContainerHeight = 5 * optionHeight + 2 * dropDownWrapperPadding;
51
+ } else {
52
+ dropdownContainerHeight =
53
+ options.length * optionHeight + 2 * dropDownWrapperPadding;
54
+ }
55
+
56
+ if (fromBottom > dropdownContainerHeight + margin) {
57
+ return {
58
+ left: positionX,
59
+ top: positionY,
60
+ width: width,
61
+ zIndex: optionZIndex,
62
+ };
63
+ }
64
+ return {
65
+ zIndex: optionZIndex,
66
+ left: positionX,
67
+ width: width,
68
+ top: positionY - selectInputHeight - dropdownContainerHeight - margin,
69
+ };
70
+ };
71
+
72
+ return (
73
+ <div className="ff-nlp-dropdown-wrapper">
74
+ <div
75
+ ref={optionsWrapperRef}
76
+ style={updateDropdownPosition()}
77
+ className={classNames('ff-nlp-options-wrapper', currentTheme)}
78
+ >
79
+ <div className="ff-nlp-options-wrapper1">
80
+ {!checkEmpty(options) ? (
81
+ options.map((option) => (
82
+ // <div key={ffid()} onMouseEnter={() => setNlpData(option)}> need to add onMouseEnter
83
+ <div key={ffid()}>
84
+ <Typography
85
+ as="div"
86
+ lineHeight="30px"
87
+ className={classNames('ff-nlp-option', currentTheme)}
88
+ color="var(--ff-nlp-text-color)"
89
+ onClick={() => onSelectOptionSelector(option)}
90
+ >
91
+ <span className="mr-2 fontPoppinsRegularMd">
92
+ {option?.nlpType === 'NLP' ? (
93
+ <b className="nlp-type-NLP">NLP</b>
94
+ ) : option?.nlpType === 'STEP_GROUP' ? (
95
+ <b className="nlp-type-step-group">SG</b>
96
+ ) : option?.nlpType === 'PROGRAM_ELEMENTS' ? (
97
+ <b className="nlp-type-program-elements">PE</b>
98
+ ) : (
99
+ '--'
100
+ )}
101
+ </span>
102
+ <span className="mr-2 fontPoppinsRegularMd">
103
+ {option?.platform === 'web' ? (
104
+ <b className="platform-web">Web</b>
105
+ ) : option?.platform === 'android' ? (
106
+ <b className="platform-android">Android</b>
107
+ ) : option?.platform === 'ios' ? (
108
+ <b className="platform-ios">iOS</b>
109
+ ) : option?.platform === 'Generic' ? (
110
+ <b className="platform-ios">Generic</b>
111
+ ) : (
112
+ '--'
113
+ )}
114
+ </span>
115
+ {option?.displayName}
116
+ </Typography>
117
+ </div>
118
+ ))
119
+ ) : (
120
+ <Typography
121
+ textAlign="center"
122
+ lineHeight="32px"
123
+ as="p"
124
+ color="var(--ff-nlp-text-color)"
125
+ className="ff-nlp-no-option"
126
+ >
127
+ No Results Found
128
+ </Typography>
129
+ )}
130
+ <button>+ Web Services</button>
131
+ </div>
132
+ <div className="ff-nlp-data">
133
+ <div>
134
+ <div className="nlp-details-header mt-4">Name:</div>
135
+ <div className="nlp-details nlpdiv-check">
136
+ {nlpData?.displayName || '--'}
137
+ </div>
138
+ <div className="nlp-details-header mt-4">Description:</div>
139
+ <div className="nlp-details nlpdiv-check">
140
+ {nlpData?.description || '--'}
141
+ </div>
142
+ {nlpData?.nlpType === 'STEP_GROUP' && (
143
+ <>
144
+ <div className="nlp-details-header mt-4">Path:</div>
145
+ <div className="nlp-details nlpdiv-check">
146
+ {nlpData?.path ? nlpData?.path.slice(6) : '--'}
147
+ </div>
148
+ </>
149
+ )}
150
+ <div className="nlp-details-header mt-4">Inputs:</div>
151
+ {nlpData?.stepInputs?.length ? (
152
+ nlpData.stepInputs.map((stepInput, index) => {
153
+ const stepInputType = stepInput.type
154
+ ? stepInput.type.split('.').pop()
155
+ : '--';
156
+ return (
157
+ <div key={index}>
158
+ <div className="nlp-details-header">Input{index + 1}:</div>
159
+ <div className="nlp-details">type: {stepInputType}</div>
160
+ <div className="nlp-details mb-4">
161
+ name: {stepInput.name || '--'}
162
+ </div>
163
+ </div>
164
+ );
165
+ })
166
+ ) : (
167
+ <div className="nlp-details mb-4">--</div>
168
+ )}
169
+ <div className="nlp-details-header">Output:</div>
170
+ <div className="nlp-details mb-4">
171
+ {nlpData?.returnType || '--'}
172
+ </div>
173
+ </div>
174
+ </div>
175
+ </div>
176
+ </div>
177
+ );
178
+ };
179
+
180
+ export default NlpDropdown;
@@ -0,0 +1 @@
1
+ export { default } from './NlpInput';