Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix disabled logic, item can be a string

Oleg Isonen533633f77df0
diff --git a/apps/designer/app/shared/design-system/components/combobox.stories.tsx b/apps/designer/app/shared/design-system/components/combobox.stories.tsx
index 8e1b707110..fa56f4ecdb 100644
--- a/apps/designer/app/shared/design-system/components/combobox.stories.tsx
+++ b/apps/designer/app/shared/design-system/components/combobox.stories.tsx
@@ -18,6 +18,7 @@ export const Simple: ComponentStory<typeof Combobox> = () => {
/>
);
};
+
export const CustomInput: ComponentStory<typeof Combobox> = () => {
const items = [
{ label: "Apple", value: "apple", disabled: true },
diff --git a/apps/designer/app/shared/design-system/components/combobox.tsx b/apps/designer/app/shared/design-system/components/combobox.tsx
index 2046ebd52b..733b6551d5 100644
--- a/apps/designer/app/shared/design-system/components/combobox.tsx
+++ b/apps/designer/app/shared/design-system/components/combobox.tsx
@@ -122,33 +122,35 @@ export const Combobox = <Item extends BaseItem>({
<PopperAnchor asChild>
{disclosure({ inputProps, toggleProps })}
</PopperAnchor>
- <Listbox {...menuProps}>
- {isOpen &&
- filteredItems.map((item, index) => {
- const itemProps: Record<string, unknown> = getItemProps({
- item,
- index,
- key: index,
- ...("disabled" in item && item.disabled
- ? { "data-disabled": true, disabled: true }
- : {}),
- ...(highlightedIndex === index ? { "data-found": true } : {}),
- });
+ <PopperContent>
+ <Listbox {...menuProps}>
+ {isOpen &&
+ filteredItems.map((item, index) => {
+ const itemProps: Record<string, unknown> = getItemProps({
+ item,
+ index,
+ key: index,
+ ...(typeof item === "object" && item.disabled
+ ? { "data-disabled": true, disabled: true }
+ : {}),
+ ...(highlightedIndex === index ? { "data-found": true } : {}),
+ });
- return (
- // eslint-disable-next-line react/jsx-key
- <ListboxItem {...itemProps}>
- <Grid
- align="center"
- css={{ gridTemplateColumns: "20px 1fr" }}
- >
- {selectedItem === item && <CheckIcon />}
- <Box css={{ gridColumn: 2 }}>{itemToString(item)}</Box>
- </Grid>
- </ListboxItem>
- );
- })}
- </Listbox>
+ return (
+ // eslint-disable-next-line react/jsx-key
+ <ListboxItem {...itemProps}>
+ <Grid
+ align="center"
+ css={{ gridTemplateColumns: "20px 1fr" }}
+ >
+ {selectedItem === item && <CheckIcon />}
+ <Box css={{ gridColumn: 2 }}>{itemToString(item)}</Box>
+ </Grid>
+ </ListboxItem>
+ );
+ })}
+ </Listbox>
+ </PopperContent>
</Box>
</Popper>
);