@@ -5,6 +5,7 @@ import { Icon } from "../Icon/Icon";
5
5
import { Container } from "../Container/Container" ;
6
6
import { useCalendar , UseCalendarOptions } from "@h6s/calendar" ;
7
7
import { IconButton } from "../IconButton/IconButton" ;
8
+ import { Text } from "../Typography/Text/Text" ;
8
9
9
10
const locale = "en-US" ;
10
11
const selectedDateFormatter = new Intl . DateTimeFormat ( locale , {
@@ -63,30 +64,7 @@ export const DatePickerInput = ({
63
64
) ;
64
65
} ;
65
66
66
- // This is taken from InputElement from InputWrapper.tsx
67
- // We need to be able to change the color of some of the text of the 'input element'
68
- // but that isn't possible with an input element, so we have to fake it. Thus the name.
69
- const FakeInputElement = styled . div `
70
- background: transparent;
71
- border: none;
72
- outline: none;
73
- width: 100%;
74
- color: inherit;
75
- font: inherit;
76
- ${ ( { theme } ) => `
77
- padding: ${ theme . click . field . space . y } 0;
78
- &::placeholder {
79
- color: ${ theme . click . field . color . placeholder . default } ;
80
- }
81
-
82
- &:disabled, &.disabled {
83
- &::placeholder {
84
- color: ${ theme . click . field . color . placeholder . disabled } ;
85
- }
86
- ` }
87
- ` ;
88
-
89
- const MutedColorSpan = styled . span `
67
+ const MutedColorSpan = styled ( Text ) `
90
68
color: ${ ( { theme } ) => theme . global . color . text . muted } ;
91
69
` ;
92
70
@@ -109,7 +87,7 @@ export const DateRangePickerInput = ({
109
87
} : DateRangePickerInputProps ) => {
110
88
const defaultId = useId ( ) ;
111
89
112
- let formattedValue = < MutedColorSpan > { placeholder ?? "" } </ MutedColorSpan > ;
90
+ let formattedValue = < MutedColorSpan as = "span" > { placeholder ?? "" } </ MutedColorSpan > ;
113
91
if ( selectedStartDate ) {
114
92
if ( selectedEndDate ) {
115
93
formattedValue = (
@@ -122,7 +100,7 @@ export const DateRangePickerInput = ({
122
100
formattedValue = (
123
101
< span >
124
102
{ selectedDateFormatter . format ( selectedStartDate ) } { " " }
125
- < MutedColorSpan > – end date</ MutedColorSpan >
103
+ < MutedColorSpan as = "span" > – end date</ MutedColorSpan >
126
104
</ span >
127
105
) ;
128
106
}
@@ -135,9 +113,12 @@ export const DateRangePickerInput = ({
135
113
id = { id ?? defaultId }
136
114
>
137
115
< Icon name = "calendar" />
138
- < FakeInputElement data-testid = "daterangepicker-input" >
116
+ < InputElement
117
+ as = "div"
118
+ data-testid = "daterangepicker-input"
119
+ >
139
120
{ formattedValue }
140
- </ FakeInputElement >
121
+ </ InputElement >
141
122
</ HighlightedInputWrapper >
142
123
) ;
143
124
} ;
@@ -165,7 +146,7 @@ const UnselectableTitle = styled.h2`
165
146
const DateTable = styled . table `
166
147
border-collapse: separate;
167
148
border-spacing: 0;
168
- font: ${ ( { theme } ) => theme . typography . styles . product . text . normal . md }
149
+ font: ${ ( { theme } ) => theme . typography . styles . product . text . normal . md } ;
169
150
table-layout: fixed;
170
151
user-select: none;
171
152
width: ${ explicitWidth } ;
@@ -178,7 +159,8 @@ const DateTable = styled.table`
178
159
cursor: pointer;
179
160
}
180
161
181
- td, th {
162
+ td,
163
+ th {
182
164
padding: 4px;
183
165
}
184
166
` ;
0 commit comments