pixel-react 1.4.4 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/Editor/Editor.d.ts +1 -2
  3. package/lib/components/Editor/types.d.ts +1 -5
  4. package/lib/components/MachineInputField/types.d.ts +1 -0
  5. package/lib/components/SequentialConnectingBranch/SequentialConnectingBranch.d.ts +1 -1
  6. package/lib/components/SequentialConnectingBranch/types.d.ts +7 -4
  7. package/lib/index.d.ts +44 -17
  8. package/lib/index.esm.js +5214 -613
  9. package/lib/index.esm.js.map +1 -1
  10. package/lib/index.js +5214 -612
  11. package/lib/index.js.map +1 -1
  12. package/lib/utils/getSequentialPayload/getSequentialPayload.d.ts +2 -2
  13. package/lib/utils/getSequentialPayload/types.d.ts +2 -4
  14. package/package.json +2 -2
  15. package/src/assets/icons/add_file.svg +4 -13
  16. package/src/assets/icons/eye_open_icon.svg +10 -0
  17. package/src/assets/icons/windows.svg +8 -4
  18. package/src/components/Checkbox/Checkbox.scss +1 -1
  19. package/src/components/Editor/Editor.tsx +224 -191
  20. package/src/components/Editor/types.ts +1 -5
  21. package/src/components/Icon/iconList.ts +2 -0
  22. package/src/components/MachineInputField/MachineInputField.scss +4 -2
  23. package/src/components/MachineInputField/MachineInputField.tsx +2 -0
  24. package/src/components/MachineInputField/types.ts +1 -0
  25. package/src/components/MenuOption/MenuOption.tsx +3 -4
  26. package/src/components/MultiSelect/MultiSelect.scss +50 -45
  27. package/src/components/MultiSelect/MultiSelect.tsx +1 -1
  28. package/src/components/Select/components/Dropdown.tsx +22 -8
  29. package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.scss +34 -32
  30. package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.stories.tsx +34 -40
  31. package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +27 -100
  32. package/src/components/SequentialConnectingBranch/components/Branches/Branches.scss +5 -5
  33. package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +5 -3
  34. package/src/components/SequentialConnectingBranch/types.ts +7 -4
  35. package/src/components/Tooltip/Tooltip.scss +1 -0
  36. package/src/components/Tooltip/Tooltip.tsx +1 -2
  37. package/src/index.ts +3 -1
  38. package/src/utils/getSequentialPayload/getSequentialPayload.stories.tsx +2 -5
  39. package/src/utils/getSequentialPayload/getSequentialPayload.ts +11 -24
  40. package/src/utils/getSequentialPayload/types.ts +3 -6
@@ -1,2 +1,2 @@
1
- import { SequentialMachineInstance, MachineExecutionInstanceDataSet } from './types';
2
- export declare const getSequentialPayload: (machineInstances?: MachineExecutionInstanceDataSet[]) => SequentialMachineInstance[];
1
+ import { MachineExecutionInstance, SequentialMachineInstance } from './types';
2
+ export declare const getSequentialPayload: (data: MachineExecutionInstance[]) => SequentialMachineInstance[];
@@ -18,12 +18,10 @@ export interface MachineExecutionInstance {
18
18
  systemUrl: string;
19
19
  machineInfo: OperatingSystemInfo;
20
20
  deviceInfo: any[];
21
- headless: boolean;
22
- }
23
- export interface MachineExecutionInstanceDataSet extends MachineExecutionInstance {
24
21
  runLevelExecutionDataSets: RunLevelExecutionDataSet[];
22
+ headless: boolean;
25
23
  }
