Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add classNameOverride to MultiSelectOption #21

Merged
merged 9 commits into from
Sep 4, 2023
5 changes: 5 additions & 0 deletions .changeset/pink-ghosts-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kaizen/select": minor
---

Add classNameOverride to MultiSelectOption.
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import React, { useMemo } from "react"
import React, { useMemo, HTMLAttributes } from "react"
import { useFocusRing } from "@react-aria/focus"
import { useOption } from "@react-aria/listbox"
import { mergeProps } from "@react-aria/utils"
import classnames from "classnames"
import { v4 } from "uuid"
import { VisuallyHidden } from "@kaizen/a11y"
import { OverrideClassName } from "@kaizen/component-base"
import { Icon } from "@kaizen/component-library"
import check from "@kaizen/component-library/icons/check.icon.svg"
import { Badge } from "@kaizen/draft-badge"
import { MultiSelectItem } from "../../../types"
import { useSelectionContext } from "../../provider"
import styles from "./MultiSelectOption.module.scss"

export interface MultiSelectOptionProps {
export interface MultiSelectOptionProps
extends OverrideClassName<HTMLAttributes<HTMLSpanElement>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've also added native attributes to the props API but it's not implemented in the component. Let's just remove that part because it's going to add complications to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dougmacknz , that's done now.

item: MultiSelectItem
}

export const MultiSelectOption = ({
classNameOverride,
item,
}: MultiSelectOptionProps): JSX.Element => {
const { selectionState: state } = useSelectionContext()
Expand All @@ -39,6 +42,7 @@ export const MultiSelectOption = ({
ref={ref}
className={classnames(
styles.option,
classNameOverride,
isSelected && styles.isSelected,
isFocusVisible && styles.isFocusVisible,
isDisabled && styles.isDisabled
Expand Down