pixel-react-excel-sheet 1.0.20 → 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/OptionsDropdown.d.ts +5 -0
- package/lib/components/ConditionalDropdown/types.d.ts +50 -4
- package/lib/components/LabelEditTextField/types.d.ts +1 -0
- package/lib/components/MachineInputField/types.d.ts +1 -0
- package/lib/components/MenuOption/MenuOption.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +2 -1
- package/lib/components/MiniModal/types.d.ts +1 -0
- package/lib/components/NLPInput/NlpInput.d.ts +2 -2
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropDownType.d.ts +6 -3
- package/lib/components/NLPInput/components/NlpDropDown/NlpDropdown.d.ts +1 -1
- package/lib/components/NLPInput/sampleData.d.ts +104 -0
- package/lib/components/NLPInput/types.d.ts +80 -0
- package/lib/components/ProgressBar/ProgressBar.d.ts +5 -0
- package/lib/components/ProgressBar/index.d.ts +1 -0
- package/lib/components/ProgressBar/types.d.ts +12 -0
- package/lib/components/SequentialConnectingBranch/components/Branches/Branches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/Branches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.d.ts +1 -1
- package/lib/components/SequentialConnectingBranch/components/ConnectingBranches/types.d.ts +1 -0
- package/lib/components/SequentialConnectingBranch/types.d.ts +1 -1
- package/lib/components/TableTree/types.d.ts +1 -1
- package/lib/hooks/useIntersectionObserver.d.ts +9 -0
- package/lib/index.d.ts +80 -28
- package/lib/index.esm.js +707 -405
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +707 -404
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/functionCheck/functionCheck.d.ts +2 -0
- package/package.json +1 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +5 -0
- package/src/assets/Themes/BaseTheme.scss +18 -3
- package/src/assets/Themes/DarkTheme.scss +15 -2
- package/src/assets/icons/ai_search.svg +9 -0
- package/src/assets/icons/help_icon.svg +10 -0
- package/src/assets/icons/ios_icon.svg +11 -0
- package/src/assets/icons/plus_round_icon.svg +38 -0
- package/src/assets/icons/tick_icon.svg +2 -2
- package/src/assets/styles/_colors.scss +1 -1
- package/src/components/AttachmentButton/AttachmentButton.tsx +1 -1
- package/src/components/Checkbox/Checkbox.scss +3 -1
- package/src/components/Checkbox/Checkbox.stories.tsx +32 -77
- package/src/components/Checkbox/Checkbox.tsx +3 -4
- package/src/components/Chip/Chip.scss +15 -5
- package/src/components/Chip/Chip.stories.tsx +10 -1
- package/src/components/Chip/Chip.tsx +5 -1
- package/src/components/Chip/types.ts +1 -1
- package/src/components/ConditionalDropdown/ConditionalDropdown.scss +4 -0
- package/src/components/ConditionalDropdown/ConditionalDropdown.stories.tsx +67 -2
- package/src/components/ConditionalDropdown/ConditionalDropdown.tsx +58 -28
- package/src/components/ConditionalDropdown/OptionsDropdown.tsx +44 -0
- package/src/components/ConditionalDropdown/types.ts +61 -4
- package/src/components/EditTextField/EditTextField.scss +1 -1
- package/src/components/EditTextField/EditTextField.tsx +14 -20
- package/src/components/Form/Forms.tsx +0 -2
- package/src/components/Icon/iconList.ts +9 -0
- package/src/components/LabelEditTextField/LabelEditTextField.scss +1 -1
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +29 -36
- package/src/components/LabelEditTextField/types.ts +1 -0
- package/src/components/MachineInputField/MachineInputField.scss +1 -5
- package/src/components/MachineInputField/MachineInputField.stories.tsx +4 -4
- package/src/components/MachineInputField/MachineInputField.tsx +4 -1
- package/src/components/MachineInputField/types.ts +1 -0
- package/src/components/MenuOption/MenuOption.scss +7 -7
- package/src/components/MenuOption/MenuOption.stories.tsx +83 -28
- package/src/components/MenuOption/MenuOption.tsx +9 -13
- package/src/components/MenuOption/types.ts +3 -2
- package/src/components/MiniModal/MiniModal.scss +0 -1
- package/src/components/MiniModal/MiniModal.stories.tsx +6 -1
- package/src/components/MiniModal/MiniModal.tsx +3 -1
- package/src/components/MiniModal/types.ts +1 -0
- package/src/components/MultiSelect/Dropdown.scss +3 -4
- package/src/components/MultiSelect/Dropdown.tsx +4 -3
- package/src/components/MultiSelect/MultiSelect.scss +1 -0
- package/src/components/MultiSelect/MultiSelect.tsx +1 -0
- package/src/components/NLPInput/NLPInput.scss +77 -21
- package/src/components/NLPInput/NlpInput.stories.tsx +43 -109
- package/src/components/NLPInput/NlpInput.tsx +95 -59
- package/src/components/NLPInput/components/NlpDropDown/NlpDropDownType.ts +6 -4
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.scss +86 -35
- package/src/components/NLPInput/components/NlpDropDown/NlpDropdown.tsx +220 -80
- package/src/components/NLPInput/sampleData.ts +162 -0
- package/src/components/NLPInput/{type.tsx → types.tsx} +23 -11
- package/src/components/ProgressBar/ProgressBar.scss +46 -0
- package/src/components/ProgressBar/ProgressBar.stories.tsx +22 -0
- package/src/components/ProgressBar/ProgressBar.tsx +61 -0
- package/src/components/ProgressBar/index.ts +1 -0
- package/src/components/ProgressBar/types.ts +12 -0
- package/src/components/Search/Search.tsx +9 -1
- package/src/components/SequentialConnectingBranch/SequentialConnectingBranch.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/Branches/Branches.tsx +8 -0
- package/src/components/SequentialConnectingBranch/components/Branches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/ConnectingBranches.tsx +2 -0
- package/src/components/SequentialConnectingBranch/components/ConnectingBranches/types.ts +1 -0
- package/src/components/SequentialConnectingBranch/types.ts +1 -1
- package/src/components/Table/Table.scss +1 -0
- package/src/components/TableTree/Components/TableBody.tsx +3 -1
- package/src/components/TableTree/TableTree.stories.tsx +2 -2
- package/src/components/TableTree/TableTree.tsx +24 -14
- package/src/components/TableTree/data.ts +45 -0
- package/src/components/TableTree/types.ts +1 -1
- package/src/hooks/useIntersectionObserver.tsx +56 -0
- package/src/index.ts +2 -0
- package/src/utils/functionCheck/functionCheck.ts +8 -0
|
@@ -15,13 +15,11 @@
|
|
|
15
15
|
|
|
16
16
|
@mixin opacity-style($opacity: 1, $color: null, $border-color-arg: null) {
|
|
17
17
|
opacity: $opacity;
|
|
18
|
-
|
|
19
18
|
@if $color {
|
|
20
|
-
color:
|
|
19
|
+
color: var(--nlp-input-placeholder-color);
|
|
21
20
|
}
|
|
22
|
-
|
|
23
21
|
@if $border-color-arg {
|
|
24
|
-
border-color:
|
|
22
|
+
border-color: var(--nlp-border-color);
|
|
25
23
|
}
|
|
26
24
|
}
|
|
27
25
|
|
|
@@ -29,22 +27,20 @@
|
|
|
29
27
|
position: relative;
|
|
30
28
|
|
|
31
29
|
.ff-nlp-input {
|
|
32
|
-
@extend .fontSm;
|
|
33
30
|
margin: 0;
|
|
34
31
|
padding: 0;
|
|
35
32
|
box-sizing: border-box;
|
|
36
33
|
min-height: 32px;
|
|
37
|
-
min-width:
|
|
34
|
+
min-width: 482px;
|
|
38
35
|
display: flex;
|
|
39
36
|
align-items: end;
|
|
40
37
|
position: relative;
|
|
41
|
-
|
|
42
38
|
&-fieldset {
|
|
43
39
|
margin: 0;
|
|
44
40
|
padding: 25px 0px 0px 8px;
|
|
45
41
|
border: 1px solid transparent;
|
|
46
42
|
box-sizing: border-box;
|
|
47
|
-
height:
|
|
43
|
+
height: 32px;
|
|
48
44
|
width: 100%;
|
|
49
45
|
border-radius: 4px;
|
|
50
46
|
display: block;
|
|
@@ -81,7 +77,6 @@
|
|
|
81
77
|
@extend .font-size-8;
|
|
82
78
|
padding: 0 2px;
|
|
83
79
|
letter-spacing: 0.5px;
|
|
84
|
-
|
|
85
80
|
&--default {
|
|
86
81
|
@include transition-all(0.3s);
|
|
87
82
|
opacity: 0;
|
|
@@ -106,11 +101,10 @@
|
|
|
106
101
|
}
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
&-
|
|
110
|
-
@extend .fontSm;
|
|
104
|
+
&-container {
|
|
111
105
|
@include absolute-position(6px, auto, auto, auto);
|
|
112
106
|
width: calc(100% - 38px);
|
|
113
|
-
|
|
107
|
+
height: 32px;
|
|
114
108
|
padding: 0 28px 0 8px;
|
|
115
109
|
border-radius: 4px;
|
|
116
110
|
border: 1px solid transparent;
|
|
@@ -118,10 +112,12 @@
|
|
|
118
112
|
background: transparent;
|
|
119
113
|
outline: none;
|
|
120
114
|
color: var(--ff-nlp-input-text-color);
|
|
115
|
+
text-indent: 22px;
|
|
121
116
|
|
|
122
117
|
&:hover {
|
|
123
118
|
~ .ff-nlp-input-label {
|
|
124
|
-
color: var(--
|
|
119
|
+
color: var(--nlp-input-placeholder-color);
|
|
120
|
+
padding-left: 26px;
|
|
125
121
|
}
|
|
126
122
|
}
|
|
127
123
|
|
|
@@ -133,7 +129,7 @@
|
|
|
133
129
|
@include opacity-style(1, null, var(--ff-nlp-input-border-color));
|
|
134
130
|
|
|
135
131
|
&:hover {
|
|
136
|
-
border-color: var(--
|
|
132
|
+
border-color: var(--nlp-input-placeholder-color);
|
|
137
133
|
|
|
138
134
|
~ .ff-nlp-input-fieldset--option {
|
|
139
135
|
border-color: var(--ff-nlp-input-text-color);
|
|
@@ -208,7 +204,6 @@
|
|
|
208
204
|
}
|
|
209
205
|
|
|
210
206
|
&--active {
|
|
211
|
-
@extend .font-size-8;
|
|
212
207
|
@include transition-all;
|
|
213
208
|
opacity: 0;
|
|
214
209
|
transform: translateY(-150%);
|
|
@@ -225,17 +220,12 @@
|
|
|
225
220
|
top: 60%;
|
|
226
221
|
height: 100%;
|
|
227
222
|
right: 10px;
|
|
228
|
-
transform: rotateX(
|
|
223
|
+
transform: rotateX(0deg) translateY(-50%);
|
|
229
224
|
cursor: pointer;
|
|
230
225
|
|
|
231
226
|
&--no-label {
|
|
232
227
|
top: 50%;
|
|
233
228
|
}
|
|
234
|
-
|
|
235
|
-
&--down {
|
|
236
|
-
transform: rotateX(0deg) translateY(-50%);
|
|
237
|
-
z-index: 101;
|
|
238
|
-
}
|
|
239
229
|
}
|
|
240
230
|
}
|
|
241
231
|
|
|
@@ -243,4 +233,70 @@
|
|
|
243
233
|
@include absolute-position(auto, auto, -14px, 12px);
|
|
244
234
|
white-space: nowrap;
|
|
245
235
|
}
|
|
236
|
+
.ff-nlp-input-label {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
padding-left: 26px;
|
|
240
|
+
gap: 4px;
|
|
241
|
+
}
|
|
242
|
+
.ff-nlp-help_icon {
|
|
243
|
+
position: absolute;
|
|
244
|
+
bottom: 2px;
|
|
245
|
+
left: 8px;
|
|
246
|
+
width: 30px;
|
|
247
|
+
height: 30px;
|
|
248
|
+
z-index: 100;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
.ff-nlp-input-arrow {
|
|
253
|
+
z-index: 111;
|
|
254
|
+
}
|
|
255
|
+
.icon-container {
|
|
256
|
+
position: relative;
|
|
257
|
+
display: inline-block;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.icon-label {
|
|
261
|
+
position: absolute;
|
|
262
|
+
bottom: 100%;
|
|
263
|
+
left: 50%;
|
|
264
|
+
transform: translateX(-55%);
|
|
265
|
+
transform: translateY(-145%);
|
|
266
|
+
margin-bottom: 5px;
|
|
267
|
+
visibility: hidden;
|
|
268
|
+
opacity: 0;
|
|
269
|
+
transition: opacity 0.3s ease, visibility 0s linear 0.3s;
|
|
270
|
+
background-color: var(--tooltip-bg-color);
|
|
271
|
+
color: var(--tooltip-text-color);
|
|
272
|
+
padding: 2px 5px;
|
|
273
|
+
border-radius: 3px;
|
|
274
|
+
white-space: nowrap;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.icon-container:hover .icon-label {
|
|
278
|
+
visibility: visible;
|
|
279
|
+
opacity: 1;
|
|
280
|
+
transition-delay: 0s;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.help-icon-label {
|
|
284
|
+
position: absolute;
|
|
285
|
+
bottom: 80%;
|
|
286
|
+
left: 96%;
|
|
287
|
+
transform: translateX(-50%);
|
|
288
|
+
margin-bottom: 5px;
|
|
289
|
+
visibility: hidden;
|
|
290
|
+
opacity: 0;
|
|
291
|
+
transition: opacity 0.3s ease, visibility 0s linear 0.3s;
|
|
292
|
+
background-color: var(--tooltip-bg-color);
|
|
293
|
+
color: var(--tooltip-text-color);
|
|
294
|
+
padding: 2px 5px;
|
|
295
|
+
border-radius: 3px;
|
|
296
|
+
white-space: nowrap;
|
|
297
|
+
}
|
|
298
|
+
.help-icon-container:hover .help-icon-label {
|
|
299
|
+
visibility: visible;
|
|
300
|
+
opacity: 1;
|
|
301
|
+
transition-delay: 0s;
|
|
246
302
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import NlpInput from './NlpInput';
|
|
3
|
-
|
|
4
|
-
// import { Option } from '../NLPInput/type';
|
|
4
|
+
import { nlpList } from './sampleData';
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof NlpInput> = {
|
|
7
7
|
title: 'Components/NlpInput',
|
|
@@ -14,74 +14,48 @@ const meta: Meta<typeof NlpInput> = {
|
|
|
14
14
|
|
|
15
15
|
type Story = StoryObj<typeof NlpInput>;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// Refactor primaryNlp to utilize args for control panel
|
|
18
|
+
export const PrimaryNlp: Story = {
|
|
18
19
|
args: {
|
|
19
|
-
label: 'NLP
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
], // Placeholder, replace with actual data if needed
|
|
59
|
-
toolTip: 'Logics : randomNumber',
|
|
60
|
-
_class: 'com.tyss.optimize.data.models.db.model.ProgramElementNlp',
|
|
61
|
-
_id: 'PE_NLPdbed27d0-b05a-4354-b9d3-c2f85307b4f2',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
description: '',
|
|
65
|
-
displayName: 'Open Browser 1',
|
|
66
|
-
failMessage: 'Open Browser is failed',
|
|
67
|
-
imported: false,
|
|
68
|
-
libraryId: 'LIB1002',
|
|
69
|
-
name: 'Open Browser',
|
|
70
|
-
nlpName: 'Open Browser',
|
|
71
|
-
nlpType: 'STEP_GROUP',
|
|
72
|
-
parentId: 'STP_GRP1001',
|
|
73
|
-
passMessage: 'Open Browser is passed',
|
|
74
|
-
path: '/Root/Open and Close Browser/Open Browser',
|
|
75
|
-
platform: 'Web',
|
|
76
|
-
projectId: 'PJT1001',
|
|
77
|
-
returnType: 'void',
|
|
78
|
-
searchName: 'Open Browser',
|
|
79
|
-
stepInputs: [], // Empty array for step inputs
|
|
80
|
-
toolTip: 'Open and Close Browser : Open Browser : Web',
|
|
81
|
-
_class: 'com.tyss.optimize.data.models.db.model.StepGroupNlp',
|
|
82
|
-
_id: 'SG_NLP1001',
|
|
83
|
-
},
|
|
84
|
-
],
|
|
20
|
+
label: 'Search NLP',
|
|
21
|
+
leftIcon: 'ai_search',
|
|
22
|
+
rightIcon: 'help_icon',
|
|
23
|
+
rightIconColor: 'var(--nlp-color)',
|
|
24
|
+
containerWidth: '1000px',
|
|
25
|
+
value: '',
|
|
26
|
+
optionsList: nlpList,
|
|
27
|
+
},
|
|
28
|
+
render: (args) => {
|
|
29
|
+
const [inputValue, setInputValue] = useState(args.value);
|
|
30
|
+
const [optionList, setOptionList] = useState(args.optionsList);
|
|
31
|
+
|
|
32
|
+
const handleChange = (e) => {
|
|
33
|
+
setInputValue(e.target.value);
|
|
34
|
+
setOptionList(nlpList);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleSelect = (e) => {
|
|
38
|
+
setInputValue(e.displayName);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<NlpInput
|
|
43
|
+
{...args}
|
|
44
|
+
value={inputValue}
|
|
45
|
+
onChange={handleChange}
|
|
46
|
+
onSelect={handleSelect}
|
|
47
|
+
optionsList={optionList}
|
|
48
|
+
webServiceClick={() => {
|
|
49
|
+
alert('webServiceClick!');
|
|
50
|
+
}}
|
|
51
|
+
onHelpIconClick={() => {
|
|
52
|
+
alert('Help icon clicked!!');
|
|
53
|
+
}}
|
|
54
|
+
aiIconClick={() => {
|
|
55
|
+
alert('aiIconClick!');
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
85
59
|
},
|
|
86
60
|
};
|
|
87
61
|
|
|
@@ -93,44 +67,4 @@ export const Disable: Story = {
|
|
|
93
67
|
},
|
|
94
68
|
};
|
|
95
69
|
|
|
96
|
-
// export const WithInitialValue: Story = {
|
|
97
|
-
// args: {
|
|
98
|
-
// label: 'NLP Input',
|
|
99
|
-
// selectedOption: { label: 'Option 2', value: '2' },
|
|
100
|
-
// optionsList: [
|
|
101
|
-
// { label: 'NLP 1', value: '1' },
|
|
102
|
-
// { label: 'NLP 2', value: '2' },
|
|
103
|
-
// { label: 'NLP 3', value: '3' },
|
|
104
|
-
// ],
|
|
105
|
-
// },
|
|
106
|
-
// };
|
|
107
|
-
|
|
108
|
-
// export const OptionSelection: Story = {
|
|
109
|
-
// render: () => {
|
|
110
|
-
// const optionsList = [
|
|
111
|
-
// { label: 'NLP 1', value: '1' },
|
|
112
|
-
// { label: 'NLP 2', value: '2' },
|
|
113
|
-
// { label: 'NLP 3', value: '3' },
|
|
114
|
-
// ];
|
|
115
|
-
|
|
116
|
-
// const [selectedOption, setSelectedOption] = useState<Option>({
|
|
117
|
-
// label: 'NLP 2',
|
|
118
|
-
// value: '2',
|
|
119
|
-
// });
|
|
120
|
-
|
|
121
|
-
// const handleChange = (option: Option) => {
|
|
122
|
-
// setSelectedOption(option);
|
|
123
|
-
// };
|
|
124
|
-
|
|
125
|
-
// return (
|
|
126
|
-
// <NlpInput
|
|
127
|
-
// label="NLP Input"
|
|
128
|
-
// optionsList={optionsList}
|
|
129
|
-
// selectedOption={selectedOption}
|
|
130
|
-
// onChange={handleChange}
|
|
131
|
-
// />
|
|
132
|
-
// );
|
|
133
|
-
// },
|
|
134
|
-
// };
|
|
135
|
-
|
|
136
70
|
export default meta;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { useReducer, useRef, useEffect, useMemo } from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { useReducer, useRef, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NlpRenderOption,
|
|
4
|
+
SelectAction,
|
|
5
|
+
SelectProps,
|
|
6
|
+
SelectState,
|
|
7
|
+
} from './types';
|
|
3
8
|
import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
|
|
4
9
|
import { createPortal } from 'react-dom';
|
|
5
10
|
import classNames from 'classnames';
|
|
@@ -29,7 +34,6 @@ const nlpInputReducer = (
|
|
|
29
34
|
options: action.payload.optionsList,
|
|
30
35
|
option: action.payload.option,
|
|
31
36
|
|
|
32
|
-
// todo color need to be add in style guide
|
|
33
37
|
iconColor: 'var(--ff-nlp-input-default-color)',
|
|
34
38
|
isIconClick: false,
|
|
35
39
|
showOptions: false,
|
|
@@ -47,8 +51,7 @@ const nlpInputReducer = (
|
|
|
47
51
|
case 'MOUSE_LEAVE':
|
|
48
52
|
return state.isInputFocused
|
|
49
53
|
? state
|
|
50
|
-
:
|
|
51
|
-
{
|
|
54
|
+
: {
|
|
52
55
|
...state,
|
|
53
56
|
iconColor: 'var(--ff-nlp-input-default-color)',
|
|
54
57
|
isIconClick: false,
|
|
@@ -102,7 +105,14 @@ const nlpInputReducer = (
|
|
|
102
105
|
|
|
103
106
|
const NlpInput = ({
|
|
104
107
|
label = '',
|
|
108
|
+
leftIcon,
|
|
109
|
+
rightIcon,
|
|
110
|
+
rightIconColor,
|
|
105
111
|
showLabel = true,
|
|
112
|
+
onHelpIconClick = () => {},
|
|
113
|
+
aiIconClick = () => {},
|
|
114
|
+
webServiceClick = () => {},
|
|
115
|
+
containerWidth = '',
|
|
106
116
|
optionsList = [],
|
|
107
117
|
selectedOption = {
|
|
108
118
|
displayName: '',
|
|
@@ -118,17 +128,22 @@ const NlpInput = ({
|
|
|
118
128
|
borderRadius = true,
|
|
119
129
|
showBorder = true,
|
|
120
130
|
required = false,
|
|
131
|
+
value = '',
|
|
132
|
+
onSelect = () => {},
|
|
121
133
|
}: SelectProps) => {
|
|
122
134
|
const initialState: SelectState = useMemo(
|
|
123
135
|
() => ({
|
|
124
136
|
isInputFocused: false,
|
|
125
137
|
|
|
126
|
-
// todo color need to be added in style guide
|
|
127
138
|
iconColor: 'var(--ff-nlp-input-default-color)',
|
|
128
139
|
isIconClick: false,
|
|
129
140
|
showOptions: false,
|
|
130
141
|
options: optionsList,
|
|
131
|
-
option:
|
|
142
|
+
option:
|
|
143
|
+
checkEmpty(selectedOption) &&
|
|
144
|
+
typeof selectedOption?.displayName === 'string'
|
|
145
|
+
? selectedOption.displayName
|
|
146
|
+
: '',
|
|
132
147
|
dropdownPosition: { positionX: 0, positionY: 0, width: 0, fromBottom: 0 },
|
|
133
148
|
}),
|
|
134
149
|
[optionsList, selectedOption]
|
|
@@ -139,12 +154,29 @@ const NlpInput = ({
|
|
|
139
154
|
initialState
|
|
140
155
|
);
|
|
141
156
|
|
|
157
|
+
const [inputVal, setInputVal] = useState<NlpRenderOption>(selectedOption);
|
|
158
|
+
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
const updatedDisplayName =
|
|
161
|
+
typeof selectedOption.displayName === 'string'
|
|
162
|
+
? selectedOption.displayName
|
|
163
|
+
: String(selectedOption.displayName ?? '');
|
|
164
|
+
|
|
165
|
+
if (updatedDisplayName !== inputVal.displayName) {
|
|
166
|
+
setInputVal({ ...selectedOption, displayName: updatedDisplayName });
|
|
167
|
+
}
|
|
168
|
+
}, [selectedOption]);
|
|
169
|
+
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (value) {
|
|
172
|
+
handleSelectAction('FOCUS_INPUT');
|
|
173
|
+
}
|
|
174
|
+
}, [value]);
|
|
142
175
|
const DropDownRef = useRef<HTMLDivElement>(null);
|
|
143
176
|
const InputRef = useRef<HTMLInputElement>(null);
|
|
144
177
|
|
|
145
178
|
const {
|
|
146
179
|
isInputFocused,
|
|
147
|
-
iconColor,
|
|
148
180
|
isIconClick,
|
|
149
181
|
showOptions,
|
|
150
182
|
dropdownPosition,
|
|
@@ -166,7 +198,13 @@ const NlpInput = ({
|
|
|
166
198
|
if (actionType === 'SHOW_ERROR' || actionType === 'BLUR_INPUT') {
|
|
167
199
|
dispatch({
|
|
168
200
|
type: actionType,
|
|
169
|
-
payload: {
|
|
201
|
+
payload: {
|
|
202
|
+
optionsList,
|
|
203
|
+
option:
|
|
204
|
+
typeof selectedOption.displayName === 'string'
|
|
205
|
+
? selectedOption.displayName
|
|
206
|
+
: String(selectedOption.displayName ?? ''),
|
|
207
|
+
},
|
|
170
208
|
});
|
|
171
209
|
} else {
|
|
172
210
|
dispatch({ type: actionType });
|
|
@@ -174,18 +212,11 @@ const NlpInput = ({
|
|
|
174
212
|
}
|
|
175
213
|
};
|
|
176
214
|
|
|
177
|
-
const onSelectInputChange = (
|
|
215
|
+
const onSelectInputChange = (
|
|
216
|
+
e: React.ChangeEvent<HTMLInputElement> | any
|
|
217
|
+
) => {
|
|
178
218
|
if (disabled) return;
|
|
179
|
-
|
|
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 });
|
|
219
|
+
onChange(e);
|
|
189
220
|
};
|
|
190
221
|
|
|
191
222
|
const onSelectBlur = () => {
|
|
@@ -198,14 +229,8 @@ const NlpInput = ({
|
|
|
198
229
|
}
|
|
199
230
|
};
|
|
200
231
|
|
|
201
|
-
const onSelectOptionSelector = (option:
|
|
202
|
-
|
|
203
|
-
onSelectBlur();
|
|
204
|
-
dispatch({ type: 'UPDATE_OPTION', payload: option.projectId });
|
|
205
|
-
if (onChange) {
|
|
206
|
-
onChange(option);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
232
|
+
const onSelectOptionSelector = (option: NlpRenderOption) => {
|
|
233
|
+
onSelect(option);
|
|
209
234
|
};
|
|
210
235
|
|
|
211
236
|
const onSelectUpdatePosition = () => {
|
|
@@ -255,29 +280,40 @@ const NlpInput = ({
|
|
|
255
280
|
<div className="ff-nlp-input">
|
|
256
281
|
<input
|
|
257
282
|
type="text"
|
|
258
|
-
className={classNames('ff-nlp-input-
|
|
259
|
-
'ff-nlp-input-
|
|
260
|
-
'ff-nlp-input-
|
|
261
|
-
'ff-nlp-input-
|
|
262
|
-
'ff-nlp-input-
|
|
283
|
+
className={classNames('ff-nlp-input-container', {
|
|
284
|
+
'ff-nlp-input-container--default': !isInputFocused,
|
|
285
|
+
'ff-nlp-input-container--active': applyActiveOptionClasses,
|
|
286
|
+
'ff-nlp-input-container--no-label': !showLabel,
|
|
287
|
+
'ff-nlp-input-container--error':
|
|
263
288
|
errorMsg && !isInputFocused && !Boolean(option),
|
|
264
|
-
'ff-nlp-input-
|
|
265
|
-
'ff-nlp-input-
|
|
266
|
-
'ff-nlp-input-
|
|
289
|
+
'ff-nlp-input-container--border-radius': !borderRadius,
|
|
290
|
+
'ff-nlp-input-container--disable': disabled,
|
|
291
|
+
'ff-nlp-input-container--no-border': !showBorder,
|
|
267
292
|
})}
|
|
268
|
-
// inline css required due to multiple overlay scenarios are present
|
|
269
293
|
style={{ zIndex: optionZIndex }}
|
|
270
294
|
onFocus={() => handleSelectAction('FOCUS_INPUT')}
|
|
271
295
|
onMouseEnter={() => handleSelectAction('MOUSE_ENTER')}
|
|
272
296
|
onMouseLeave={() => handleSelectAction('MOUSE_LEAVE')}
|
|
273
297
|
onChange={onSelectInputChange}
|
|
274
|
-
value={
|
|
298
|
+
value={value}
|
|
275
299
|
disabled={disabled}
|
|
276
300
|
autoComplete="off"
|
|
277
301
|
spellCheck="false"
|
|
278
302
|
ref={InputRef}
|
|
279
303
|
/>
|
|
280
304
|
|
|
305
|
+
<div className="icon-container">
|
|
306
|
+
<Icon
|
|
307
|
+
name={leftIcon || 'ai_search'}
|
|
308
|
+
className="ff-nlp-help_icon"
|
|
309
|
+
width={16}
|
|
310
|
+
height={16}
|
|
311
|
+
onClick={aiIconClick}
|
|
312
|
+
/>
|
|
313
|
+
<Typography className="icon-label" fontSize={10}>
|
|
314
|
+
Search With Ai
|
|
315
|
+
</Typography>
|
|
316
|
+
</div>
|
|
281
317
|
{showLabel && (
|
|
282
318
|
<div
|
|
283
319
|
className={classNames('ff-nlp-input-label', {
|
|
@@ -294,20 +330,27 @@ const NlpInput = ({
|
|
|
294
330
|
*
|
|
295
331
|
</Typography>
|
|
296
332
|
)}
|
|
333
|
+
|
|
297
334
|
{label}
|
|
298
335
|
</div>
|
|
299
336
|
)}
|
|
300
337
|
|
|
301
|
-
<
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
'ff-nlp-input-arrow
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
338
|
+
<div className="help-icon-container">
|
|
339
|
+
<Icon
|
|
340
|
+
name={rightIcon || ''}
|
|
341
|
+
height={16}
|
|
342
|
+
width={16}
|
|
343
|
+
onClick={onHelpIconClick}
|
|
344
|
+
className={classNames('ff-nlp-input-arrow', {
|
|
345
|
+
'ff-nlp-input-arrow--down': !isIconClick,
|
|
346
|
+
'ff-nlp-input-arrow--no-label': !showLabel,
|
|
347
|
+
})}
|
|
348
|
+
color={rightIconColor}
|
|
349
|
+
/>
|
|
350
|
+
<Typography className="help-icon-label" fontSize={10}>
|
|
351
|
+
Help
|
|
352
|
+
</Typography>
|
|
353
|
+
</div>
|
|
311
354
|
<fieldset
|
|
312
355
|
className={classNames('ff-nlp-input-fieldset', {
|
|
313
356
|
'ff-nlp-input-fieldset--no-label': !showLabel,
|
|
@@ -319,7 +362,7 @@ const NlpInput = ({
|
|
|
319
362
|
'ff-nlp-input-fieldset--no-border': !showBorder,
|
|
320
363
|
})}
|
|
321
364
|
>
|
|
322
|
-
{
|
|
365
|
+
{showLabel && (
|
|
323
366
|
<legend
|
|
324
367
|
className={classNames('ff-nlp-input-legend', {
|
|
325
368
|
'ff-nlp-input-legend--default': !isInputFocused,
|
|
@@ -328,18 +371,9 @@ const NlpInput = ({
|
|
|
328
371
|
'ff-nlp-input-legend--error': errorMsg,
|
|
329
372
|
})}
|
|
330
373
|
>
|
|
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
374
|
{label}
|
|
341
375
|
</legend>
|
|
342
|
-
)}
|
|
376
|
+
)}
|
|
343
377
|
</fieldset>
|
|
344
378
|
</div>
|
|
345
379
|
|
|
@@ -363,6 +397,8 @@ const NlpInput = ({
|
|
|
363
397
|
options={options}
|
|
364
398
|
optionZIndex={optionZIndex}
|
|
365
399
|
inputRef={InputRef}
|
|
400
|
+
webServiceClick={webServiceClick}
|
|
401
|
+
containerWidth = {containerWidth}
|
|
366
402
|
/>,
|
|
367
403
|
document.body
|
|
368
404
|
)}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { DrowdownPosition,
|
|
1
|
+
import { DrowdownPosition, NlpRenderOption } from '../../types';
|
|
2
2
|
|
|
3
3
|
export interface NlpDropDownListProps {
|
|
4
4
|
/*
|
|
5
5
|
* Callback function triggered on blur event
|
|
6
6
|
*/
|
|
7
7
|
onSelectBlur: () => void;
|
|
8
|
-
|
|
8
|
+
leftIcon?: string;
|
|
9
|
+
webServiceClick?: () => void;
|
|
10
|
+
containerWidth?:string | number,
|
|
9
11
|
/*
|
|
10
12
|
* Callback function triggered when an option is selected
|
|
11
13
|
*/
|
|
12
|
-
onSelectOptionSelector: (option:
|
|
14
|
+
onSelectOptionSelector: (option: NlpRenderOption) => void;
|
|
13
15
|
|
|
14
16
|
/*
|
|
15
17
|
* Position of the dropdown relative to the input
|
|
@@ -19,7 +21,7 @@ export interface NlpDropDownListProps {
|
|
|
19
21
|
/*
|
|
20
22
|
* List of options to display in the dropdown
|
|
21
23
|
*/
|
|
22
|
-
options?:
|
|
24
|
+
options?: NlpRenderOption[];
|
|
23
25
|
|
|
24
26
|
/*
|
|
25
27
|
* Optional z-index for controlling the dropdown's stacking order
|