26
- export interface SequentialMachineInstance extends MachineExecutionInstance {
24
+ export interface SequentialMachineInstance extends Omit<MachineExecutionInstance, 'runLevelExecutionDataSets'> {
27
25
  peVariableSetId: string;
28
26
  globalVariableSetId: string;
29
27
  testDataSetId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.4.4",
4
+ "version": "1.4.6",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  "@storybook/react": "^8.4.5",
27
27
  "@storybook/react-vite": "^8.4.5",
28
28
  "@storybook/test": "^8.4.5",
29
+ "@types/js-beautify": "^1.14.3",
29
30
  "@types/react": "^18.3.12",
30
31
  "@types/react-dom": "^18.3.1",
31
32
  "@types/react-google-recaptcha": "^2.1.9",
@@ -66,7 +67,6 @@
66
67
  "date-fns-tz": "^3.2.0",
67
68
  "js-beautify": "^1.15.1",
68
69
  "jsencrypt": "^3.3.2",
69
- "prettier": "^3.3.3",
70
70
  "react-archer": "^4.4.0",
71
71
  "react-day-picker": "^9.2.1",
72
72
  "react-google-recaptcha": "^3.1.0",
@@ -1,14 +1,5 @@
1
- <svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g clip-path="url(#clip0_911_11481)">
3
- <path fill-rule="evenodd" clip-rule="evenodd"
4
- d="M19.1307 13.4822C19.6597 13.4822 20.0885 13.0534 20.0885 12.5243C20.0885 11.9953 19.6597 11.5665 19.1307 11.5665L12.9579 11.5665L12.9579 5.39368C12.9579 4.86467 12.529 4.43582 12 4.43582C11.471 4.43582 11.0421 4.86467 11.0421 5.39368L11.0421 11.5665L4.86934 11.5665C4.34033 11.5665 3.91148 11.9953 3.91148 12.5243C3.91148 13.0534 4.34032 13.4822 4.86934 13.4822L11.0421 13.4822V19.655C11.0421 20.184 11.471 20.6129 12 20.6129C12.529 20.6129 12.9579 20.184 12.9579 19.655V13.4822L19.1307 13.4822Z"
5
- fill="currentColor" />
6
- </g>
7
- <defs>
8
- <clipPath id="clip0_911_11481">
9
- <path
10
- d="M0 4.52441C0 2.31528 1.79086 0.524414 4 0.524414H20C22.2091 0.524414 24 2.31528 24 4.52441V20.5244C24 22.7336 22.2091 24.5244 20 24.5244H4C1.79086 24.5244 0 22.7336 0 20.5244V4.52441Z"
11
- fill="currentColor" />
12
- </clipPath>
13
- </defs>
1
+ <svg width="16" height="16" viewBox="0 0 18 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd"
3
+ d="M16.1307 9.4822C16.6597 9.4822 17.0885 9.05336 17.0885 8.52434C17.0885 7.99533 16.6597 7.56648 16.1307 7.56648L9.95786 7.56648L9.95786 1.39368C9.95786 0.864669 9.52901 0.435821 9 0.435821C8.47099 0.435821 8.04214 0.864669 8.04214 1.39368L8.04214 7.56648L1.86934 7.56648C1.34033 7.56648 0.911477 7.99533 0.911477 8.52434C0.911477 9.05336 1.34032 9.4822 1.86934 9.4822L8.04214 9.4822V15.655C8.04214 16.184 8.47099 16.6129 9 16.6129C9.52901 16.6129 9.95786 16.184 9.95786 15.655V9.4822L16.1307 9.4822Z"
4
+ fill="currentColor" />
14
5
  </svg>
@@ -0,0 +1,10 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_2947_11191)">
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M18.8985 12.297C17.5046 14.8002 14.861 16.3552 12.0009 16.3552C9.13896 16.3552 6.49546 14.8002 5.10149 12.297C4.99413 12.1026 4.99413 11.8972 5.10149 11.703C6.49546 9.19978 9.13896 7.64494 12.0009 7.64494C14.861 7.64494 17.5045 9.19978 18.8985 11.703C19.0078 11.8972 19.0078 12.1026 18.8985 12.297ZM19.789 11.2067C18.2154 8.38043 15.2313 6.62494 12.0009 6.62494C8.76871 6.62494 5.78457 8.38043 4.21104 11.2067C3.92965 11.7109 3.92965 12.2891 4.21104 12.7929C5.78457 15.6192 8.76871 17.375 12.0009 17.375C15.2313 17.375 18.2154 15.6192 19.789 12.7929C20.0703 12.2891 20.0703 11.7109 19.789 11.2067ZM12.0009 14.0923C13.1542 14.0923 14.0928 13.1538 14.0928 11.9999C14.0928 10.8461 13.1542 9.9075 12.0009 9.9075C10.8458 9.9075 9.9072 10.8461 9.9072 11.9999C9.9072 13.1538 10.8458 14.0923 12.0009 14.0923ZM12.0009 8.88749C10.283 8.88749 8.8872 10.2839 8.8872 11.9999C8.8872 13.7164 10.283 15.1122 12.0009 15.1122C13.717 15.1122 15.1128 13.7164 15.1128 11.9999C15.1128 10.2839 13.717 8.88749 12.0009 8.88749Z" fill="currentColor"/>
4
+ </g>
5
+ <defs>
6
+ <clipPath id="clip0_2947_11191">
7
+ <path d="M0 4C0 1.79086 1.79086 0 4 0H20C22.2091 0 24 1.79086 24 4V20C24 22.2091 22.2091 24 20 24H4C1.79086 24 0 22.2091 0 20V4Z" fill="white"/>
8
+ </clipPath>
9
+ </defs>
10
+ </svg>
@@ -1,6 +1,10 @@
1
1
  <svg width="12" height="14" viewBox="0 0 12 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M4.80888 12.0185L0.114433 11.3751L0.00422248 11.36L0.00421445 11.2489L0.00396729 7.39195V7.26428H0.131141H4.82583H4.95351V7.39195V11.8924V12.0384L4.80888 12.0185Z" fill="#00ADEF"/>
3
- <path d="M12.0003 7.39195L11.9987 12.8732V13.0197L11.8541 12.9993L5.59136 12.1182L5.48114 12.1028V11.9921V7.39195V7.26428H5.60882H11.8731H12.0003V7.39195Z" fill="#00ADEF"/>
4
- <path d="M5.59086 1.91281L11.8536 1.00154L11.9993 0.980347V1.12771V6.60891V6.73658H11.8715H5.60882H5.48114V6.60891V2.03899V1.92879L5.59086 1.91281Z" fill="#00ADEF"/>
5
- <path d="M0.00418431 6.60893L-0.000124334 2.79077L-0.000244141 2.67959L0.110094 2.6646L4.80836 2.02659L4.95299 2.00696V2.15276V6.60893V6.7366H4.82531H0.131358H0.00433601L0.00418431 6.60893Z" fill="#00ADEF"/>
2
+ <path d="M4.80888 12.0185L0.114433 11.3751L0.00422248 11.36L0.00421445 11.2489L0.00396729 7.39195V7.26428H0.131141H4.82583H4.95351V7.39195V11.8924V12.0384L4.80888 12.0185Z"
3
+ fill="currentColor"/>
4
+ <path d="M12.0003 7.39195L11.9987 12.8732V13.0197L11.8541 12.9993L5.59136 12.1182L5.48114 12.1028V11.9921V7.39195V7.26428H5.60882H11.8731H12.0003V7.39195Z"
5
+ fill="currentColor"/>
6
+ <path d="M5.59086 1.91281L11.8536 1.00154L11.9993 0.980347V1.12771V6.60891V6.73658H11.8715H5.60882H5.48114V6.60891V2.03899V1.92879L5.59086 1.91281Z"
7
+ fill="currentColor"/>
8
+ <path d="M0.00418431 6.60893L-0.000124334 2.79077L-0.000244141 2.67959L0.110094 2.6646L4.80836 2.02659L4.95299 2.00696V2.15276V6.60893V6.7366H4.82531H0.131358H0.00433601L0.00418431 6.60893Z"
9
+ fill="currentColor"/>
6
10
  </svg>
@@ -14,7 +14,7 @@
14
14
  @include mixins.box(16px, 1px solid var(--checkbox-border-color));
15
15
  box-sizing: border-box;
16
16
  border-radius: 2px;
17
- margin-right: 8px;
17
+ margin-right: 4px;
18
18
  background-color: var(--checkbox-bg-color);
19
19
  position: relative;
20
20
  @include mixins.center-content;
@@ -1,215 +1,248 @@
1
- import React, { useRef, useState, useEffect } from 'react';
2
- import MonacoEditor, { OnMount } from '@monaco-editor/react';
3
1
  import {
4
- dropdownPositionType,
5
- EditorProps,
6
- option,
7
- DyanamicObj,
8
- } from './types';
9
- import Icon from '../Icon';
2
+ useRef,
3
+ useState,
4
+ useEffect,
5
+ forwardRef,
6
+ useImperativeHandle,
7
+ } from 'react';
8
+ import MonacoEditor, { OnMount } from '@monaco-editor/react';
9
+ import { js as beautifyJS, html as beautifyHTML } from 'js-beautify';
10
+ import { dropdownPositionType, EditorProps, DyanamicObj } from './types';
10
11
  import './Editor.scss';
