@@ -11,6 +11,7 @@ import { BaseInput } from '~components/Input/BaseInput';
11
11
import { size as sizeTokens } from '~tokens/global' ;
12
12
import { isReactNative , makeSize } from '~utils' ;
13
13
import type { BladeElementRef } from '~utils/types' ;
14
+ import { useIsMobile } from '~utils/useIsMobile' ;
14
15
15
16
const _DateInput = (
16
17
props : BaseInputProps ,
@@ -48,7 +49,7 @@ const HiddenInput = ({ value, name }: { value: string; name?: string }): React.R
48
49
} ;
49
50
50
51
const iconVerticalMargin = {
51
- medium : sizeTokens [ 16 ] ,
52
+ medium : sizeTokens [ 14 ] ,
52
53
large : sizeTokens [ 24 ] ,
53
54
} as const ;
54
55
@@ -63,10 +64,12 @@ const _DatePickerInput = (
63
64
autoFocus,
64
65
name,
65
66
size = 'medium' ,
67
+ necessityIndicator,
66
68
...props
67
69
} : DatePickerInputProps ,
68
70
ref : React . ForwardedRef < any > ,
69
71
) : React . ReactElement => {
72
+ const isMobile = useIsMobile ( ) ;
70
73
const format = 'DD/MM/YYYY' ;
71
74
const isLarge = size === 'large' ;
72
75
const isLabelPositionLeft = labelPosition === 'left' ;
@@ -142,6 +145,7 @@ const _DatePickerInput = (
142
145
autoFocus = { autoFocus }
143
146
value = { startValue }
144
147
componentName = "DatePickerInputStart"
148
+ necessityIndicator = { necessityIndicator }
145
149
{ ...props }
146
150
{ ...referenceProps }
147
151
/>
@@ -151,7 +155,7 @@ const _DatePickerInput = (
151
155
size = "medium"
152
156
marginTop = {
153
157
// Hacky layouting because the we cannot put this inside the internal layout of BaseInput.
154
- hasLabel && ! isLabelPositionLeft
158
+ ( hasLabel && ! isLabelPositionLeft ) || isMobile
155
159
? `calc(${ makeSize ( iconVerticalMargin [ size ] ) } + ${ makeSize (
156
160
isLarge ? sizeTokens [ 20 ] : sizeTokens [ 15 ] ,
157
161
) } )`
0 commit comments