pixel-react 1.21.66 → 1.21.68
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/StyleGuide/ColorPalette/colorPaletteList.js +5 -4
- package/lib/StyleGuide/ColorPalette/colorPaletteList.js.map +1 -1
- package/lib/components/AudioPlayer/AudioPlayer.js +1 -1
- package/lib/components/AudioPlayer/AudioPlayer.js.map +1 -1
- package/lib/components/AudioPlayer/__tests__/AudioPlayer.test.d.ts +1 -0
- package/lib/components/AudioPlayer/__tests__/AudioPlayer.test.js +68 -0
- package/lib/components/AudioPlayer/__tests__/AudioPlayer.test.js.map +1 -0
- package/lib/components/Button/__tests__/Button.test.d.ts +1 -0
- package/lib/components/Button/__tests__/Button.test.js +45 -0
- package/lib/components/Button/__tests__/Button.test.js.map +1 -0
- package/lib/components/Button/types.d.ts +2 -2
- package/lib/components/CardPanel/CardPanel.js +3 -1
- package/lib/components/CardPanel/CardPanel.js.map +1 -1
- package/lib/components/CardPanel/__tests__/CardPanel.test.d.ts +1 -0
- package/lib/components/CardPanel/__tests__/CardPanel.test.js +36 -0
- package/lib/components/CardPanel/__tests__/CardPanel.test.js.map +1 -0
- package/lib/components/Drawer/Drawer.js +4 -3
- package/lib/components/Drawer/Drawer.js.map +1 -1
- package/lib/components/Drawer/__tests__/Drawer.test.d.ts +1 -0
- package/lib/components/Drawer/__tests__/Drawer.test.js +48 -0
- package/lib/components/Drawer/__tests__/Drawer.test.js.map +1 -0
- package/lib/components/Editor/Editor.d.ts +7 -1
- package/lib/components/Editor/Editor.js +29 -345
- package/lib/components/Editor/Editor.js.map +1 -1
- package/lib/components/Editor/__tests__/beautify.test.d.ts +1 -0
- package/lib/components/Editor/__tests__/beautify.test.js +15 -0
- package/lib/components/Editor/__tests__/beautify.test.js.map +1 -0
- package/lib/components/Editor/beautify.d.ts +1 -0
- package/lib/components/Editor/beautify.js +40 -0
- package/lib/components/Editor/beautify.js.map +1 -0
- package/lib/components/Editor/useVariableDropdown.d.ts +17 -0
- package/lib/components/Editor/useVariableDropdown.js +252 -0
- package/lib/components/Editor/useVariableDropdown.js.map +1 -0
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.d.ts +1 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/areModelsEqual.js +0 -1
- package/lib/components/Excel/ExcelFile/ExcelFileComponents/areModelsEqual.js.map +1 -1
- package/lib/components/Icon/Icon.js +16 -3
- package/lib/components/Icon/Icon.js.map +1 -1
- package/lib/components/Icon/__tests__/Icon.test.d.ts +1 -0
- package/lib/components/Icon/__tests__/Icon.test.js +66 -0
- package/lib/components/Icon/__tests__/Icon.test.js.map +1 -0
- package/lib/components/Icon/iconList.js +5 -5
- package/lib/components/Icon/types.d.ts +2 -1
- package/lib/components/Input/Input.js +13 -10
- package/lib/components/Input/Input.js.map +1 -1
- package/lib/components/Input/__tests__/Input.test.d.ts +1 -0
- package/lib/components/Input/__tests__/Input.test.js +45 -0
- package/lib/components/Input/__tests__/Input.test.js.map +1 -0
- package/lib/components/Input/types.d.ts +2 -1
- package/lib/components/MultiSelect/Dropdown.js +3 -4
- package/lib/components/MultiSelect/Dropdown.js.map +1 -1
- package/lib/components/MultiSelect/MultiSelect.d.ts +1 -1
- package/lib/components/MultiSelect/MultiSelect.js +17 -6
- package/lib/components/MultiSelect/MultiSelect.js.map +1 -1
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +2 -2
- package/lib/components/MultiSelect/__tests__/MultiSelect.test.d.ts +1 -0
- package/lib/components/MultiSelect/__tests__/MultiSelect.test.js +30 -0
- package/lib/components/MultiSelect/__tests__/MultiSelect.test.js.map +1 -0
- package/lib/components/MultiSelect/dropdownTypes.d.ts +3 -0
- package/lib/components/Select/Select.js +14 -7
- package/lib/components/Select/Select.js.map +1 -1
- package/lib/components/Select/__tests__/Select.test.d.ts +1 -0
- package/lib/components/Select/__tests__/Select.test.js +33 -0
- package/lib/components/Select/__tests__/Select.test.js.map +1 -0
- package/lib/components/Select/components/Dropdown.js +3 -3
- package/lib/components/Select/components/Dropdown.js.map +1 -1
- package/lib/components/Select/components/types.d.ts +1 -0
- package/lib/components/Select/components/types.js.map +1 -1
- package/lib/components/Select/types.d.ts +2 -2
- package/lib/components/Table/Table.js +3 -3
- package/lib/components/Table/Table.js.map +1 -1
- package/lib/components/Table/Types.d.ts +8 -0
- package/lib/components/Table/__tests__/Table.test.d.ts +1 -0
- package/lib/components/Table/__tests__/Table.test.js +26 -0
- package/lib/components/Table/__tests__/Table.test.js.map +1 -0
- package/lib/components/Table/components/SortableRow.js +2 -3
- package/lib/components/Table/components/SortableRow.js.map +1 -1
- package/lib/components/Table/components/TableHeader.js +3 -3
- package/lib/components/Table/components/TableHeader.js.map +1 -1
- package/lib/components/Table/components/VirtualizedRows.js +1 -1
- package/lib/components/Table/components/VirtualizedRows.js.map +1 -1
- package/lib/components/TableTree/TableTree.js +1 -1
- package/lib/components/TableTree/TableTree.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableBody.js +1 -1
- package/lib/components/TableTreeFn/Components/TableBody.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableCell.js +1 -1
- package/lib/components/TableTreeFn/Components/TableCell.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableHead.js +2 -2
- package/lib/components/TableTreeFn/Components/TableHead.js.map +1 -1
- package/lib/components/TableTreeFn/Components/TableRow.js +1 -1
- package/lib/components/TableTreeFn/Components/TableRow.js.map +1 -1
- package/lib/components/TableTreeFn/TableTreeFn.js +2 -2
- package/lib/components/TableTreeFn/TableTreeFn.js.map +1 -1
- package/lib/components/TableTreeFn/__tests__/TableTreeFn.test.d.ts +1 -0
- package/lib/components/TableTreeFn/__tests__/TableTreeFn.test.js +17 -0
- package/lib/components/TableTreeFn/__tests__/TableTreeFn.test.js.map +1 -0
- package/lib/components/TableTreeFn/types.d.ts +8 -0
- package/lib/components/Tabs/Tabs.d.ts +1 -1
- package/lib/components/Tabs/Tabs.js +2 -2
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/Tabs/types.d.ts +4 -0
- package/lib/index.d.ts +37 -11
- package/lib/index.js +8 -8
- package/lib/styles.css +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.d.ts +2 -2
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.js +23 -9
- package/lib/utils/computeTreeCountsAndFormatNodes/computeTreeCountsAndFormatNodes.js.map +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
import { calculateDropdownPosition } from './calculateDropdownPosition';
|
|
3
|
+
export const useVariableDropdown = ({ editor, variableOptionsList, addForloopPrefix, isRequisiteType, setValue, }) => {
|
|
4
|
+
const decorationsRef = useRef([]);
|
|
5
|
+
const varRef = useRef(null);
|
|
6
|
+
const filterVarRef = useRef(null);
|
|
7
|
+
const [currentLine, setCurrentLine] = useState(0);
|
|
8
|
+
const [isTextSelected, setIsTextSelected] = useState(false);
|
|
9
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
10
|
+
const [dropdownPosition, setDropdownPosition] = useState({ top: 0, left: 0 });
|
|
11
|
+
const [filteredVariableOptions, setFilteredVariableOptions] = useState([]);
|
|
12
|
+
// Setup listeners when editor is available
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!editor)
|
|
15
|
+
return;
|
|
16
|
+
const cursorPositionDisposable = editor.onDidChangeCursorPosition((e) => {
|
|
17
|
+
setCurrentLine(e.position.lineNumber);
|
|
18
|
+
const position = editor.getPosition();
|
|
19
|
+
const model = editor.getModel();
|
|
20
|
+
if (!position || !model)
|
|
21
|
+
return;
|
|
22
|
+
const currentLineContent = model.getLineContent(position.lineNumber);
|
|
23
|
+
const col = position.column - 1;
|
|
24
|
+
if (col === 0) {
|
|
25
|
+
setShowDropdown(false);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const dollarIndex = currentLineContent.lastIndexOf('$', col - 1);
|
|
29
|
+
const openIndex = currentLineContent.lastIndexOf('${', col - 1);
|
|
30
|
+
const closeIndex = openIndex !== -1 ? currentLineContent.indexOf('}', openIndex + 2) : -1;
|
|
31
|
+
const insideVariable = openIndex !== -1 && closeIndex !== -1 && col - 1 > openIndex && col - 1 < closeIndex;
|
|
32
|
+
const isCloserEnd = !/\}/.test(currentLineContent.slice(dollarIndex + 1, col));
|
|
33
|
+
if (dollarIndex !== -1 &&
|
|
34
|
+
col > dollarIndex &&
|
|
35
|
+
!/\s/.test(currentLineContent.slice(dollarIndex + 1, col)) &&
|
|
36
|
+
!insideVariable &&
|
|
37
|
+
isCloserEnd) {
|
|
38
|
+
varRef.current = dollarIndex;
|
|
39
|
+
filterVarRef.current = currentLineContent.slice(dollarIndex + 1, col);
|
|
40
|
+
const filterVal = (filterVarRef.current ?? '').toLowerCase();
|
|
41
|
+
const filteredVariable = variableOptionsList.filter((opt) => {
|
|
42
|
+
const variableName = opt.type === '_startforloop' && addForloopPrefix ? `FLV_for:${opt.name}` : opt.name;
|
|
43
|
+
return variableName.toLowerCase().includes(filterVal);
|
|
44
|
+
});
|
|
45
|
+
setFilteredVariableOptions(filteredVariable);
|
|
46
|
+
const visiblePosition = editor.getScrolledVisiblePosition(position);
|
|
47
|
+
const editorDomNode = editor.getDomNode();
|
|
48
|
+
if (visiblePosition && editorDomNode) {
|
|
49
|
+
setDropdownPosition(calculateDropdownPosition(visiblePosition, editorDomNode, 150));
|
|
50
|
+
}
|
|
51
|
+
if (['keyboard', 'mouse', 'deleteLeft'].includes(e?.source || '')) {
|
|
52
|
+
setShowDropdown(true);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
setShowDropdown(false);
|
|
57
|
+
varRef.current = null;
|
|
58
|
+
filterVarRef.current = null;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const mouseDownDisposable = editor.onMouseDown(() => {
|
|
62
|
+
setTimeout(() => {
|
|
63
|
+
const position = editor.getPosition();
|
|
64
|
+
const model = editor.getModel();
|
|
65
|
+
if (!position || !model)
|
|
66
|
+
return;
|
|
67
|
+
const currentLineContent = model.getLineContent(position.lineNumber);
|
|
68
|
+
const columnIndex = position.column - 2;
|
|
69
|
+
if (currentLineContent[columnIndex] === '$') {
|
|
70
|
+
varRef.current = columnIndex;
|
|
71
|
+
filterVarRef.current = '';
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
varRef.current = null;
|
|
75
|
+
filterVarRef.current = null;
|
|
76
|
+
}
|
|
77
|
+
}, 0);
|
|
78
|
+
});
|
|
79
|
+
const cursorSelectionDisposable = editor.onDidChangeCursorSelection(() => {
|
|
80
|
+
const selections = editor.getSelections() || [];
|
|
81
|
+
const hasSelection = selections.some((sel) => sel.startLineNumber !== sel.endLineNumber || sel.startColumn !== sel.endColumn);
|
|
82
|
+
setIsTextSelected(hasSelection);
|
|
83
|
+
});
|
|
84
|
+
const modelContentDisposable = editor.onDidChangeModelContent(() => {
|
|
85
|
+
const content = editor.getValue();
|
|
86
|
+
setValue(content);
|
|
87
|
+
const position = editor.getPosition();
|
|
88
|
+
const model = editor.getModel();
|
|
89
|
+
if (!position || !model)
|
|
90
|
+
return;
|
|
91
|
+
const currentLineContent = model.getLineContent(position.lineNumber);
|
|
92
|
+
const columnIndex = position.column - 2;
|
|
93
|
+
const currentVarIndex = varRef.current ?? columnIndex;
|
|
94
|
+
if (currentLineContent[currentVarIndex] === '$') {
|
|
95
|
+
if (varRef.current === null) {
|
|
96
|
+
varRef.current = columnIndex;
|
|
97
|
+
}
|
|
98
|
+
filterVarRef.current = currentLineContent.slice(varRef.current + 1, columnIndex);
|
|
99
|
+
const filteredVariable = variableOptionsList.filter((opt) => {
|
|
100
|
+
const variableName = opt.type === '_startforloop' && addForloopPrefix ? `FLV_for:${opt.name}` : opt.name;
|
|
101
|
+
return variableName.toLowerCase().includes((filterVarRef.current ?? '').toLowerCase());
|
|
102
|
+
});
|
|
103
|
+
if (filteredVariable.length) {
|
|
104
|
+
setFilteredVariableOptions(filteredVariable);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
setFilteredVariableOptions([]);
|
|
108
|
+
if (varRef.current !== columnIndex && currentLineContent[columnIndex] === ' ') {
|
|
109
|
+
varRef.current = null;
|
|
110
|
+
filterVarRef.current = null;
|
|
111
|
+
setShowDropdown(false);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const visiblePosition = editor.getScrolledVisiblePosition(position);
|
|
115
|
+
const editorDomNode = editor.getDomNode();
|
|
116
|
+
if (visiblePosition && editorDomNode) {
|
|
117
|
+
setDropdownPosition(calculateDropdownPosition(visiblePosition, editorDomNode, 150));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
varRef.current = null;
|
|
122
|
+
filterVarRef.current = null;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
const blurDisposable = editor.onDidBlurEditorWidget(() => {
|
|
126
|
+
setShowDropdown(false);
|
|
127
|
+
varRef.current = null;
|
|
128
|
+
filterVarRef.current = null;
|
|
129
|
+
decorationsRef.current = [];
|
|
130
|
+
setCurrentLine(0);
|
|
131
|
+
});
|
|
132
|
+
return () => {
|
|
133
|
+
cursorPositionDisposable.dispose();
|
|
134
|
+
mouseDownDisposable.dispose();
|
|
135
|
+
cursorSelectionDisposable.dispose();
|
|
136
|
+
modelContentDisposable.dispose();
|
|
137
|
+
blurDisposable.dispose();
|
|
138
|
+
};
|
|
139
|
+
}, [editor, variableOptionsList, addForloopPrefix, setValue]);
|
|
140
|
+
// Decoration hook
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
if (!editor || !currentLine)
|
|
143
|
+
return;
|
|
144
|
+
const decorations = [];
|
|
145
|
+
const lineNumberDecorations = [];
|
|
146
|
+
if (isTextSelected) {
|
|
147
|
+
lineNumberDecorations.push({
|
|
148
|
+
range: {
|
|
149
|
+
startLineNumber: currentLine,
|
|
150
|
+
startColumn: 1,
|
|
151
|
+
endLineNumber: currentLine,
|
|
152
|
+
endColumn: 1,
|
|
153
|
+
},
|
|
154
|
+
options: {
|
|
155
|
+
isWholeLine: false,
|
|
156
|
+
linesDecorationsClassName: 'active-line-number',
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
decorations.push({
|
|
162
|
+
range: {
|
|
163
|
+
startLineNumber: currentLine,
|
|
164
|
+
startColumn: 1,
|
|
165
|
+
endLineNumber: currentLine,
|
|
166
|
+
endColumn: 1,
|
|
167
|
+
},
|
|
168
|
+
options: {
|
|
169
|
+
isWholeLine: true,
|
|
170
|
+
className: 'current-line-background',
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
const decorationIds = decorationsRef.current || [];
|
|
175
|
+
decorationsRef.current = editor.deltaDecorations(decorationIds, [
|
|
176
|
+
...decorations,
|
|
177
|
+
...lineNumberDecorations,
|
|
178
|
+
]);
|
|
179
|
+
}, [editor, currentLine, isTextSelected]);
|
|
180
|
+
const insertSuggestion = useCallback((textToInsert, moveMarkers, currentPositionOffset) => {
|
|
181
|
+
if (!editor)
|
|
182
|
+
return;
|
|
183
|
+
const position = editor.getPosition();
|
|
184
|
+
if (!position)
|
|
185
|
+
return;
|
|
186
|
+
const currentVarIndex = varRef.current ?? 0;
|
|
187
|
+
editor.executeEdits('', [
|
|
188
|
+
{
|
|
189
|
+
range: {
|
|
190
|
+
startLineNumber: position.lineNumber,
|
|
191
|
+
startColumn: currentVarIndex + currentPositionOffset,
|
|
192
|
+
endLineNumber: position.lineNumber,
|
|
193
|
+
endColumn: currentVarIndex + (position.column - currentVarIndex),
|
|
194
|
+
},
|
|
195
|
+
text: textToInsert,
|
|
196
|
+
forceMoveMarkers: moveMarkers,
|
|
197
|
+
},
|
|
198
|
+
]);
|
|
199
|
+
// Update decorations for the current line
|
|
200
|
+
const decorationIds = decorationsRef.current || [];
|
|
201
|
+
decorationsRef.current = editor.deltaDecorations(decorationIds, [
|
|
202
|
+
{
|
|
203
|
+
range: {
|
|
204
|
+
startLineNumber: currentLine,
|
|
205
|
+
startColumn: 1,
|
|
206
|
+
endLineNumber: currentLine,
|
|
207
|
+
endColumn: 1,
|
|
208
|
+
},
|
|
209
|
+
options: {
|
|
210
|
+
isWholeLine: false,
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
]);
|
|
214
|
+
filterVarRef.current = null;
|
|
215
|
+
varRef.current = null;
|
|
216
|
+
setShowDropdown(false);
|
|
217
|
+
}, [editor, currentLine]);
|
|
218
|
+
const handleSelectSuggestion = useCallback((suggestion, type) => {
|
|
219
|
+
const val = `{${type}${type === 'FLV_for:' ? '' : '_'}${suggestion}}`;
|
|
220
|
+
insertSuggestion(val, false, 2);
|
|
221
|
+
}, [insertSuggestion]);
|
|
222
|
+
const handleSelectVariable = useCallback((option) => {
|
|
223
|
+
if (isRequisiteType) {
|
|
224
|
+
insertSuggestion(`'${option.name}'`, true, 1);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const typePrefix = option.parentVariableType === 'STEPGROUP'
|
|
228
|
+
? 'SGV'
|
|
229
|
+
: option?.type === 'GLOBAL'
|
|
230
|
+
? 'GV'
|
|
231
|
+
: option?.type === 'LOCAL'
|
|
232
|
+
? 'LV'
|
|
233
|
+
: (option?._id ?? option?.id ?? '').includes('PARAMETER')
|
|
234
|
+
? 'SGP'
|
|
235
|
+
: option?.type === '_startforloop'
|
|
236
|
+
? 'FLV_for:'
|
|
237
|
+
: option?.type === 'DATAPROVIDER'
|
|
238
|
+
? 'DPV'
|
|
239
|
+
: 'PEV';
|
|
240
|
+
const suggestionText = option?.type === 'DATAPROVIDER' ? `${option?.dpName}:${option?.varname}` : option?.name;
|
|
241
|
+
handleSelectSuggestion(suggestionText, typePrefix);
|
|
242
|
+
}
|
|
243
|
+
}, [isRequisiteType, handleSelectSuggestion, insertSuggestion]);
|
|
244
|
+
return {
|
|
245
|
+
showDropdown,
|
|
246
|
+
setShowDropdown,
|
|
247
|
+
dropdownPosition,
|
|
248
|
+
filteredVariableOptions,
|
|
249
|
+
handleSelectVariable,
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=useVariableDropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVariableDropdown.js","sourceRoot":"","sources":["../../../src/components/Editor/useVariableDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAUxE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,MAAM,EACN,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,QAAQ,GACiB,EAAE,EAAE;IAC7B,MAAM,cAAc,GAAG,MAAM,CAAW,EAAE,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAC3C,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IAEjD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAS,CAAC,CAAC,CAAC;IAC1D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACjE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAuB,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC;IACpG,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GAAG,QAAQ,CAAgB,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E,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC;YAE1F,sBAAsB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,EACD,CAAC,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,CAAC,CAC5D,CAAC;IAEF,OAAO;QACL,YAAY;QACZ,eAAe;QACf,gBAAgB;QAChB,uBAAuB;QACvB,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as Types from './types';
|
|
3
3
|
export declare const enhance: (ColumnIndicatorComponent: Types.ColumnIndicatorComponent) => React.FC<Omit<Types.ColumnIndicatorProps, "selected" | "onSelect">>;
|
|
4
|
-
declare const EnhancedColumnIndicator: React.FC<Omit<Types.ColumnIndicatorProps, "
|
|
4
|
+
declare const EnhancedColumnIndicator: React.FC<Omit<Types.ColumnIndicatorProps, "onSelect" | "selected">>;
|
|
5
5
|
export default EnhancedColumnIndicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areModelsEqual.js","sourceRoot":"","sources":["../../../../../src/components/Excel/ExcelFile/ExcelFileComponents/areModelsEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,SAAS,cAAc,CAAC,CAAU,EAAE,CAAU;IAC5C,MAAM,SAAS,GAAG,CAAC,YAAY,KAAK,CAAC;IACrC,MAAM,SAAS,GAAG,CAAC,YAAY,KAAK,CAAC;IAErC,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC;QAC3B,mBAAmB;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;SAAM,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"areModelsEqual.js","sourceRoot":"","sources":["../../../../../src/components/Excel/ExcelFile/ExcelFileComponents/areModelsEqual.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,SAAS,cAAc,CAAC,CAAU,EAAE,CAAU;IAC5C,MAAM,SAAS,GAAG,CAAC,YAAY,KAAK,CAAC;IACrC,MAAM,SAAS,GAAG,CAAC,YAAY,KAAK,CAAC;IAErC,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC;QAC3B,mBAAmB;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3B,CAAC;SAAM,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC;AAGD,MAAM,CAAC,kBAAkB,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useEffect, useRef } from 'react';
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import Components from './iconList';
|
|
5
5
|
import './Icons.scss';
|
|
6
|
-
const Icon = forwardRef(({ name, height, width, onClick
|
|
6
|
+
const Icon = forwardRef(({ name, height, width, onClick, color = 'var(--brand-color)', // Default color
|
|
7
7
|
hoverEffect = false, className = '', disabled = false, variant = 'light', isSelected = false, x, y, chartIcon = false, tabIndex = -1, cursorType, withPadding = true, ...props }, ref) => {
|
|
8
8
|
const IconComponent = Components[name];
|
|
9
9
|
const iconHeight = height || 16;
|
|
@@ -42,7 +42,20 @@ hoverEffect = false, className = '', disabled = false, variant = 'light', isSele
|
|
|
42
42
|
};
|
|
43
43
|
const baseProps = {
|
|
44
44
|
ref: iconRef,
|
|
45
|
-
onClick: disabled ?
|
|
45
|
+
onClick: disabled ? undefined : onClick,
|
|
46
|
+
onKeyDown: (e) => {
|
|
47
|
+
if (disabled)
|
|
48
|
+
return;
|
|
49
|
+
if (onClick && (e.key === 'Enter' || e.key === ' ')) {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
onClick(e);
|
|
52
|
+
}
|
|
53
|
+
if (props.onKeyDown) {
|
|
54
|
+
props.onKeyDown(e);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
role: props.role || (onClick ? 'button' : 'img'),
|
|
58
|
+
'aria-disabled': disabled || undefined,
|
|
46
59
|
style: {
|
|
47
60
|
height: `${iconHeight}px`,
|
|
48
61
|
width: `${iconWidth}px`,
|
|
@@ -60,7 +73,7 @@ hoverEffect = false, className = '', disabled = false, variant = 'light', isSele
|
|
|
60
73
|
tabIndex: tabIndex,
|
|
61
74
|
...props,
|
|
62
75
|
};
|
|
63
|
-
return (_jsx(_Fragment, { children: chartIcon === false ? (_jsx("span", { ...baseProps, ref: ref, children: _jsx(IconComponent, { height: "100%", width: "100%", style: { color: iconColor } }) })) : (_jsx("svg", { ...baseProps, children: _jsx(IconComponent, { style: { color: color }, height: height, width: width }) })) }));
|
|
76
|
+
return (_jsx(_Fragment, { children: chartIcon === false ? (_jsx("span", { ...baseProps, ref: ref, children: _jsx(IconComponent, { height: "100%", width: "100%", style: { color: iconColor } }) })) : (_jsx("svg", { ...baseProps, role: "img", "aria-label": name, children: _jsx(IconComponent, { style: { color: color }, height: height, width: width }) })) }));
|
|
64
77
|
});
|
|
65
78
|
export default Icon;
|
|
66
79
|
//# sourceMappingURL=Icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;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react/jsx-runtime";
|
|
2
|
+
import { render, screen, fireEvent } from '@testing-library/react';
|
|
3
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
4
|
+
import Icon from '../Icon';
|
|
5
|
+
// Mock the IconList to avoid depending on actual SVG imports
|
|
6
|
+
vi.mock('../iconList', () => {
|
|
7
|
+
return {
|
|
8
|
+
default: {
|
|
9
|
+
play: (props) => _jsx("svg", { "data-testid": "mock-play-svg", ...props }),
|
|
10
|
+
close: (props) => _jsx("svg", { "data-testid": "mock-close-svg", ...props }),
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
describe('Icon Component', () => {
|
|
15
|
+
it('renders correctly with a valid icon name', () => {
|
|
16
|
+
render(_jsx(Icon, { name: "play" }));
|
|
17
|
+
// By default, it has role="img" when not interactive
|
|
18
|
+
const iconContainer = screen.getByRole('img');
|
|
19
|
+
expect(iconContainer).toBeInTheDocument();
|
|
20
|
+
const svg = screen.getByTestId('mock-play-svg');
|
|
21
|
+
expect(svg).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
it('returns null if icon name is invalid', () => {
|
|
24
|
+
const { container } = render(_jsx(Icon, { name: "invalid_icon" }));
|
|
25
|
+
expect(container).toBeEmptyDOMElement();
|
|
26
|
+
});
|
|
27
|
+
it('receives role="button" when onClick is provided', () => {
|
|
28
|
+
const handleClick = vi.fn();
|
|
29
|
+
render(_jsx(Icon, { name: "play", onClick: handleClick }));
|
|
30
|
+
const buttonIcon = screen.getByRole('button');
|
|
31
|
+
expect(buttonIcon).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
it('handles onClick events', () => {
|
|
34
|
+
const handleClick = vi.fn();
|
|
35
|
+
render(_jsx(Icon, { name: "play", onClick: handleClick }));
|
|
36
|
+
const buttonIcon = screen.getByRole('button');
|
|
37
|
+
fireEvent.click(buttonIcon);
|
|
38
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
39
|
+
});
|
|
40
|
+
it('does not trigger onClick when disabled', () => {
|
|
41
|
+
const handleClick = vi.fn();
|
|
42
|
+
render(_jsx(Icon, { name: "play", onClick: handleClick, disabled: true }));
|
|
43
|
+
// When disabled and onClick is provided, it might still have role="button" but should not fire
|
|
44
|
+
const buttonIcon = screen.getByRole('button');
|
|
45
|
+
expect(buttonIcon).toHaveAttribute('aria-disabled', 'true');
|
|
46
|
+
fireEvent.click(buttonIcon);
|
|
47
|
+
expect(handleClick).not.toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
it('fires onClick on Enter and Space keys', () => {
|
|
50
|
+
const handleClick = vi.fn();
|
|
51
|
+
render(_jsx(Icon, { name: "play", onClick: handleClick, tabIndex: 0 }));
|
|
52
|
+
const buttonIcon = screen.getByRole('button');
|
|
53
|
+
fireEvent.keyDown(buttonIcon, { key: 'Enter', code: 'Enter' });
|
|
54
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
55
|
+
fireEvent.keyDown(buttonIcon, { key: ' ', code: 'Space' });
|
|
56
|
+
expect(handleClick).toHaveBeenCalledTimes(2);
|
|
57
|
+
});
|
|
58
|
+
it('does not fire keyboard events when disabled', () => {
|
|
59
|
+
const handleClick = vi.fn();
|
|
60
|
+
render(_jsx(Icon, { name: "play", onClick: handleClick, tabIndex: 0, disabled: true }));
|
|
61
|
+
const buttonIcon = screen.getByRole('button');
|
|
62
|
+
fireEvent.keyDown(buttonIcon, { key: 'Enter', code: 'Enter' });
|
|
63
|
+
expect(handleClick).not.toHaveBeenCalled();
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
//# sourceMappingURL=Icon.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.test.js","sourceRoot":"","sources":["../../../../src/components/Icon/__tests__/Icon.test.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAA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C,IAAI,IAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,GAAI,CAAC,CAAC;QAEhE,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE9C,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;QAE7C,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC3D,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACrD,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,SAAG,CAAC,CAAC;QAEzE,MAAM,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAE9C,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC/D,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -437,7 +437,7 @@ import GotoScript from '../../assets/icons/go_to_scripts.svg?react';
|
|
|
437
437
|
import SettingIcon from '../../assets/icons/setting-icon.svg?react';
|
|
438
438
|
import SeleniumIcon from '../../assets/icons/selenium_icon.svg?react';
|
|
439
439
|
import VideoPreviewIcon from '../../assets/icons/video_preview_icon.svg?react';
|
|
440
|
-
import FilterActive from '../../assets/icons/
|
|
440
|
+
import FilterActive from '../../assets/icons/filter_active.svg?react';
|
|
441
441
|
import MaximizedNewIcon from '../../assets/icons/maximize_new_icon.svg?react';
|
|
442
442
|
import AutoHealing from '../../assets/icons/auto_healing.svg?react';
|
|
443
443
|
import ClockFilled from '../../assets/icons/clock_filled.svg?react';
|
|
@@ -489,7 +489,7 @@ import PromptSlider from '../../assets/icons/prompt_slider.svg?react';
|
|
|
489
489
|
import SendPrompt from '../../assets/icons/send_prompt.svg?react';
|
|
490
490
|
import Access_Key from '../../assets/icons/access_key.svg?react'; //Newly Added icon
|
|
491
491
|
import List_icon from '../../assets/icons/list_icon.svg?react';
|
|
492
|
-
import JSON_icon from '../../assets/icons/
|
|
492
|
+
import JSON_icon from '../../assets/icons/JSON_code_icon.svg?react';
|
|
493
493
|
import Honor_icon from '../../assets/icons/honor_icon.svg?react'; //Newly Added icon
|
|
494
494
|
import IQOO_icon from '../../assets/icons/iqoo_icon.svg?react'; //Newly Added icon
|
|
495
495
|
import MOTOROLA_icon from '../../assets/icons/motorola_icon.svg?react'; //Newly Added icon
|
|
@@ -498,7 +498,7 @@ import REALME_icon from '../../assets/icons/realme_icon.svg?react'; //Newly Adde
|
|
|
498
498
|
import VIVO_icon from '../../assets/icons/vivo_icon.svg?react'; //Newly Added icon
|
|
499
499
|
import DataSet from '../../assets/icons/data_set.svg?react'; //Newly Added icon
|
|
500
500
|
import VideoPreview from '../../assets/icons/video_preview.svg?react'; //Newly Added icon
|
|
501
|
-
import Minimize_tree from '../../assets/icons/
|
|
501
|
+
import Minimize_tree from '../../assets/icons/Minimize_Tree.svg?react';
|
|
502
502
|
import Record from '../../assets/icons/record.svg?react';
|
|
503
503
|
import AddElement from '../../assets/icons/add_element.svg?react';
|
|
504
504
|
import ElementSlider from '../../assets/icons/element_slider.svg?react';
|
|
@@ -553,7 +553,7 @@ import AndroidBrowserIcon from '../../assets/icons/android_browser.svg?react';
|
|
|
553
553
|
import IosBrowserIcon from '../../assets/icons/ios_browser.svg?react';
|
|
554
554
|
import ManualMobileWhiteIcon from '../../assets/icons/manualMobileWhiteIcon.svg?react';
|
|
555
555
|
import ManualMobileIcon from '../../assets/icons/manualMobileIcon.svg?react';
|
|
556
|
-
import DeviceFarm_Arrow_icon from '../../assets/icons/
|
|
556
|
+
import DeviceFarm_Arrow_icon from '../../assets/icons/DeviceFarm_Arrow_icon.svg?react';
|
|
557
557
|
import CertifiedIcon from '../../assets/icons/certified.svg?react';
|
|
558
558
|
import VerifiedIcon from '../../assets/icons/verified.svg?react';
|
|
559
559
|
import IssuedByIcon from '../../assets/icons/issued_by.svg?react';
|
|
@@ -580,7 +580,7 @@ import Empty_page_web_icon from '../../assets/icons/empty_page_web_icon.svg?reac
|
|
|
580
580
|
import Screenshot_empty_icon from '../../assets/icons/screenshot_empty_icon.svg?react';
|
|
581
581
|
import Video_empty_icon from '../../assets/icons/video_empty_icon.svg?react';
|
|
582
582
|
import Optmizer_icon from '../../assets/icons/optmizer_icon.svg?react';
|
|
583
|
-
import Warning_info_icon from '../../assets/icons/
|
|
583
|
+
import Warning_info_icon from '../../assets/icons/Warning_info_icon.svg?react';
|
|
584
584
|
import Request_generation_icon from '../../assets/icons/request_generation.svg?react';
|
|
585
585
|
import Up_Control_Icon from '../../assets/icons/up_control_icon.svg?react';
|
|
586
586
|
import Down_Control_Icon from '../../assets/icons/down_control_icon.svg?react';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useState, useEffect } from 'react';
|
|
2
|
+
import { forwardRef, useState, useEffect, useId } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import './Input.scss';
|
|
5
5
|
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
@@ -27,6 +27,9 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
27
27
|
const [isFocused, setIsFocused] = useState(false);
|
|
28
28
|
const clearIcon = iconProps?.isClearIcon;
|
|
29
29
|
const showIcon = iconProps?.isShowIcon;
|
|
30
|
+
const uniqueId = useId();
|
|
31
|
+
const inputId = props.id || name || uniqueId;
|
|
32
|
+
const helperTextId = `${inputId}-helper-text`;
|
|
30
33
|
useEffect(() => {
|
|
31
34
|
if (value !== internalValue) {
|
|
32
35
|
setInternalValue(value);
|
|
@@ -143,12 +146,12 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
143
146
|
'ff-input-container--disabled': !!disabled,
|
|
144
147
|
}), children: [isLabelRequired && (_jsxs("label", { className: classNames(`ff-input-label-container ff-input-label-container--${size}`, {
|
|
145
148
|
'ff-input-label-container--danger': (displayErrorImmediately || touched) && !!error,
|
|
146
|
-
}), htmlFor:
|
|
149
|
+
}), htmlFor: inputId, children: [required && _jsx("span", { className: "required-asterisk", children: "*" }), _jsx("span", { className: classNames(`ff-input-label ff-input-label--${variant}`, {
|
|
147
150
|
'ff-input-label--no-hover': !!internalValue,
|
|
148
151
|
'ff-input-label--disabled': !!disabled,
|
|
149
152
|
'ff-input-label--danger': (displayErrorImmediately || touched) && !!error,
|
|
150
153
|
'ff-input-label--focused': isFocused,
|
|
151
|
-
}), children: label })] })), _jsx("input", { style: { background: background || 'transparent' }, readOnly: readOnly, ref: ref, name: name, value: internalValue || value, type: type, spellCheck: false, id:
|
|
154
|
+
}), children: label })] })), _jsx("input", { style: { background: background || 'transparent' }, readOnly: readOnly, ref: ref, name: name, value: internalValue || value, type: type, spellCheck: false, id: inputId, "aria-invalid": !!error, "aria-required": !!required, "aria-describedby": (((displayErrorImmediately || touched) && (error || isHelperTextRequired) && helperText) || reserveHelperTextSpace) ? helperTextId : undefined, className: classNames(`ff-input ff-input-${variant} default-input ff-input--${size}`, {
|
|
152
155
|
['ff-input--transparentBackground']: !!transparentBackground,
|
|
153
156
|
'ff-input--disabled': !!disabled,
|
|
154
157
|
'ff-input--danger': (displayErrorImmediately || touched) && !!error,
|
|
@@ -164,13 +167,13 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
164
167
|
['arrow-container-label']: label,
|
|
165
168
|
['arrow-container-label-error']: !!error && (label || required),
|
|
166
169
|
['arrow-container-no-label-error']: !!error && !label,
|
|
167
|
-
}), children: [_jsx(Icon, { name: "arrow_up", hoverEffect: false, height: 7, width: 12, color: value == maxValue
|
|
170
|
+
}), children: [_jsx(Icon, { name: "arrow_up", tabIndex: disabled ? -1 : 0, "aria-label": "Increment", hoverEffect: false, height: 7, width: 12, color: value == maxValue
|
|
168
171
|
? 'var(--private-chip-bg-color)'
|
|
169
172
|
: 'var(--text-area-default-color)', onClick: () => {
|
|
170
173
|
if (disabled)
|
|
171
174
|
return;
|
|
172
175
|
handleIncrementDecrement('increment');
|
|
173
|
-
}, disabled: disabled }), _jsx(Icon, { name: "arrow_down", height: 7, width: 12, color: value == minValue
|
|
176
|
+
}, disabled: disabled }), _jsx(Icon, { name: "arrow_down", tabIndex: disabled ? -1 : 0, "aria-label": "Decrement", height: 7, width: 12, color: value == minValue
|
|
174
177
|
? 'var(--private-chip-bg-color)'
|
|
175
178
|
: 'var(--text-area-default-color)', onClick: () => {
|
|
176
179
|
if (disabled)
|
|
@@ -178,7 +181,7 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
178
181
|
handleIncrementDecrement('decrement');
|
|
179
182
|
}, disabled: disabled })] })), showSearchIcon && !(type === 'number') && (_jsx("div", { className: classNames('arrow-container', {
|
|
180
183
|
['arrow-container-searchIcon']: showSearchIcon,
|
|
181
|
-
}), children: _jsx(Tooltip, { title: searchIconProps?.toolTipTitle || 'search', children: _jsx(Icon, { name: searchIconProps?.name || 'search', hoverEffect: false, height: searchIconProps?.height || 14, width: searchIconProps?.height || 14, color: "var(--text-area-default-color)", onClick: (e) => {
|
|
184
|
+
}), children: _jsx(Tooltip, { title: searchIconProps?.toolTipTitle || 'search', children: _jsx(Icon, { name: searchIconProps?.name || 'search', tabIndex: searchIconProps?.disabled ? -1 : 0, "aria-label": searchIconProps?.toolTipTitle || 'search', hoverEffect: false, height: searchIconProps?.height || 14, width: searchIconProps?.height || 14, color: "var(--text-area-default-color)", onClick: (e) => {
|
|
182
185
|
if (handleSearchIconClick) {
|
|
183
186
|
handleSearchIconClick(e);
|
|
184
187
|
}
|
|
@@ -188,18 +191,18 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
188
191
|
['ff-input-clear-icon-container--with-label']: (label || required) && clearIcon,
|
|
189
192
|
['ff-input-clear-icon-container--no-label']: !label && clearIcon,
|
|
190
193
|
['ff-input-clear-icon-container--isOnly-clear-icon']: !showIcon && clearIcon,
|
|
191
|
-
}), children: _jsx(Tooltip, { title: clearIcon ? 'Clear' : '', children: _jsx(Icon, { name: clearIcon ? 'close' : '', hoverEffect: false, height: 16, width: 16, color: "var(--brand-color)", onClick: handleClearValue, disabled: iconProps?.isIconDisable, cursorType: "pointer" }) }) })), showIcon && !(type === 'number') && (_jsx("div", { className: classNames('ff-input-icon-container', {
|
|
194
|
+
}), children: _jsx(Tooltip, { title: clearIcon ? 'Clear' : '', children: _jsx(Icon, { name: clearIcon ? 'close' : '', tabIndex: iconProps?.isIconDisable ? -1 : 0, "aria-label": "Clear input", hoverEffect: false, height: 16, width: 16, color: "var(--brand-color)", onClick: handleClearValue, disabled: iconProps?.isIconDisable, cursorType: "pointer" }) }) })), showIcon && !(type === 'number') && (_jsx("div", { className: classNames('ff-input-icon-container', {
|
|
192
195
|
['ff-input-icon-container--default']: showIcon,
|
|
193
196
|
['ff-input-icon-container--error']: !!error,
|
|
194
197
|
['ff-input-icon-container--with-label']: (label || required) && showIcon,
|
|
195
198
|
['ff-input-icon-container--no-label']: !label && showIcon,
|
|
196
199
|
}), children: _jsx(Tooltip, { title: showIcon && !iconProps?.isIconDisable
|
|
197
200
|
? iconProps?.iconToolTipTitle
|
|
198
|
-
: '', children: _jsx(Icon, { name: iconProps?.iconName || '', hoverEffect: false, height: 16, width: 16, color: iconProps?.iconColor || 'var(--text-area-default-color)', onClick: (e) => {
|
|
201
|
+
: '', children: _jsx(Icon, { name: iconProps?.iconName || '', tabIndex: iconProps?.isIconDisable ? -1 : 0, "aria-label": iconProps?.iconToolTipTitle || 'icon', hoverEffect: false, height: 16, width: 16, color: iconProps?.iconColor || 'var(--text-area-default-color)', onClick: (e) => {
|
|
199
202
|
if (iconProps?.onIconClick) {
|
|
200
203
|
iconProps?.onIconClick(e);
|
|
201
204
|
}
|
|
202
|
-
}, disabled: iconProps?.isIconDisable, cursorType: "pointer" }) }) })), reserveHelperTextSpace && (_jsx("span", { className: classNames('ff-input-message', {
|
|
205
|
+
}, disabled: iconProps?.isIconDisable, cursorType: "pointer" }) }) })), reserveHelperTextSpace && (_jsx("span", { id: helperTextId, className: classNames('ff-input-message', {
|
|
203
206
|
'ff-input-message--space': !!reserveHelperTextSpace,
|
|
204
207
|
'ff-input-message--showHelperText': !!isHelperTextRequired,
|
|
205
208
|
'ff-input-message--danger': (displayErrorImmediately || touched) && !!error,
|
|
@@ -209,7 +212,7 @@ const Input = forwardRef(({ type = 'text', variant = 'primary', name = '', label
|
|
|
209
212
|
: '' })), !reserveHelperTextSpace &&
|
|
210
213
|
(displayErrorImmediately || touched) &&
|
|
211
214
|
helperText &&
|
|
212
|
-
(error || isHelperTextRequired) && (_jsx("span", { className: classNames(helperTextWidth ? 'ff-input-width' : 'ff-input-message', {
|
|
215
|
+
(error || isHelperTextRequired) && (_jsx("span", { id: helperTextId, className: classNames(helperTextWidth ? 'ff-input-width' : 'ff-input-message', {
|
|
213
216
|
'ff-input-message--showHelperText': !!isHelperTextRequired,
|
|
214
217
|
'ff-input-message--danger': !!error,
|
|
215
218
|
}), style: {
|