Skip to content

Commit c685444

Browse files
committed
feat(ui-date-input): migrate DateInput and DateInput2
1 parent df36851 commit c685444

13 files changed

Lines changed: 2060 additions & 3080 deletions

File tree

cypress/component/DateInput.cy.tsx

Lines changed: 1084 additions & 196 deletions
Large diffs are not rendered by default.

cypress/component/DateInput2.cy.tsx

Lines changed: 0 additions & 1160 deletions
This file was deleted.

docs/guides/upgrade-guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ type: embed
231231

232232
```
233233

234+
### DateInput / DateInput2
235+
236+
**Short version:** Use [`DateInput`](/v11_7/DateInput). Forget `DateInput2` exists.
237+
238+
**The full story:** The original `DateInput` had a complex API — you had to manually wire up calendar navigation, day rendering, and date parsing. We wanted to simplify it but couldn't without breaking changes, so we released `DateInput2` as a drop-in alternative with a much simpler API.
239+
240+
Now that InstUI supports component versioning, we no longer need the separate `DateInput2` name. Instead:
241+
242+
- **[DateInput v2](/v11_7/DateInput)** (from v11.7) — the recommended version. Same component that was previously `DateInput2`, same API. **This is the only version that will receive the new theming.**
243+
- **[DateInput v1](/v11_6/DateInput)** (up to v11.6) — the original component. **Deprecated.** Does not support the new theming system.
244+
- **[DateInput2 v1](/v11_6/DateInput2)****Deprecated.** Will not get a v2 and does not support the new theming system. If you're using `DateInput2`, switch your import to `DateInput` (from v11.7) — the API is identical, no other code changes needed.
245+
234246
### ColorPicker
235247

236248
```js

packages/__docs__/src/compileMarkdown.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { Playground } from './Playground'
3939
import { compileAndRenderExample } from './compileAndRenderExample'
4040
import { Heading } from './Heading'
4141
import { Link } from './Link'
42-
import { navigateTo } from './navigationUtils'
42+
import { navigateTo, MINOR_VERSION_REGEX } from './navigationUtils'
4343

4444
type CodeData = {
4545
code: string
@@ -286,7 +286,21 @@ const renderer = (title: string) => ({
286286
return
287287
}
288288
e.preventDefault()
289-
navigateTo(href)
289+
290+
// Markdown links can point to a specific version of a component,
291+
// e.g. href="/v11_7/DateInput". navigateTo() expects the page
292+
// name and version as separate arguments, so we need to split
293+
// them apart. Plain links like "DateInput" are passed through
294+
// as-is.
295+
const path = href.replace(/^\/+/, '') // "/v11_7/DateInput" -> "v11_7/DateInput"
296+
const [first, second] = path.split('/')
297+
const isVersionedLink = MINOR_VERSION_REGEX.test(first) && second
298+
299+
if (isVersionedLink) {
300+
navigateTo(second, { minorVersion: first })
301+
} else {
302+
navigateTo(href)
303+
}
290304
}}
291305
>
292306
{text}

packages/ui-date-input/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ A date input component.
1010

1111
The `ui-date-input` package contains the following:
1212

13-
- [DateInput](DateInput)
13+
- [DateInput](DateInput) — the recommended date input component
14+
- [DateInput2](DateInput2) — deprecated, use `DateInput` instead
1415

1516
### Installation
1617

packages/ui-date-input/src/DateInput/v1/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
describes: DateInput
33
---
44

5-
> _Note:_ we recommend to update to the new [`DateInput2`](/#DateInput2) which is easier to configure for developers, has a better UX, better accessibility features and a year picker. `DateInput` will be deprecated in the future.
5+
> **Deprecated:** This version of `DateInput` is deprecated. Please use the latest version of [`DateInput`](/v11_7/DateInput) which offers easier configuration, better UX, improved accessibility, and a year picker.
6+
7+
### DateInput versions at a glance
8+
9+
| Version | API | Theming | Accessibility | Status |
10+
| :----------------------------------------- | :--------------------------- | :--------------- | :-------------- | :-------------- |
11+
| [v11.6 DateInput](/v11_6/DateInput) (this) | Old (manual calendar wiring) | Old theming only | Has a11y issues | **Deprecated** |
12+
| [v11.6 DateInput2](/v11_6/DateInput2) | New (simple) | Old theming only | Good | **Deprecated** |
13+
| [v11.7 DateInput](/v11_7/DateInput) | New (simple) | New theming | Good | **Recommended** |
614

715
The `DateInput` component provides a visual interface for inputting date data.
816

0 commit comments

Comments
 (0)