Skip to content

Commit 972d401

Browse files
feat: update date field to v4 design (#16430)
Refactors date field UI to match V4 designs. --------- Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
1 parent ad9e171 commit 972d401

10 files changed

Lines changed: 1049 additions & 1317 deletions

File tree

.claude/skills/ui4-review/SKILL.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,65 @@ These must be replaced with new tokens.
185185

186186
---
187187

188+
### SCSS Patterns in Native CSS (CRITICAL)
189+
190+
Native CSS nesting does NOT support all SCSS patterns. Flag these:
191+
192+
**Bad — `&--modifier` for BEM modifiers:**
193+
194+
```css
195+
.react-datepicker {
196+
/* This does NOT work in native CSS */
197+
&--time-only {
198+
border: none;
199+
}
200+
}
201+
```
202+
203+
In SCSS, `&--time-only` expands to `.react-datepicker--time-only`. In native CSS, `&` represents the _entire selector list_, not a string to concatenate.
204+
205+
**Good — Use flat selectors outside the block:**
206+
207+
```css
208+
.react-datepicker {
209+
/* base styles */
210+
}
211+
212+
.react-datepicker--time-only {
213+
border: none;
214+
}
215+
```
216+
217+
**Also bad — `&__element` for BEM elements:**
218+
219+
```css
220+
.block {
221+
&__element {
222+
/* Does NOT work */
223+
}
224+
}
225+
```
226+
227+
**Detection pattern:** Look for `&--` or `&__` inside CSS blocks. These are SCSS-only patterns.
228+
229+
**Exception:** `&:pseudo` and `& .child` work fine in native CSS:
230+
231+
```css
232+
.button {
233+
&:hover {
234+
/* OK */
235+
}
236+
&:focus {
237+
/* OK */
238+
}
239+
& .icon {
240+
/* OK */
241+
}
242+
}
243+
```
244+
245+
---
246+
188247
## Behavior: AUTO-FIX
189248

190249
**Do NOT just report violations. FIX THEM.**

packages/ui/src/elements/DatePicker/DatePicker.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ const ReactDatePicker =
1111
import type { Props } from './types.js'
1212

1313
import { CalendarIcon } from '../../icons/Calendar/index.js'
14-
import { XIcon } from '../../icons/X/index.js'
1514
import { useTranslation } from '../../providers/Translation/index.js'
16-
import './index.scss'
15+
import './index.css'
1716
import { getFormattedLocale } from './getFormattedLocale.js'
1817

1918
const baseClass = 'date-time-picker'
@@ -97,6 +96,7 @@ const DatePicker: React.FC<Props> = (props) => {
9796
showMonthYearPicker: pickerAppearance === 'monthOnly',
9897
showPopperArrow: false,
9998
showTimeSelect: pickerAppearance === 'dayAndTime' || pickerAppearance === 'timeOnly',
99+
showTimeSelectOnly: pickerAppearance === 'timeOnly',
100100
timeFormat,
101101
timeIntervals,
102102
...(overrides as Extract<
@@ -124,25 +124,15 @@ const DatePicker: React.FC<Props> = (props) => {
124124

125125
return (
126126
<div className={classes} id={id}>
127-
<div className={`${baseClass}__icon-wrap`}>
128-
{dateTimePickerProps.selected && (
129-
<button
130-
className={`${baseClass}__clear-button`}
131-
onClick={() => onChange(null)}
132-
type="button"
133-
>
134-
<XIcon />
135-
</button>
136-
)}
137-
<CalendarIcon />
138-
</div>
139127
<div className={`${baseClass}__input-wrapper`}>
140128
<ReactDatePicker
141129
{...dateTimePickerProps}
142130
dropdownMode="select"
143131
showMonthDropdown
144132
showYearDropdown
145133
/>
134+
{/* TODO: update icon */}
135+
<CalendarIcon />
146136
</div>
147137
</div>
148138
)

0 commit comments

Comments
 (0)