1
- import { Badge , Button , Caption1 , Caption2 , Text } from '@fluentui/react-components' ;
1
+ import { Badge , Button , Caption1 , Text } from '@fluentui/react-components' ;
2
2
import { AddRegular , DeleteRegular } from '@fluentui/react-icons' ;
3
3
import { useDispatch , useSelector } from 'react-redux' ;
4
4
import { UnboundedInput } from '../../../constants/FunctionConstants' ;
@@ -14,7 +14,6 @@ import type { ConnectionDictionary, NodeConnection, CustomValueConnection, Input
14
14
import { getInputName , getInputValue } from '../../../utils/Function.Utils' ;
15
15
import type { InputOptionProps } from '../inputDropdown/InputDropdown' ;
16
16
import { InputDropdown } from '../inputDropdown/InputDropdown' ;
17
- import { useStyles } from './styles' ;
18
17
import { isSchemaNodeExtended } from '../../../utils' ;
19
18
import {
20
19
connectionDoesExist ,
@@ -28,6 +27,7 @@ import InputListWrapper, { type TemplateItemProps, type CommonProps } from './In
28
27
import { useCallback , useMemo } from 'react' ;
29
28
import { useIntl } from 'react-intl' ;
30
29
import { InputCustomInfoLabel } from './inputCustomInfoLabel' ;
30
+ import { useStyles } from './styles' ;
31
31
32
32
export const InputTabContents = ( props : {
33
33
func : FunctionData ;
@@ -99,43 +99,50 @@ export const InputTabContents = (props: {
99
99
} ;
100
100
101
101
return (
102
- < div className = { styles . boundedInputRow } key = { index } >
103
- < div className = { styles . boundedInputTopRow } >
104
- < div className = { styles . inputNameDiv } >
105
- < Caption1 className = { styles . inputName } > { input . name } </ Caption1 >
106
- < Caption2 > { input . tooltip ?? input . placeHolder ?? '' } </ Caption2 >
102
+ < div className = { styles . row } key = { index } >
103
+ < div className = { styles . header } >
104
+ < div className = { styles . titleContainer } >
105
+ < div >
106
+ < Caption1 className = { styles . titleText } >
107
+ { input . name }
108
+ < Text className = { styles . titleRequiredLabelText } > { input . isOptional ? '' : '*' } </ Text >
109
+ </ Caption1 >
110
+ < InputCustomInfoLabel />
111
+ </ div >
112
+ < Text className = { styles . titleText } >
113
+ < span className = { styles . titleLabelText } > { resources . ACCEPTED_TYPES } </ span >
114
+ { input . allowedTypes }
115
+ </ Text >
116
+ </ div >
117
+ < div className = { styles . descriptionContainer } >
118
+ < Text className = { styles . descriptionText } > { input . tooltip ?? input . placeHolder ?? '' } </ Text >
107
119
</ div >
108
- < Caption2 className = { styles . allowedTypesComponent } >
109
- < Text className = { styles . typesParent } > { resources . ACCEPTED_TYPES } </ Text >
110
- { input . allowedTypes }
111
- </ Caption2 >
112
- < InputCustomInfoLabel />
113
120
</ div >
114
- < div >
115
- < span className = { styles . inputDropdownWrapper } >
116
- < InputDropdown
117
- index = { index }
118
- schemaListType = { SchemaType . Source }
119
- functionId = { props . functionKey }
120
- currentNode = { props . func }
121
- inputName = { getInputName ( inputConnection , connections ) }
122
- inputValue = { getInputValue ( inputConnection ) }
123
- validateAndCreateConnection = { validateAndCreateConnection }
124
- />
125
- </ span >
126
- < span className = { styles . badgeWrapper } >
121
+ < div className = { styles . body } >
122
+ < div className = { styles . formControlWrapper } >
123
+ < span className = { styles . formControl } >
124
+ < InputDropdown
125
+ index = { index }
126
+ schemaListType = { SchemaType . Source }
127
+ functionId = { props . functionKey }
128
+ currentNode = { props . func }
129
+ inputName = { getInputName ( inputConnection , connections ) }
130
+ inputValue = { getInputValue ( inputConnection ) }
131
+ validateAndCreateConnection = { validateAndCreateConnection }
132
+ / >
133
+ </ span >
127
134
{ inputType && (
128
135
< Badge appearance = "filled" color = "informative" >
129
136
{ inputType }
130
137
</ Badge >
131
138
) }
132
- </ span >
133
- < Button
134
- className = { styles . listButton }
135
- appearance = "transparent"
136
- icon = { < DeleteRegular /> }
137
- onClick = { ( ) => removeConnection ( index ) }
138
- / >
139
+ < Button
140
+ className = { styles . controlButton }
141
+ appearance = "transparent"
142
+ icon = { < DeleteRegular /> }
143
+ onClick = { ( ) => removeConnection ( index ) }
144
+ />
145
+ </ div >
139
146
</ div >
140
147
</ div >
141
148
) ;
@@ -201,44 +208,54 @@ const UnlimitedInputs = (props: {
201
208
) ;
202
209
203
210
return (
204
- < div >
205
- < div >
206
- < span className = { styles . unlimitedInputHeaderCell } key = "input-name" >
207
- < Caption1 > { `${ inputsFromManifest [ 0 ] . name } ${ inputsFromManifest [ 0 ] . isOptional ? ` (${ stringResources . OPTIONAL } )` : '' } ` } </ Caption1 >
208
- < InputCustomInfoLabel />
209
- </ span >
210
- < span className = { styles . unlimitedInputHeaderCell } key = "input-types" >
211
- < Caption2 >
212
- < Text className = { styles . typesParent } > { stringResources . ACCEPT_TYPES } </ Text >
211
+ < div className = { styles . row } >
212
+ < div className = { styles . header } >
213
+ < div className = { styles . titleContainer } >
214
+ < div >
215
+ < Caption1 className = { styles . titleText } >
216
+ { inputsFromManifest [ 0 ] . name }
217
+ < Text className = { styles . titleRequiredLabelText } > { inputsFromManifest [ 0 ] . isOptional ? '' : '*' } </ Text >
218
+ </ Caption1 >
219
+ < InputCustomInfoLabel />
220
+ </ div >
221
+ < Text className = { styles . titleText } >
222
+ < span className = { styles . titleLabelText } > { stringResources . ACCEPT_TYPES } </ span >
213
223
{ inputsFromManifest [ 0 ] . allowedTypes }
214
- </ Caption2 >
215
- </ span >
224
+ </ Text >
225
+ </ div >
226
+ < div className = { styles . descriptionContainer } >
227
+ < Text className = { styles . descriptionText } > { inputsFromManifest [ 0 ] . tooltip ?? inputsFromManifest [ 0 ] . placeHolder ?? '' } </ Text >
228
+ </ div >
229
+ </ div >
230
+ < div className = { styles . body } >
231
+ < DraggableList < TemplateItemProps , CommonProps , any >
232
+ list = { Object . entries ( functionConnection . inputs ) . map ( ( input , index ) => ( {
233
+ input : input [ 1 ] ,
234
+ index,
235
+ } ) ) }
236
+ commonProps = { {
237
+ functionKey : props . functionKey ,
238
+ data : props . func ,
239
+ inputsFromManifest,
240
+ connections : props . connections ,
241
+ schemaType : SchemaType . Source ,
242
+ draggable : true ,
243
+ } }
244
+ onMoveEnd = { onDragMoveEnd }
245
+ itemKey = { 'index' }
246
+ template = { InputListWrapper }
247
+ />
248
+ < div className = { styles . formControlDescription } >
249
+ < Button
250
+ icon = { < AddRegular className = { styles . addIcon } /> }
251
+ onClick = { ( ) => addUnboundedInputSlot ( ) }
252
+ className = { styles . addButton }
253
+ appearance = "subtle"
254
+ >
255
+ < Caption1 > { stringResources . ADD_INPUT } </ Caption1 >
256
+ </ Button >
257
+ </ div >
216
258
</ div >
217
- < DraggableList < TemplateItemProps , CommonProps , any >
218
- list = { Object . entries ( functionConnection . inputs ) . map ( ( input , index ) => ( {
219
- input : input [ 1 ] ,
220
- index,
221
- } ) ) }
222
- commonProps = { {
223
- functionKey : props . functionKey ,
224
- data : props . func ,
225
- inputsFromManifest,
226
- connections : props . connections ,
227
- schemaType : SchemaType . Source ,
228
- draggable : true ,
229
- } }
230
- onMoveEnd = { onDragMoveEnd }
231
- itemKey = { 'index' }
232
- template = { InputListWrapper }
233
- />
234
- < Button
235
- icon = { < AddRegular className = { styles . addIcon } /> }
236
- onClick = { ( ) => addUnboundedInputSlot ( ) }
237
- className = { styles . addButton }
238
- appearance = "transparent"
239
- >
240
- < Caption1 > { stringResources . ADD_INPUT } </ Caption1 >
241
- </ Button >
242
259
</ div >
243
260
) ;
244
261
} ;
0 commit comments