@cleartrip/ct-design-segment 4.0.0-SNAPSHOT-native-main.21 → 4.0.0-SNAPSHOT-native-main.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -239,13 +239,20 @@ const Segment: React.FC<ISegmentProps> = ({
239
239
  <Container
240
240
  onLayout={handleTrackContentLayout}
241
241
  styleConfig={{
242
- root: [
243
- segmentStaticStyles.animatedContainer,
244
- segmentStaticStyles.animatedContainerBlock,
245
- ...animatedContainer,
246
- ],
242
+ root: [segmentStaticStyles.animatedContainer, ...animatedContainer],
247
243
  }}
248
244
  >
245
+ <Animated.View
246
+ pointerEvents='none'
247
+ style={[
248
+ segmentStaticStyles.animatedBlock,
249
+ animatedStyle,
250
+ dynamicStyles.animatedBlock,
251
+ ...(variantStyles.animatedBlock?.style ? [variantStyles.animatedBlock.style] : []),
252
+ segmentThumbShadowNative,
253
+ ...animatedBlock,
254
+ ]}
255
+ />
249
256
  {!isEmptyOptions(sanitizedOptions) &&
250
257
  sanitizedOptions.map((option, index) => (
251
258
  <Container
@@ -270,17 +277,6 @@ const Segment: React.FC<ISegmentProps> = ({
270
277
  </Container>
271
278
  ))}
272
279
  </Container>
273
- <Animated.View
274
- pointerEvents='none'
275
- style={[
276
- segmentStaticStyles.animatedBlock,
277
- animatedStyle,
278
- dynamicStyles.animatedBlock,
279
- ...(variantStyles.animatedBlock?.style ? [variantStyles.animatedBlock.style] : []),
280
- { ...segmentThumbShadowNative },
281
- ...animatedBlock,
282
- ]}
283
- />
284
280
  </Container>
285
281
  );
286
282
  };
package/src/Segment.tsx CHANGED
@@ -244,11 +244,7 @@ const Segment: React.FC<ISegmentProps> = ({
244
244
  <div className={rootClassName} ref={rootRef}>
245
245
  <Container
246
246
  styleConfig={{
247
- root: [
248
- segmentStaticStyles.animatedContainer,
249
- segmentStaticStyles.animatedContainerBlock,
250
- ...animatedContainer,
251
- ],
247
+ root: [segmentStaticStyles.animatedContainer, ...animatedContainer],
252
248
  }}
253
249
  >
254
250
  {!isEmptyOptions(sanitizedOptions) &&
package/src/style.ts CHANGED
@@ -12,6 +12,7 @@ export const segmentThumbShadowNative = {
12
12
  shadowOffset: { width: 0, height: 0 },
13
13
  shadowOpacity: 0.12,
14
14
  shadowRadius: 4,
15
+ elevation: 3,
15
16
  } as const;
16
17
 
17
18
  export const segmentStaticStyles = makeStyles((theme) => {
@@ -19,7 +20,6 @@ export const segmentStaticStyles = makeStyles((theme) => {
19
20
  const borderWidth = theme.border.width.sm;
20
21
  const trackInnerHeight = Math.max(trackHeight - borderWidth * 2, 0);
21
22
  const thumbInset = Math.max(theme.spacing[0.25], 0);
22
- const thumbHeight = Math.max(trackInnerHeight - thumbInset * 2, 0);
23
23
  const trackRadius = Math.max(0, trackHeight / 2);
24
24
  const trackInnerRadius = Math.max(0, trackInnerHeight / 2);
25
25
  const thumbRadius = Math.max(0, trackInnerRadius - thumbInset);
@@ -36,6 +36,7 @@ export const segmentStaticStyles = makeStyles((theme) => {
36
36
  position: 'relative',
37
37
  height: trackHeight,
38
38
  alignItems: 'stretch',
39
+ padding: theme.spacing[1],
39
40
  },
40
41
  button: {
41
42
  backgroundColor: 'transparent',
@@ -48,26 +49,20 @@ export const segmentStaticStyles = makeStyles((theme) => {
48
49
  justifyContent: 'center',
49
50
  alignItems: 'center',
50
51
  },
51
- animatedContainerBlock: {
52
- position: 'absolute',
53
- height: trackHeight,
54
- left: thumbInset,
55
- right: thumbInset,
56
- zIndex: theme.zIndex.modal,
57
- },
58
52
  animatedBlock: {
59
53
  position: 'absolute',
60
- height: thumbHeight,
54
+ top: 0,
55
+ height: '100%',
61
56
  borderRadius: thumbRadius,
62
57
  backgroundColor: theme.color.background.neutral,
63
- top: thumbInset,
64
58
  },
65
59
  animatedContainer: {
66
60
  flexDirection: 'row',
67
61
  alignItems: 'stretch',
68
62
  justifyContent: 'flex-start',
69
- width: theme.size['100P'],
70
- height: trackHeight,
63
+ position: 'relative',
64
+ height: '100%',
65
+ width: '100%',
71
66
  },
72
67
  tabMeasureCell: {
73
68
  flexGrow: 1,