@@ -67,6 +67,7 @@ function normalizeOptions(options: SegmentedOptions): SegmentedLabeledOption[] {
67
67
const calcThumbStyle = ( targetElement : HTMLElement ) : React . CSSProperties => ( {
68
68
transform : `translateX(${ targetElement . offsetLeft } px)` ,
69
69
width : targetElement . clientWidth ,
70
+ height : targetElement . clientHeight ,
70
71
} ) ;
71
72
72
73
const InternalSegmentedOption : React . FC < {
@@ -261,52 +262,54 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
261
262
const divProps = omit ( restProps , [ 'children' ] ) ;
262
263
263
264
return (
264
- < div
265
- { ...divProps }
266
- className = { classNames (
267
- prefixCls ,
268
- {
269
- [ `${ prefixCls } -rtl` ] : direction === 'rtl' ,
270
- [ `${ prefixCls } -disabled` ] : disabled ,
271
- } ,
272
- className ,
273
- ) }
274
- ref = { mergedRef }
275
- >
276
- < CSSMotion
277
- visible = { thumbShow }
278
- motionName = { `${ prefixCls } -${ motionName } ` }
279
- motionDeadline = { 300 }
280
- onEnterStart = { handleThumbEnterStart }
281
- onEnterActive = { handleThumbEnterActive }
282
- onEnterEnd = { handleThumbEnterEnd }
265
+ < div className = { `${ prefixCls } -wrap` } >
266
+ < div
267
+ { ...divProps }
268
+ className = { classNames (
269
+ prefixCls ,
270
+ {
271
+ [ `${ prefixCls } -rtl` ] : direction === 'rtl' ,
272
+ [ `${ prefixCls } -disabled` ] : disabled ,
273
+ } ,
274
+ className ,
275
+ ) }
276
+ ref = { mergedRef }
283
277
>
284
- { ( { className : motionClassName , style : motionStyle } ) => {
285
- return (
286
- < div
287
- style = { motionStyle }
288
- className = { classNames ( `${ prefixCls } -thumb` , motionClassName ) }
289
- />
290
- ) ;
291
- } }
292
- </ CSSMotion >
293
- { segmentedOptions . map ( ( segmentedOption ) => (
294
- < InternalSegmentedOption
295
- key = { segmentedOption . value }
296
- prefixCls = { prefixCls }
297
- className = { classNames (
298
- segmentedOption . className ,
299
- `${ prefixCls } -item` ,
300
- {
301
- [ `${ prefixCls } -item-selected` ] :
302
- segmentedOption . value === visualSelected ,
303
- } ,
304
- ) }
305
- checked = { segmentedOption . value === selected }
306
- onChange = { handleChange }
307
- { ...segmentedOption }
308
- />
309
- ) ) }
278
+ < CSSMotion
279
+ visible = { thumbShow }
280
+ motionName = { `${ prefixCls } -${ motionName } ` }
281
+ motionDeadline = { 300 }
282
+ onEnterStart = { handleThumbEnterStart }
283
+ onEnterActive = { handleThumbEnterActive }
284
+ onEnterEnd = { handleThumbEnterEnd }
285
+ >
286
+ { ( { className : motionClassName , style : motionStyle } ) => {
287
+ return (
288
+ < div
289
+ style = { motionStyle }
290
+ className = { classNames ( `${ prefixCls } -thumb` , motionClassName ) }
291
+ />
292
+ ) ;
293
+ } }
294
+ </ CSSMotion >
295
+ { segmentedOptions . map ( ( segmentedOption ) => (
296
+ < InternalSegmentedOption
297
+ key = { segmentedOption . value }
298
+ prefixCls = { prefixCls }
299
+ className = { classNames (
300
+ segmentedOption . className ,
301
+ `${ prefixCls } -item` ,
302
+ {
303
+ [ `${ prefixCls } -item-selected` ] :
304
+ segmentedOption . value === visualSelected ,
305
+ } ,
306
+ ) }
307
+ checked = { segmentedOption . value === selected }
308
+ onChange = { handleChange }
309
+ { ...segmentedOption }
310
+ />
311
+ ) ) }
312
+ </ div >
310
313
</ div >
311
314
) ;
312
315
} ,
0 commit comments