@@ -28,39 +28,35 @@ import {
28
28
ListLayout ,
29
29
Provider ,
30
30
SectionProps ,
31
- SeparatorContext ,
32
- SeparatorProps ,
33
31
UNSTABLE_ListBoxLoadingSentinel ,
34
- useContextProps ,
35
32
Virtualizer
36
33
} from 'react-aria-components' ;
37
34
import { AsyncLoadable , HelpTextProps , LoadingState , SpectrumLabelableProps } from '@react-types/shared' ;
38
35
import { baseColor , edgeToText , focusRing , space , style } from '../style' with { type : 'macro' } ;
39
36
import { centerBaseline } from './CenterBaseline' ;
40
- import { centerPadding , controlBorderRadius , controlFont , controlSize , field , fieldInput , getAllowedOverrides , StyleProps } from './style-utils' with { type : 'macro' } ;
37
+ import { centerPadding , control , controlBorderRadius , controlFont , controlSize , field , fieldInput , getAllowedOverrides , StyleProps } from './style-utils' with { type : 'macro' } ;
41
38
import {
42
39
checkmark ,
43
40
description ,
44
41
icon ,
45
42
iconCenterWrapper ,
46
- label
43
+ label ,
44
+ sectionHeading
47
45
} from './Menu' ;
48
46
import CheckmarkIcon from '../ui-icons/Checkmark' ;
49
47
import ChevronIcon from '../ui-icons/Chevron' ;
50
- import { createContext , CSSProperties , ElementType , ForwardedRef , forwardRef , ReactNode , Ref , useCallback , useContext , useEffect , useImperativeHandle , useMemo , useRef , useState } from 'react' ;
48
+ import { createContext , CSSProperties , ForwardedRef , forwardRef , ReactNode , Ref , useCallback , useContext , useEffect , useImperativeHandle , useMemo , useRef , useState } from 'react' ;
51
49
import { createFocusableRef } from '@react-spectrum/utils' ;
52
50
import { createLeafComponent } from '@react-aria/collections' ;
53
- import { divider } from './Divider' ;
54
51
import { FieldErrorIcon , FieldGroup , FieldLabel , HelpText , Input } from './Field' ;
55
- import { filterDOMProps , mergeRefs , useResizeObserver , useSlotId } from '@react-aria/utils' ;
56
52
import { FormContext , useFormProps } from './Form' ;
57
53
import { forwardRefType } from './types' ;
58
54
import { HeaderContext , HeadingContext , Text , TextContext } from './Content' ;
59
55
import { IconContext } from './Icon' ;
60
56
// @ts -ignore
61
57
import intlMessages from '../intl/*.json' ;
62
- import { mergeStyles } from '../style/runtime ' ;
63
- import { Placement , useSeparator } from 'react-aria' ;
58
+ import { mergeRefs , useResizeObserver , useSlotId } from '@react-aria/utils ' ;
59
+ import { Placement } from 'react-aria' ;
64
60
import { PopoverBase } from './Popover' ;
65
61
import { pressScale } from './pressScale' ;
66
62
import { ProgressCircle } from './ProgressCircle' ;
@@ -210,38 +206,34 @@ export let listbox = style<{size: 'S' | 'M' | 'L' | 'XL'}>({
210
206
// TODO: Might help with horizontal scrolling happening on Windows, will need to check somehow. Otherwise, revert back to overflow: auto
211
207
overflowY : 'auto' ,
212
208
overflowX : 'hidden' ,
213
- font : controlFont ( )
209
+ fontFamily : 'sans' ,
210
+ fontSize : controlFont ( )
214
211
} ) ;
215
212
216
213
export let listboxItem = style ( {
217
214
...focusRing ( ) ,
218
- ...controlBorderRadius ( ) ,
219
- boxSizing : 'border-box' ,
220
- font : controlFont ( ) ,
221
- '--labelPadding' : {
222
- type : 'paddingTop' ,
223
- value : centerPadding ( )
224
- } ,
215
+ ...control ( { shape : 'default' , wrap : true , icon : true } ) ,
216
+ columnGap : 0 ,
217
+ paddingX : 0 ,
225
218
paddingBottom : '--labelPadding' ,
226
219
backgroundColor : {
227
220
default : 'transparent' ,
228
221
isFocused : baseColor ( 'gray-100' ) . isFocusVisible
229
222
} ,
230
223
color : {
231
- default : 'neutral' ,
224
+ default : baseColor ( 'neutral' ) ,
232
225
isDisabled : {
233
226
default : 'disabled' ,
234
227
forcedColors : 'GrayText'
235
228
}
236
229
} ,
237
230
position : 'relative' ,
238
- // each menu item should take up the entire width, the subgrid will handle within the item
239
231
gridColumnStart : 1 ,
240
232
gridColumnEnd : - 1 ,
241
233
display : 'grid' ,
242
234
gridTemplateAreas : [
243
- '. checkmark icon label .' ,
244
- '. . . description .'
235
+ '. checkmark icon label .' ,
236
+ '. . . description .'
245
237
] ,
246
238
gridTemplateColumns : {
247
239
size : {
@@ -285,20 +277,11 @@ export let listboxHeader = style<{size?: 'S' | 'M' | 'L' | 'XL'}>({
285
277
}
286
278
} ) ;
287
279
288
- export let listboxHeading = style ( {
289
- fontSize : 'ui' ,
290
- fontWeight : 'bold' ,
291
- lineHeight : 'ui' ,
292
- margin : 0
293
- } ) ;
294
-
295
- // not sure why edgeToText won't work...
296
280
const separatorWrapper = style ( {
297
281
display : {
298
282
':is(:last-child > *)' : 'none' ,
299
283
default : 'flex'
300
284
} ,
301
- // A workaround since edgeToText() returns undefined for some reason
302
285
marginX : {
303
286
size : {
304
287
S : `[${ edgeToText ( 24 ) } ]` ,
@@ -307,7 +290,18 @@ const separatorWrapper = style({
307
290
XL : `[${ edgeToText ( 48 ) } ]`
308
291
}
309
292
} ,
310
- height : 12
293
+ height : 12 ,
294
+ alignItems : 'center'
295
+ } ) ;
296
+
297
+ const dividerStyle = style ( {
298
+ backgroundColor : {
299
+ default : 'gray-200' ,
300
+ forcedColors : 'ButtonBorder'
301
+ } ,
302
+ borderRadius : 'full' ,
303
+ height : '[2px]' ,
304
+ width : 'full'
311
305
} ) ;
312
306
313
307
// Not from any design, just following the sizing of the existing rows
@@ -667,7 +661,7 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any
667
661
< Provider
668
662
values = { [
669
663
[ HeaderContext , { styles : listboxHeader ( { size} ) } ] ,
670
- [ HeadingContext , { styles : listboxHeading } ] ,
664
+ [ HeadingContext , { styles : sectionHeading } ] ,
671
665
[ TextContext , {
672
666
slots : {
673
667
'description' : { styles : description ( { size} ) }
@@ -700,43 +694,10 @@ const ComboboxInner = forwardRef(function ComboboxInner(props: ComboBoxProps<any
700
694
) ;
701
695
} ) ;
702
696
703
- export function Divider ( props : SeparatorProps & { size ?: 'S' | 'M' | 'L' | 'XL' | undefined } ) : ReactNode {
704
- return (
705
- < Separator
706
- { ...props }
707
- className = { mergeStyles (
708
- divider ( {
709
- size : 'M' ,
710
- orientation : 'horizontal' ,
711
- isStaticColor : false
712
- } , style ( { alignSelf : 'center' , width : 'full' } ) ) ) } />
713
- ) ;
714
- }
715
-
716
- const Separator = /*#__PURE__*/ createLeafComponent ( 'separator' , function Separator ( props : SeparatorProps & { size ?: 'S' | 'M' | 'L' | 'XL' } , ref : ForwardedRef < HTMLElement > ) {
717
- [ props , ref ] = useContextProps ( props , ref , SeparatorContext ) ;
718
-
719
- let { elementType, orientation, size, style, className, slot, ...otherProps } = props ;
720
- let Element = ( elementType as ElementType ) || 'hr' ;
721
- if ( Element === 'hr' && orientation === 'vertical' ) {
722
- Element = 'div' ;
723
- }
724
-
725
- let { separatorProps} = useSeparator ( {
726
- ...otherProps ,
727
- elementType,
728
- orientation
729
- } ) ;
730
-
697
+ export const Divider = /*#__PURE__*/ createLeafComponent ( 'separator' , function Divider ( { size} : { size ?: 'S' | 'M' | 'L' | 'XL' } , ref : ForwardedRef < HTMLDivElement > ) {
731
698
return (
732
699
< div className = { separatorWrapper ( { size} ) } >
733
- < Element
734
- { ...filterDOMProps ( props ) }
735
- { ...separatorProps }
736
- style = { style }
737
- className = { className ?? 'react-aria-Separator' }
738
- ref = { ref }
739
- slot = { slot || undefined } />
700
+ < div ref = { ref } className = { dividerStyle } />
740
701
</ div >
741
702
) ;
742
703
} ) ;
0 commit comments