11
- import Select from '../Select';
12
- import Button from '../Button';
13
12
  import VariableDropdown from './VariableDropdown';
14
- import Drawer from '../Drawer';
15
- import FileDropzone from '../FileDropzone';
16
- import Tooltip from '../Tooltip';
17
- import { optionsList } from './constants';
18
13
 
19
- const Editor: React.FC<EditorProps> = ({
20
- width,
21
- height,
22
- showToolbar,
23
- readOnly,
24
- value = '',
25
- handleChange,
26
- setValue,
27
- variableOptionsList = [],
28
- language = 'javascript',
29
- theme = 'light',
30
- }) => {
31
- const editorRef = useRef<Parameters<OnMount>[0] | null>(null);
32
- const decorationsRef = useRef<string[]>([]);
33
- const [contentType, setContentType] = useState<string>(language);
34
- const [currentLine, setCurrentLine] = useState<number>(0);
35
- const [showDropdown, setShowDropdown] = useState<boolean>(false);
36
- const [showDrawer, setShowDrawer] = useState<boolean>(false);
37
- const [selectedOption, setSelectedOption] = useState<option>({
38
- label: 'JSON',
39
- value: 'json',
40
- });
41
- const [dropdownPosition, setDropdownPosition] =
42
- useState<dropdownPositionType>({ top: 0, left: 0 });
14
+ const Editor = forwardRef<any, EditorProps>(
15
+ (
16
+ {
17
+ width,
18
+ height,
19
+ readOnly,
20
+ value = '',
21
+ handleChange,
22
+ setValue,
23
+ variableOptionsList = [],
24
+ language = 'json',
25
+ theme = 'light',
26
+ },
27
+ ref
28
+ ) => {
29
+ const editorRef = useRef<Parameters<OnMount>[0] | null>(null);
30
+ const decorationsRef = useRef<string[]>([]);
31
+ const [currentLine, setCurrentLine] = useState<number>(0);
32
+ const [showDropdown, setShowDropdown] = useState<boolean>(false);
33
+ const [dropdownPosition, setDropdownPosition] =
34
+ useState<dropdownPositionType>({ top: 0, left: 0 });
43
35
 
44
- const handleEditorDidMount: OnMount = (editor: any) => {
45
- editorRef.current = editor;
36
+ const handleEditorDidMount: OnMount = (editor: any) => {
37
+ editorRef.current = editor;
46
38
 
47
- editor.onDidChangeCursorPosition((e: any) => {
48
- setCurrentLine(e.position.lineNumber);
49
- });
39
+ editor.onDidChangeCursorPosition((e: any) => {
40
+ setCurrentLine(e.position.lineNumber);
41
+ });
50
42
 
51
- editor.onDidChangeModelContent(() => {
52
- const content = editor.getValue();
53
- setValue(content);
43
+ editor.onDidChangeModelContent(() => {
44
+ const content = editor.getValue();
45
+ setValue(content);
54
46
 
55
- const position = editor.getPosition();
56
- const model = editor.getModel();
57
- if (position && model) {
58
- const currentLineContent = model.getLineContent(position.lineNumber);
59
- if (currentLineContent[position.column - 2] === '$') {
60
- const visiblePosition = editor.getScrolledVisiblePosition(position);
61
- if (visiblePosition) {
62
- setDropdownPosition({
63
- top: visiblePosition.top,
64
- left: visiblePosition.left,
65
- });
66
- setShowDropdown(true);
47
+ const position = editor.getPosition();
48
+ const model = editor.getModel();
49
+ if (position && model) {
50
+ const currentLineContent = model.getLineContent(position.lineNumber);
51
+ if (currentLineContent[position.column - 2] === '$') {
52
+ const visiblePosition = editor.getScrolledVisiblePosition(position);
53
+ if (visiblePosition) {
54
+ setDropdownPosition({
55
+ top: visiblePosition.top,
56
+ left: visiblePosition.left,
57
+ });
58
+ setShowDropdown(true);
59
+ }
60
+ } else {
61
+ setShowDropdown(false);
67
62
  }
68
- } else {
69
- setShowDropdown(false);
70
63
  }
71
- }
72
- });
73
- };
64
+ });
65
+ };
74
66
 
75
- useEffect(() => {
76
- if (editorRef.current && currentLine) {
77
- // Define decoration for the current line
78
- const decorations = [
79
- {
80
- range: {
81
- startLineNumber: currentLine,
82
- startColumn: 1,
83
- endLineNumber: currentLine,
84
- endColumn: 1,
85
- },
86
- options: {
87
- isWholeLine: true,
88
- className: 'current-line-background', // Custom CSS class for background color
67
+ useEffect(() => {
68
+ if (editorRef.current && currentLine) {
69
+ const decorations = [
70
+ {
71
+ range: {
72
+ startLineNumber: currentLine,
73
+ startColumn: 1,
74
+ endLineNumber: currentLine,
75
+ endColumn: 1,
76
+ },
77
+ options: {
78
+ isWholeLine: true,
79
+ className: 'current-line-background',
80
+ },
89
81
  },
90
- },
91
- ];
92
-
93
- // Apply decorations
94
- decorationsRef.current = editorRef.current.deltaDecorations(
95
- decorationsRef.current,
96
- decorations
97
- );
98
- }
99
- }, [currentLine]);
82
+ ];
100
83
 
101
- const handleBeautify = () => {
102
- let beautifiedContent = value;
103
- if (contentType === 'json') {
104
- try {
105
- beautifiedContent = JSON.stringify(JSON.parse(value), null, 2);
106
- } catch (e) {
107
- alert('Invalid JSON format');
84
+ decorationsRef.current = editorRef.current.deltaDecorations(
85
+ decorationsRef.current,
86
+ decorations
87
+ );
108
88
  }
109
- }
110
- setValue(beautifiedContent);
111
- };
89
+ }, [currentLine]);
112
90
 
113
- const handleSelectSuggestion = (suggestion: string, type: string) => {
114
- if (editorRef.current) {
115
- const editor = editorRef.current;
116
- const position = editor.getPosition();
117
- if (position) {
118
- editor.executeEdits('', [
119
- {
120
- range: {
121
- startLineNumber: position.lineNumber,
122
- startColumn: position.column,
123
- endLineNumber: position.lineNumber,
124
- endColumn: position.column,
91
+ const handleSelectSuggestion = (suggestion: string, type: string) => {
92
+ if (editorRef.current) {
93
+ const editor = editorRef.current;
94
+ const position = editor.getPosition();
95
+ if (position) {
96
+ editor.executeEdits('', [
97
+ {
98
+ range: {
99
+ startLineNumber: position.lineNumber,
100
+ startColumn: position.column,
101
+ endLineNumber: position.lineNumber,
102
+ endColumn: position.column,
103
+ },
104
+ text: `{${type}_${suggestion}}`,
125
105
  },
126
- text: `{${type}_${suggestion}}`,
127
- },
128
- ]);
129
- setShowDropdown(false);
106
+ ]);
107
+ setShowDropdown(false);
108
+ }
130
109
  }
131
- }
132
- };
110
+ };
133
111
 
134
- const handleFileUpload = () => {
135
- setShowDrawer(true);
136
- };
112
+ const handleSelectVariable = (option: DyanamicObj) => {
113
+ handleSelectSuggestion(
114
+ option?.name,
115
+ option?.type === 'GLOBAL'
116
+ ? 'GV'
117
+ : option?.type === 'LOCAL'
118
+ ? 'LV'
119
+ : 'PEV'
120
+ );
121
+ };
137
122
 
138
- const onDropdownChangeHandler = (option: option) => {
139
- setContentType(option.value);
140
- setSelectedOption(option);
141
- };
123
+ const mapLanguageToContentType = (language: string | undefined): string => {
124
+ switch (language) {
125
+ case 'javascript':
126
+ case 'typescript':
127
+ return 'javascript';
128
+ case 'json':
129
+ return 'json';
130
+ case 'html':
131
+ return 'html';
132
+ case 'xml':
133
+ return 'xml';
134
+ default:
135
+ return 'plain text';
136
+ }
137
+ };
142
138
 
143
- const handleSelectVariable = (option: DyanamicObj) => {
144
- handleSelectSuggestion(
145
- option?.name,
146
- option?.type === 'GLOBAL' ? 'GV' : option?.type === 'LOCAL' ? 'LV' : 'PEV'
147
- );
148
- };
139
+ const beautifyContent = (content: string, language: string): string => {
140
+ switch (language) {
141
+ case 'json':
142
+ return beautifyJS(content, {
143
+ indent_size: 4,
144
+ indent_char: ' ',
145
+ max_preserve_newlines: 5,
146
+ preserve_newlines: true,
147
+ keep_array_indentation: true,
148
+ break_chained_methods: true,
149
+ brace_style: 'collapse',
150
+ space_before_conditional: true,
151
+ unescape_strings: true,
152
+ jslint_happy: true,
153
+ end_with_newline: true,
154
+ wrap_line_length: 0,
155
+ comma_first: true,
156
+ e4x: true,
157
+ indent_empty_lines: true,
158
+ });
159
+ case 'javascript':
160
+ return beautifyJS(content, {
161
+ indent_size: 4,
162
+ indent_char: ' ',
163
+ max_preserve_newlines: 5,
164
+ preserve_newlines: true,
165
+ keep_array_indentation: true,
166
+ break_chained_methods: true,
167
+ brace_style: 'collapse',
168
+ space_before_conditional: true,
169
+ unescape_strings: true,
170
+ jslint_happy: true,
171
+ end_with_newline: true,
172
+ wrap_line_length: 0,
173
+ comma_first: true,
174
+ e4x: true,
175
+ indent_empty_lines: true,
176
+ });
177
+ case 'html':
178
+ return beautifyHTML(content, {
179
+ indent_size: 4,
180
+ indent_char: ' ',
181
+ max_preserve_newlines: 5,
182
+ preserve_newlines: true,
183
+ end_with_newline: true,
184
+ wrap_line_length: 0,
185
+ indent_empty_lines: true,
186
+ });
187
+ case 'xml':
188
+ return beautifyHTML(content, {
189
+ indent_size: 4,
190
+ indent_char: ' ',
191
+ max_preserve_newlines: 5,
192
+ preserve_newlines: true,
193
+ end_with_newline: true,
194
+ wrap_line_length: 0,
195
+ indent_empty_lines: true,
196
+ });
197
+ case 'plain text':
198
+ return content;
199
+ default:
200
+ return content;
201
+ }
202
+ };
149
203
 
150
- return (
151
- <div style={{ width, height }} className="ff-editor-container">
152
- {showToolbar && (
153
- <div className="ff-top-toolbar">
154
- <Tooltip title="Beautify">
155
- <Icon name="beautify_icon" hoverEffect onClick={handleBeautify} />
156
- </Tooltip>
157
- <Select
158
- labelAccessor="label"
159
- valueAccessor="value"
160
- optionsList={optionsList}
161
- selectedOption={selectedOption}
162
- showBorder={true}
163
- onChange={onDropdownChangeHandler}
164
- showLabel={true}
165
- height={24}
166
- width={98}
167
- />
168
- <Button
169
- onClick={handleFileUpload}
170
- variant="secondary"
171
- label="Choose File"
172
- />
173
- </div>
174
- )}
175
- <MonacoEditor
176
- height="90%"
177
- width="100%"
178
- language={contentType}
179
- value={value}
180
- options={{
181
- lineNumbers: 'on',
182
- wordWrap: 'on',
183
- autoClosingBrackets: 'always',
184
- scrollBeyondLastLine: false,
185
- readOnly,
186
- fontFamily: 'font-poppins',
187
- theme,
188
- }}
189
- onMount={handleEditorDidMount}
190
- onChange={(newValue, event) => handleChange(newValue, event)}
191
- />
192
- {showDrawer && (
193
- <Drawer
194
- title="Choose File"
195
- isOpen={showDrawer}
196
- onClose={() => setShowDrawer(false)}
197
- >
198
- <FileDropzone
199
- buttonLabel="Upload"
200
- accept={['.json', '.js', '.html']}
201
- />
202
- </Drawer>
203
- )}
204
- {showDropdown && dropdownPosition && (
205
- <VariableDropdown
206
- optionsList={variableOptionsList}
207
- onSelectVariable={handleSelectVariable}
208
- dropdownPosition={dropdownPosition}
204
+ // Expose editorRef and helper functions to parent via forwarded ref
205
+ useImperativeHandle(ref, () => ({
206
+ getEditorInstance: () => editorRef.current,
207
+ beautify: () => {
208
+ if (editorRef.current) {
209
+ const content = editorRef.current.getValue();
210
+ const lang = editorRef.current.getModel()?.getLanguageId();
211
+ const language = mapLanguageToContentType(lang);
212
+ const beautifiedContent = beautifyContent(content, language);
213
+ editorRef.current.setValue(beautifiedContent);
214
+ }
215
+ },
216
+ }));
217
+
218
+ return (
219
+ <div style={{ width, height }} className="ff-editor-container">
220
+ <MonacoEditor
221
+ height="90%"
222
+ width="100%"
223
+ language={language}
224
+ value={value}
225
+ options={{
226
+ lineNumbers: 'on',
227
+ wordWrap: 'on',
228
+ autoClosingBrackets: 'always',
229
+ scrollBeyondLastLine: false,
230
+ readOnly,
231
+ }}
232
+ onMount={handleEditorDidMount}
233
+ onChange={(newValue, event) => handleChange(newValue, event)}
234
+ theme={theme}
209
235
  />
210
- )}
211
- </div>
212
- );
213
- };
236
+ {showDropdown && dropdownPosition && (
237
+ <VariableDropdown
238
+ optionsList={variableOptionsList}
239
+ onSelectVariable={handleSelectVariable}
240
+ dropdownPosition={dropdownPosition}
241
+ />
242
+ )}
243
+ </div>
244
+ );
245
+ }
246
+ );
214
247
 
215
248
  export default Editor;
@@ -5,7 +5,7 @@ export interface EditorProps {
5
5
  /**
6
6
  * Editor Content Type
7
7
  */
8
- language?: 'javascript' | 'html' | 'json' | 'plaintext' | 'xml';
8
+ language: 'javascript' | 'html' | 'json' | 'plain text' | 'xml';
9
9
 
10
10
  /**
11
11
  *
@@ -18,10 +18,6 @@ export interface EditorProps {
18
18
  */
19
19
  height: string;
20
20
 
21
- /**
22
- * Show toolbar
23
- */
24
- showToolbar?: boolean;
25
21
 
26
22
  /**
27
23
  * read only
@@ -202,6 +202,7 @@ import AddLabelIcon from '../../assets/icons/add_label_icon.svg?react';
202
202
  import QuickRunSettingIcon from '../../assets/icons/quick_run_setting_icon.svg?react';
203
203
  import RunManualTestcaseIcon from '../../assets/icons/run_manual_testcase_icon.svg?react';
204
204
  import RunAutomationScriptsIcon from '../../assets/icons/run_automation_scripts_icon.svg?react';
205
+ import EyeOpenIcon from '../../assets/icons/eye_open_icon.svg?react';
205
206
 
206
207
  Components['delete_info'] = DeleteInfoIcon;
207
208
  Components['success'] = ToastSuccessIcon;
@@ -402,6 +403,7 @@ Components['add_label_icon'] = AddLabelIcon;
402
403
  Components['quick_run_setting'] = QuickRunSettingIcon;
403
404
  Components['run_manual_testcase'] = RunManualTestcaseIcon;
404
405
  Components['run_automation_scripts'] = RunAutomationScriptsIcon;
406
+ Components['eye_open_icon'] = EyeOpenIcon;
405
407
 
406
408
 
407
409
  export default Components;
@@ -9,6 +9,7 @@
9
9
  height: 100%;
10
10
  width: 100%;
11
11
  border: 1px solid var(--ff-machine-input-field-border-color);
12
+ padding: 0 8px 0 0;
12
13
  border-radius: 4px;
13
14
  display: flex;
14
15
  align-items: center;
@@ -17,9 +18,10 @@
17
18
  .ff-machine-icon-text-wrapper,
18
19
  .ff-machine-icon-text-wrapper-reverse {
19
20
  display: flex;
21
+ align-items: center;
20
22
 
21
23
  .ff-machine-icon {
22
- margin-right: 8px;
24
+ margin-left: 4px;
23
25
  }
24
26
  }
25
27
 
@@ -39,6 +41,6 @@
39
41
  background-color: var(--ff-machine-input-field-border-color);
40
42
  border-radius: 4px;
41
43
  padding: 1px 2px;
42
- height: 10px;
44
+ height: 12px;
43
45
  }
44
46
  }
@@ -13,6 +13,7 @@ const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
13
13
  runCount = 0,
14
14
  className = '',
15
15
  contentReverse = false,
16
+ onClick = () => {},
16
17
  },
17
18
  ref
18
19
  ) => {
@@ -28,6 +29,7 @@ const MachineInputField = forwardRef<HTMLDivElement, MachineInputFieldProps>(
28
29
  ref={ref}
29
30
  style={{ width: width }}
30
31
  className={classNames('ff-machine-input-field-wrapper', className)}
32
+ onClick={onClick}
31
33
  >
32
34
  <Typography
33
35
  as="span"
@@ -9,4 +9,5 @@ export interface MachineInputFieldProps {
9
9
  runCount: number;
10
10
  className?: string;
11
11
  contentReverse?: boolean;
12
+ onClick?: () => void;
12
13
  }