fix: relation widget style fixes (#911)
This commit is contained in:
parent
2d2b048347
commit
a0bc731357
@ -1,6 +1,10 @@
|
||||
.CMS_Autocomplete_root {
|
||||
@apply relative
|
||||
w-full;
|
||||
w-full
|
||||
flex
|
||||
items-center
|
||||
gap-2
|
||||
pr-2;
|
||||
|
||||
&.CMS_Autocomplete_disabled {
|
||||
& .CMS_Autocomplete_input {
|
||||
@ -15,13 +19,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
.CMS_Autocomplete_input-wrapper {
|
||||
@apply flex-grow
|
||||
flex
|
||||
flex-wrap
|
||||
min-w-0;
|
||||
}
|
||||
|
||||
.CMS_Autocomplete_input {
|
||||
@apply w-full
|
||||
bg-transparent
|
||||
border-none
|
||||
py-2
|
||||
pl-3
|
||||
pr-10
|
||||
text-sm
|
||||
leading-5
|
||||
focus:ring-0
|
||||
@ -33,13 +43,10 @@
|
||||
}
|
||||
|
||||
.CMS_Autocomplete_button-wrapper {
|
||||
@apply absolute
|
||||
inset-y-0
|
||||
right-0
|
||||
flex
|
||||
@apply flex
|
||||
items-center
|
||||
pr-2
|
||||
gap-1;
|
||||
gap-1
|
||||
flex-shrink-0;
|
||||
}
|
||||
|
||||
.CMS_Autocomplete_button {
|
||||
|
@ -20,6 +20,7 @@ export const classes = generateClassNames('Autocomplete', [
|
||||
'root',
|
||||
'focused',
|
||||
'disabled',
|
||||
'input-wrapper',
|
||||
'input',
|
||||
'button-wrapper',
|
||||
'button',
|
||||
@ -55,6 +56,7 @@ export interface AutocompleteProps {
|
||||
disabled?: boolean;
|
||||
required?: boolean;
|
||||
inputRef?: Ref<HTMLInputElement>;
|
||||
endAdornment?: ReactNode;
|
||||
displayValue: (item: string | string[] | null) => string;
|
||||
onQuery: (query: string) => void;
|
||||
onChange: (value: string | string[] | undefined) => void;
|
||||
@ -64,9 +66,10 @@ const Autocomplete = ({
|
||||
label,
|
||||
value,
|
||||
options,
|
||||
inputRef,
|
||||
disabled,
|
||||
required,
|
||||
inputRef,
|
||||
endAdornment,
|
||||
onChange,
|
||||
onQuery,
|
||||
}: AutocompleteProps) => {
|
||||
@ -187,6 +190,7 @@ const Autocomplete = ({
|
||||
)}
|
||||
data-testid="autocomplete"
|
||||
>
|
||||
<div className={classes['input-wrapper']}>
|
||||
{label}
|
||||
<input
|
||||
{...getInputProps()}
|
||||
@ -194,7 +198,9 @@ const Autocomplete = ({
|
||||
className={classes.input}
|
||||
data-testid="autocomplete-input"
|
||||
/>
|
||||
</div>
|
||||
<div className={classes['button-wrapper']}>
|
||||
{endAdornment}
|
||||
<IconButton
|
||||
variant="text"
|
||||
size="small"
|
||||
|
@ -1,6 +1,5 @@
|
||||
.CMS_CircularProgress_svg {
|
||||
@apply mr-2
|
||||
text-gray-200
|
||||
@apply text-gray-200
|
||||
animate-spin
|
||||
dark:text-gray-600
|
||||
fill-blue-600;
|
||||
|
@ -427,3 +427,12 @@ table {
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
::-moz-focus-inner,
|
||||
:focus-visible {
|
||||
@apply outline-none;
|
||||
}
|
||||
|
||||
.MuiPopper-root {
|
||||
@apply z-[100];
|
||||
}
|
||||
|
@ -7,14 +7,12 @@
|
||||
gap-2
|
||||
p-2
|
||||
pr-0
|
||||
w-relation-widget-label;
|
||||
min-w-0;
|
||||
}
|
||||
|
||||
.CMS_WidgetRelation_loading {
|
||||
@apply absolute
|
||||
inset-y-0
|
||||
right-4
|
||||
flex
|
||||
@apply flex
|
||||
items-center
|
||||
pr-2;
|
||||
w-6
|
||||
h-6;
|
||||
}
|
||||
|
@ -358,8 +358,7 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
|
||||
>
|
||||
<Autocomplete
|
||||
label={
|
||||
<>
|
||||
{Array.isArray(selectedValue) && selectedValue.length > 0 ? (
|
||||
Array.isArray(selectedValue) && selectedValue.length > 0 ? (
|
||||
<div className={classes.values}>
|
||||
{selectedValue.map(selectValue => {
|
||||
const option = uniqueOptionsByValue[selectValue];
|
||||
@ -370,16 +369,7 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
{loading ? (
|
||||
<CircularProgress
|
||||
key="loading-indicator"
|
||||
className={classes.loading}
|
||||
data-testid="relation-loading-indicator"
|
||||
size="small"
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
) : null
|
||||
}
|
||||
inputRef={ref}
|
||||
value={selectedValue}
|
||||
@ -398,6 +388,16 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
|
||||
|
||||
return option.label;
|
||||
}}
|
||||
endAdornment={
|
||||
loading ? (
|
||||
<CircularProgress
|
||||
key="loading-indicator"
|
||||
className={classes.loading}
|
||||
data-testid="relation-loading-indicator"
|
||||
size="small"
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
onQuery={filterOptions}
|
||||
onChange={handleChange}
|
||||
/>
|
||||
|
@ -32,7 +32,6 @@ module.exports = {
|
||||
"breadcrumb-title": "calc(100vw * .4)",
|
||||
"collection-header": "calc(100% - 32px)",
|
||||
"date-widget": "calc(100% - 58px)",
|
||||
"relation-widget-label": "calc(100% - 32px)",
|
||||
"select-widget-label": "calc(100% - 12px)",
|
||||
},
|
||||
maxWidth: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user