@@ -17,7 +17,7 @@ import {
17
17
truncate ,
18
18
} from "lodash-es" ;
19
19
import { Check , EditIcon , TrashIcon } from "lucide-react" ;
20
- import React , { useCallback , useEffect , useMemo , useState } from "react" ;
20
+ import { useCallback , useEffect , useMemo , useState } from "react" ;
21
21
import {
22
22
Button ,
23
23
Command ,
@@ -44,7 +44,7 @@ import { getBlockComponent, getChaiDataProviders } from "@chaibuilder/runtime";
44
44
import { ErrorBoundary } from "../../../../core/components/ErrorBoundary.tsx" ;
45
45
import { useSelectedBlock } from "../../../../core/hooks" ;
46
46
import { useChaiExternalData } from "../../../../core/components/canvas/static/useChaiExternalData.ts" ;
47
- import { JsonView , allExpanded , defaultStyles } from "react-json-view-lite" ;
47
+ import { allExpanded , defaultStyles , JsonView } from "react-json-view-lite" ;
48
48
import "react-json-view-lite/dist/index.css" ;
49
49
50
50
// * Object to Path and Data Type
@@ -92,15 +92,15 @@ const ViewData = ({ data, fullView }: { data: any; fullView?: boolean }) => {
92
92
</ ErrorBoundary >
93
93
</ >
94
94
) : (
95
- < div className = "text-gray-800/50 text-[12px] leading-4 w-full max-h-36 overflow-x-hidden overflow-y-auto " >
95
+ < div className = "max-h-36 w-full overflow-y-auto overflow-x-hidden text-[12px] leading-4 text-gray-800/50 " >
96
96
< span className = "font-medium text-gray-800/80" > Content: </ span >
97
97
{ data }
98
98
</ div >
99
99
) ;
100
100
}
101
101
102
102
return (
103
- < div className = "text-[10px] text-gray-800/50 leading-3 whitespace-nowrap overflow-hidden w-full " >
103
+ < div className = "w-full overflow-hidden whitespace-nowrap text-[10px] leading-3 text-gray-800/50" >
104
104
{ truncate ( type === "object" ? JSON . stringify ( data ) : data , { length : 40 } ) }
105
105
</ div >
106
106
) ;
@@ -161,27 +161,27 @@ const DataProvidersSuggester = ({
161
161
size = "sm"
162
162
className = { ` ${
163
163
! isEmpty ( value )
164
- ? "min-w-[350px] justify-between items-center"
165
- : "bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white w-44 justify-center "
164
+ ? "min-w-[350px] items-center justify-between "
165
+ : "w-44 justify-center bg-blue-500 text-gray-100 hover:bg-blue-400 hover:text-white"
166
166
} `} >
167
167
{ value ? (
168
168
< >
169
- < span className = { `text-sm pr-8` } >
169
+ < span className = { `pr-8 text-sm ` } >
170
170
{ isProp && (
171
- < span className = "text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 mr-2 rounded-full " >
171
+ < span className = "mr-2 rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500 " >
172
172
{ startCase ( dataType ) }
173
173
</ span >
174
174
) }
175
175
{ value }
176
176
</ span >
177
- < span className = "text-[9px] text-blue-400 underline cursor-pointer hover:text-blue-700" > Change</ span >
177
+ < span className = "cursor-pointer text-[9px] text-blue-400 underline hover:text-blue-700" > Change</ span >
178
178
</ >
179
179
) : (
180
180
< > + Set { startCase ( toLower ( type ) ) } </ >
181
181
) }
182
182
</ Button >
183
183
</ PopoverTrigger >
184
- < PopoverContent className = "p-0 z-[999] min-w-[300px]" side = "right" align = "start" >
184
+ < PopoverContent className = "z-[999] min-w-[300px] p-0 " side = "right" align = "start" >
185
185
< Command >
186
186
< CommandInput placeholder = { `Choose ${ toLower ( type ) } ...` } />
187
187
< CommandList >
@@ -192,19 +192,19 @@ const DataProvidersSuggester = ({
192
192
key = { status }
193
193
value = { status }
194
194
className = { `cursor-pointer ${
195
- isProp ? "flex justify-between items-center" : "flex flex-col items-start justify-start"
195
+ isProp ? "flex items-center justify-between " : "flex flex-col items-start justify-start"
196
196
} `}
197
197
onSelect = { ( value ) => {
198
198
setValue ( find ( options , ( priority ) => priority === value ) || null ) ;
199
199
setOpen ( false ) ;
200
200
} } >
201
201
< div className = "flex items-center gap-x-2" >
202
- < Check className = { `w -4 h -4 text-green-500 ${ value === status ? "" : "opacity-0" } ` } />
202
+ < Check className = { `h -4 w -4 text-green-500 ${ value === status ? "" : "opacity-0" } ` } />
203
203
{ status }
204
204
</ div >
205
205
{ isProp ? (
206
206
< div >
207
- < span className = "text-[10px] text-purple-500 bg-purple-100 px-2 py-0.5 rounded-full " >
207
+ < span className = "rounded-full bg-purple-100 px-2 py-0.5 text-[10px] text-purple-500 " >
208
208
{ startCase ( get ( suggestedPathDataType , status , "" ) ) }
209
209
</ span >
210
210
</ div >
@@ -272,7 +272,7 @@ const AddBindingModalContent = ({
272
272
Add prop and path of binding. Click save when you're done.
273
273
</ DialogDescription >
274
274
</ DialogHeader >
275
- < div className = "flex flex-col gap-1 relative " >
275
+ < div className = "relative flex flex-col gap-1" >
276
276
< DataProvidersSuggester
277
277
type = "PROP"
278
278
isDisabled = { false }
@@ -389,22 +389,22 @@ const NewDataBindingPair = ({
389
389
useEffect ( ( ) => setDataType ( ( ) => getDataType ( item . key , "PROP" ) ) , [ item . key ] ) ;
390
390
391
391
return (
392
- < div className = { `flex flex-col border border-gray-200 relative rounded-md p-2` } >
393
- < div className = "text-gray-500 font-normal text-sm " > { item . key } </ div >
392
+ < div className = { `relative flex flex-col rounded-md border border-gray-200 p-2` } >
393
+ < div className = "text-sm font-normal text-gray-500 " > { item . key } </ div >
394
394
< div className = "font-medium leading-5" > { item . value } </ div >
395
395
< ViewData data = { get ( dataProvider , item . value , "" ) } />
396
396
397
397
< div className = "flex items-center justify-end gap-x-2" >
398
398
< AddBindingModal editMode onAddBinding = { onAddBinding } appliedBindings = { appliedBindings } item = { item } >
399
- < EditIcon className = "h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-blue-400 hover:text-white border-blue-400 p-1 text-blue-400 hover:scale-105 duration-200 " />
399
+ < EditIcon className = "mt-1 h-6 w-6 cursor-pointer rounded border border-blue-400 p-1 text-blue-400 duration-200 hover:scale-105 hover:bg-blue-400 hover:text-white " />
400
400
</ AddBindingModal >
401
401
< TrashIcon
402
402
onClick = { ( ) => onRemove ( ) }
403
- className = "h-6 w-6 mt-1 cursor-pointer rounded border hover:bg-red-400 hover:text-white border-red-400 p-1 text-red-400 hover:scale-105 duration-200 "
403
+ className = "mt-1 h-6 w-6 cursor-pointer rounded border border-red-400 p-1 text-red-400 duration-200 hover:scale-105 hover:bg-red-400 hover:text-white "
404
404
/>
405
405
</ div >
406
406
{ ! isEmpty ( dataType ) && ! isEmpty ( item . key ) && (
407
- < div className = "mt-px absolute right-0 top-1 text-purple-600 text-[10px] flex items-center font-medium h-4 px-2 rounded-full " >
407
+ < div className = "absolute right-0 top-1 mt-px flex h-4 items-center rounded-full px-2 text-[10px] font-medium text-purple-600 " >
408
408
{ startCase ( dataType ) }
409
409
</ div >
410
410
) }
@@ -470,8 +470,8 @@ const DataBindingSetting = ({ bindingData, onChange }: { bindingData: any; onCha
470
470
471
471
if ( isEmpty ( providers ) ) {
472
472
return (
473
- < div className = "w-full flex items-center justify-center" >
474
- < p className = "text-gray-500 mb-1.5 text-xs" >
473
+ < div className = "flex w-full items-center justify-center" >
474
+ < p className = "mb-1.5 text-xs text-gray-500 " >
475
475
You have no data providers registered. Please add a data provider to your project. < br />
476
476
< a className = "text-blue-500" href = "https://chaibuilder.com/docs/registering-data-providers" target = { "_blank" } >
477
477
Learn more
@@ -502,13 +502,13 @@ const DataBindingSetting = ({ bindingData, onChange }: { bindingData: any; onCha
502
502
appliedBindings = { map ( _formData , "key" ) }
503
503
onAddBinding = { addNewBindingProp } >
504
504
< span
505
- className = { `w-full px-5 py-1.5 text-xs rounded-md font-medium duration-200 ${
505
+ className = { `w-full rounded-md px-5 py-1.5 text-xs font-medium duration-200 ${
506
506
isAddDisabled
507
507
? "cursor-not-allowed bg-gray-200 text-gray-400"
508
508
: "bg-blue-700/20 text-blue-800 hover:bg-blue-700/30"
509
509
} `} >
510
510
{ isEmpty ( dataProvider ) ? (
511
- < small className = "text-gray-500 text- [9.5px]" > No data provider has been set up for this page</ small >
511
+ < small className = "text-[9.5px] text-gray-500 " > No data provider has been set up for this page</ small >
512
512
) : (
513
513
"+ Add Data Binding"
514
514
) }
0 commit comments