diff --git a/src/code-components/Combobox/Combobox.register.ts b/src/code-components/Combobox/Combobox.register.ts index 55304929..f7c2277d 100644 --- a/src/code-components/Combobox/Combobox.register.ts +++ b/src/code-components/Combobox/Combobox.register.ts @@ -54,6 +54,9 @@ export function registerCombobox( leftIcon: { type: "slot" }, rightIcon: { type: "slot" }, footer: { type: "slot" }, + optionLeftIcon: { + type: "slot", + }, inputWrapperClassName: { type: "class", selectors: [ @@ -96,6 +99,8 @@ export function registerCombobox( type: "class", }, optionsClassName: { type: "class" }, + optionLeftIconClassName: { type: "class" }, + optionContentClassName: { type: "class" }, optionClassName: { type: "class", selectors: [ @@ -175,5 +180,6 @@ export function registerCombobox( onChangeProp: "onChange", }, }, + providesData: true, }); } diff --git a/src/code-components/Combobox/Combobox.tsx b/src/code-components/Combobox/Combobox.tsx index d44c91a2..8f391adf 100644 --- a/src/code-components/Combobox/Combobox.tsx +++ b/src/code-components/Combobox/Combobox.tsx @@ -1,6 +1,7 @@ import { Combobox as HeadlessCombobox, Transition } from "@headlessui/react"; import { useState, useRef, Fragment, ReactNode } from "react"; +import { MemoDataProvider } from "../MemoDataProvider/MemoDataProvider"; import styles from "./Combobox.module.css"; import { HighlightQueryValue } from "./HighlightQueryValue"; import { groupOptions } from "./utils"; @@ -19,6 +20,7 @@ interface ComboboxProps { rightIcon: ReactNode; footer?: ReactNode; options?: ComboboxOption[]; + optionLeftIcon?: ReactNode; disabled?: boolean; "aria-label"?: string; "aria-labelledby"?: string; @@ -31,6 +33,8 @@ interface ComboboxProps { emptyOptionClassName?: string; optionsClassName?: string; optionClassName?: string; + optionLeftIconClassName?: string; + optionContentClassName?: string; groupClassName?: string; labelClassName?: string; searchValueClassName?: string; @@ -62,6 +66,7 @@ export function Combobox({ rightIcon, footer, options, + optionLeftIcon, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, @@ -75,6 +80,8 @@ export function Combobox({ emptyOptionClassName, optionsClassName, optionClassName, + optionLeftIconClassName, + optionContentClassName, groupClassName, labelClassName, searchValueClassName, @@ -211,27 +218,40 @@ export function Combobox({ data-disabled={option.disabled ? "true" : undefined} className={optionClassName} > -

- -

- {option.description ? ( -

+

+ {optionLeftIcon} +
+ + ) : null} +
+

- ) : null} + {option.description ? ( +

+ +

+ ) : null} +
))}