@@ -95,10 +95,7 @@ const SelectWrapperElement = tasty({
9595 textAlign : 'left' ,
9696 fill : '#clear' ,
9797 textOverflow : 'ellipsis' ,
98- overflow : {
99- '' : 'initial' ,
100- ellipsis : 'hidden' ,
101- } ,
98+ overflow : 'hidden' ,
10299 } ,
103100
104101 CaretIcon : {
@@ -179,7 +176,7 @@ const ListBoxElement = tasty({
179176 as : 'ul' ,
180177 styles : {
181178 display : 'flex' ,
182- gap : '.5x ' ,
179+ gap : '1bw ' ,
183180 flow : 'column' ,
184181 margin : '0' ,
185182 padding : '.5x' ,
@@ -196,7 +193,9 @@ const ListBoxElement = tasty({
196193const OptionElement = tasty ( {
197194 as : 'li' ,
198195 styles : {
199- display : 'block' ,
196+ display : 'flex' ,
197+ flow : 'column' ,
198+ gap : '0' ,
200199 padding : '(1x - 1px) (1.5x - 1px)' ,
201200 cursor : 'pointer' ,
202201 radius : true ,
@@ -214,6 +213,23 @@ const OptionElement = tasty({
214213 } ,
215214 preset : 't3' ,
216215 transition : 'theme' ,
216+ width : 'max 100%' ,
217+
218+ Label : {
219+ preset : 't3' ,
220+ overflow : 'hidden' ,
221+ textOverflow : 'ellipsis' ,
222+ width : 'max 100%' ,
223+ } ,
224+
225+ Description : {
226+ preset : 't4' ,
227+ color : '#dark-03' ,
228+ overflow : 'hidden' ,
229+ whiteSpace : 'nowrap' ,
230+ textOverflow : 'ellipsis' ,
231+ width : 'max 100%' ,
232+ } ,
217233 } ,
218234} ) ;
219235
@@ -265,7 +281,6 @@ export interface CubeSelectProps<T> extends CubeSelectBaseProps<T> {
265281 /** The ref for the list box. */
266282 listBoxRef ?: RefObject < HTMLElement > ;
267283 size ?: 'small' | 'default' | 'large' | string ;
268- ellipsis ?: boolean ;
269284 placeholder ?: string ;
270285}
271286
@@ -321,7 +336,6 @@ function Select<T extends object>(
321336 type = 'outline' ,
322337 theme = 'default' ,
323338 labelSuffix,
324- ellipsis,
325339 suffixPosition = 'before' ,
326340 ...otherProps
327341 } = props ;
@@ -383,7 +397,6 @@ function Select<T extends object>(
383397
384398 const modifiers = useMemo (
385399 ( ) => ( {
386- ellipsis,
387400 invalid : isInvalid ,
388401 valid : validationState === 'valid' ,
389402 disabled : isDisabled ,
@@ -395,7 +408,6 @@ function Select<T extends object>(
395408 suffix : true ,
396409 } ) ,
397410 [
398- ellipsis ,
399411 validationState ,
400412 isDisabled ,
401413 isLoading ,
@@ -575,11 +587,12 @@ function Option({ item, state, styles, shouldUseVirtualFocus }) {
575587 // style to the focused option
576588 let { isFocused, focusProps } = useFocus ( { isDisabled } ) ;
577589
590+ const description = ( item as any ) ?. props ?. description ;
591+
578592 return (
579593 < OptionElement
580594 { ...mergeProps ( optionProps , focusProps ) }
581595 ref = { ref }
582- key = { item . key }
583596 mods = { {
584597 selected : isSelected ,
585598 focused : shouldUseVirtualFocus ? isVirtualFocused : isFocused ,
@@ -588,7 +601,8 @@ function Option({ item, state, styles, shouldUseVirtualFocus }) {
588601 data-theme = { isSelected ? 'special' : undefined }
589602 styles = { styles }
590603 >
591- { item . rendered }
604+ < div data-element = "Label" > { item . rendered } </ div >
605+ { description ? < div data-element = "Description" > { description } </ div > : null }
592606 </ OptionElement >
593607 ) ;
594608}
@@ -601,7 +615,12 @@ const __Select = Object.assign(
601615 _Select as typeof _Select & {
602616 Item : typeof Item ;
603617 } ,
604- { Item } ,
618+ {
619+ Item : Item as unknown as ( props : {
620+ description ?: ReactNode ;
621+ [ key : string ] : any ;
622+ } ) => null ,
623+ } ,
605624) ;
606625
607626__Select . displayName = 'Select' ;
0 commit comments