@@ -5,6 +5,7 @@ import * as SelectPrimitive from '@radix-ui/react-select';
55import classNames from 'classnames' ;
66import { useId , useMemo , useState } from 'react' ;
77
8+ import Badge , { type BadgeKind } from '#ui/Common/Badge' ;
89import Skeleton from '#ui/Common/Skeleton' ;
910
1011import type { FormattedMessage , LinkLike } from '#ui/types' ;
@@ -18,6 +19,10 @@ export type SelectValue<T extends string> = {
1819 label : FormattedMessage | string ;
1920 value : T ;
2021 iconImage ?: ReactElement < SVGSVGElement > ;
22+ badge ?: {
23+ label : FormattedMessage | string ;
24+ kind ?: BadgeKind ;
25+ } ;
2126 disabled ?: boolean ;
2227} ;
2328
@@ -89,7 +94,7 @@ const Select = <T extends string>({
8994 </ SelectPrimitive . Label >
9095 ) }
9196
92- { items . map ( ( { value, label, iconImage, disabled } ) => (
97+ { items . map ( ( { value, label, iconImage, badge , disabled } ) => (
9398 < SelectPrimitive . Item
9499 key = { value }
95100 value = { value }
@@ -99,6 +104,11 @@ const Select = <T extends string>({
99104 < SelectPrimitive . ItemText >
100105 { iconImage }
101106 < span > { label } </ span >
107+ { badge && (
108+ < Badge size = "small" kind = { badge . kind } className = { styles . badge } >
109+ { badge . label }
110+ </ Badge >
111+ ) }
102112 </ SelectPrimitive . ItemText >
103113 </ SelectPrimitive . Item >
104114 ) ) }
@@ -149,6 +159,15 @@ const Select = <T extends string>({
149159 < >
150160 { currentItem . iconImage }
151161 < span > { currentItem . label } </ span >
162+ { currentItem . badge && (
163+ < Badge
164+ size = "small"
165+ kind = { currentItem . badge . kind }
166+ className = { styles . badge }
167+ >
168+ { currentItem . badge . label }
169+ </ Badge >
170+ ) }
152171 </ >
153172 ) }
154173 </ SelectPrimitive . Value >
0 commit comments