diff --git a/src/components/form-field/listbox/listbox-option.tsx b/src/components/form-field/listbox/listbox-option.tsx index c3242387..86249d47 100644 --- a/src/components/form-field/listbox/listbox-option.tsx +++ b/src/components/form-field/listbox/listbox-option.tsx @@ -2,16 +2,34 @@ import { Listbox } from "@headlessui/react"; import React, { Fragment } from "react"; import { ListboxBadgeOption } from "./listbox-badge-option"; import { ListboxTextOption } from "./listbox-text-option"; +import { classNames } from "../../../util/class-names"; + +const listboxOptionStyles = { + base: "relative cursor-pointer px-3 py-2 ", + selected: + "ui-selected:bg-primary-100 ui-selected:text-primary-500 ui-selected:before:absolute ui-selected:before:bottom-0 ui-selected:before:left-0 ui-selected:before:top-0 ui-selected:before:block ui-selected:before:w-[2px] ui-selected:before:rounded-r-md ui-selected:before:bg-primary-400", + active: "ui-active:bg-neutral-50 ui-active:ui-selected:bg-primary-100", + disabled: + "ui-disabled:cursor-not-allowed ui-disabled:bg-neutral-50 ui-disabled:text-neutral-400", +}; export interface ListboxOptionProps { value: TValue; children: React.ReactNode; + disabled?: boolean; } -const ListboxOption = ({ value, children }: ListboxOptionProps) => { +const ListboxOption = ({ value, disabled, children }: ListboxOptionProps) => { return ( - -
  • + +
  • {children}
  • diff --git a/src/components/form-field/listbox/listbox.stories.tsx b/src/components/form-field/listbox/listbox.stories.tsx index dfb48b46..798ed1d3 100644 --- a/src/components/form-field/listbox/listbox.stories.tsx +++ b/src/components/form-field/listbox/listbox.stories.tsx @@ -15,10 +15,11 @@ type Story = StoryObj; interface Person { id: number; name: string; + isDead?: boolean; } const people: Person[] = [ - { id: 1, name: "Durward Reynolds" }, + { id: 1, name: "John Lennon", isDead: true }, { id: 2, name: "Kenton Towne" }, { id: 3, name: "Therese Wunsch" }, { id: 4, name: "Benedict Kessler" }, @@ -43,7 +44,11 @@ const ListboxTextWithHooks = () => { {people.map((person) => ( - + {person.name}