Repository navigation
feat(core): add presentation to DateInput, DateTimeInput, TimeInput (AST-043) - #6628
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Thanks for the detailed implementation — the shared resolver, per-component tests, docs, and codemod make the proposed design easy to follow.
Approval needs a maintainer decision first: the presentation prop, its six values and default, the forced-native fallback split for explicit presentation, the nativePicker mapping and deprecation, and the new TimeInput bottom sheet are governed by AST-043, which is not yet a current spec on main — it is the proposed record carried in this PR and in the open spec PR that this PR says should land first. A maintainer needs to land that spec PR (or provide or identify the governing current spec) before this implementation can be approved; no code change is being requested for that gap itself.
One independent fix is required in the meantime, because human direction on this PR states: "nativePicker="always" behavior should not change." For TimeInput and DateTimeInput, a caller using nativePicker="always" together with seconds, a custom increment, or preset time options previously kept the Astryx field and is now forced to the native control (the new tests lock this in, and the codemod rewrites those callsites the same way). Please preserve the released fallback on the deprecated always path — while keeping explicit presentation="native" forced — restore the released always fallback tests, and leave those always callsites unmigrated in the codemod. DateInput is unaffected here, since its released always had no fallback to lose. Once that is done, the changeset and docs wording that nativePicker keeps working exactly as released will be accurate again.
The default and dual-prop precedence behaviour look consistent with the proposal in the re-run unit tests. Real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
PR Analysis Report
|
There was a problem hiding this comment.
Thanks for the detailed implementation — and for the follow-up fix: the shared resolver, per-component tests, docs, and codemod make the proposed design easy to follow, and the deprecated nativePicker="always" path now keeps its released behaviour.
Approval needs a maintainer decision first: the presentation prop, its six values and default, the forced-native fallback split for explicit presentation, the nativePicker mapping and deprecation, and the new TimeInput bottom sheet are governed by AST-043, which is not yet a current spec on main — it is the proposed record carried in this PR and in the open spec PR that this PR says should land first. A maintainer needs to land that spec PR (or provide or identify the governing current spec) before this implementation can be approved; no code change is being requested for that gap itself. That record should also settle one remaining question: human direction on this PR states — nativePicker="always" behavior should not change. — the unmigrated deprecated path now honours that, but the codemod still rewrites a static always callsite that uses seconds, a custom increment/step, or preset time options to forced presentation="native", so the record should say whether migrated callsites in those states must keep the released fallback too.
What is fixed at this head: for TimeInput and DateTimeInput, a caller using nativePicker="always" together with seconds, a custom increment/step, or preset time options again keeps the Astryx field, while explicit presentation="native" stays forced — verified in the re-run unit tests and in review probes for the DateTimeInput states. DateInput is unaffected here, since its released always had no fallback to lose.
Real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
Implements spec:AST-043 (FR1-FR5, DEC-3): - presentation: text-input | popover | bottom-sheet | native | adaptive-bottom-sheet | adaptive-native (default), resolved by the shared utils/inputPresentation resolver per pointer. - FR2 fallback split: native is forced (no Astryx fallback); adaptive-native keeps released fallbacks (TimeInput seconds/increment, DateTimeInput per-segment). - FR3/FR4: nativePicker deprecated (@deprecated types, docs, dev warning) and keeps working exactly (TimeInput never -> text-input); presentation wins when both are set. - DEC-3: forced popover/bottom-sheet surfaces plus a new TimeInput bottom-sheet field (TouchTimeField, time wheels from DateTimeInput's sheet). - Docs (en/zh + dense), Storybook controls/showcases, CLI template, changeset, and astryx upgrade codemod migrate-native-picker-to-presentation (+ tests). Tests: 570 passing across Time/Date/DateTime suites incl. new Presentation.test.tsx per component; codemod + doc-prop suites pass.
Route nativePicker=always without explicit presentation to legacy native mode (Time/DateTime): seconds, non-default increment/step, and preset options keep the Astryx field, exactly as released (AST-043 FR2/FR3). Explicit presentation=native stays forced with no fallback. Tests updated accordingly (suite green).
b547933 to
39feac6
Compare
There was a problem hiding this comment.
Thanks for the thorough implementation — and for the follow-up fix. The governing spec has now landed, the shared resolver and per-component tests line up with it, and the deprecated nativePicker="always" path once again keeps its released behaviour (seconds, custom increments/steps, and preset time options keep the Astryx field on TimeInput and DateTimeInput, while explicit presentation="native" stays forced).
One fix is needed before this can be approved, in the migration codemod. When a file contains both a migratable callsite and a callsite whose nativePicker is a conditional with one static and one dynamic branch — for example nativePicker={flag ? 'always' : mode} — the transform rewrites the static branch in place even though it leaves that prop unmigrated, and because the sibling callsite does migrate, the file is emitted with the conditional corrupted to nativePicker={flag ? 'native' : mode}. 'native' is not a nativePicker value, so that input resolves to no surface at runtime. Please make the value mapping atomic (check that every branch is mappable before mutating any of them, or restore the originals on failure) and add a regression test for that mixed-file case asserting the conditional is left byte-identical.
For completeness: real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
Collect a value's static leaves before mutating any of them, so a mixed static/dynamic conditional (e.g. flag ? 'always' : mode) stays byte-identical instead of being half-migrated to an invalid nativePicker='native' when a sibling callsite migrates the file. Regression test covers the mixed-file case.
There was a problem hiding this comment.
Thanks for the follow-up fix — the codemod mapping is now atomic, and I verified it directly: a partially dynamic conditional nativePicker (for example nativePicker={flag ? 'always' : mode}) is emitted unchanged while a migratable sibling in the same file still migrates, and fully static conditionals still migrate correctly. The governing spec, the shared resolver, and the deprecated nativePicker="always" preservation all line up as well.
One small fix is still needed before this can be approved. The new recursive collectStaticLeaves helper in the codemod has no return-type annotation in its JSDoc, so the CLI strict typecheck fails with TS7023: 'collectStaticLeaves' implicitly has return type 'any' — and the build-storybook CI job (and the build aggregator that depends on it) is red at this head after passing at the previous one. Adding @returns {boolean} to that helper's JSDoc should restore it; please confirm the CLI strict typecheck passes afterwards.
For completeness: real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
The recursive `collectStaticLeaves` helper in the nativePicker → presentation
codemod had no `@returns` JSDoc, so the CLI strict typecheck (checkJs +
strict) failed with TS7023: implicit `any` return type on a function that
references itself in its own return expressions. Declare `@returns {boolean}`.
There was a problem hiding this comment.
Thanks for the follow-up fixes — this now lines up. The governing spec, the shared resolver, and the deprecated nativePicker preservation all agree, including the direction that nativePicker="always" behavior should not change: for unmigrated callsites, seconds, custom increments/steps, and preset time options keep the Astryx field on TimeInput and DateTimeInput, while explicit presentation="native" stays forced. The codemod mapping is atomic too: a partially dynamic conditional nativePicker is emitted unchanged while a migratable sibling in the same file still migrates.
The last blocker is also fixed: the recursive collectStaticLeaves helper in the codemod now carries its @returns {boolean} annotation, and CI at this head is green, including the build-storybook and verify-codemods jobs.
Two notes for completeness: the later narrowing that makes text-input TimeInput-only is tracked as a separate follow-up and was not counted against this PR, and real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
…43 (#6644) DateInput and DateTimeInput no longer accept presentation="text-input". Their `presentation` is `PickerPresentation = Exclude<InputPresentation, 'text-input'>` (five values); TimeInput keeps all six. - utils/inputPresentation: add `PickerPresentation`, `PickerPresentationSurface` and type-checked picker-only twins (`pickerPresentationFromNativePicker`, `effectivePickerPresentation`, `resolvePickerPresentation`). The general resolvers delegate to them, so TimeInput's mapping (`never` → `text-input`) is unchanged and the narrowing needs no cast and no runtime rejection. - DateInput / DateTimeInput: drop the `text-input` dispatch and the `hasPicker(s)` plumbing. PointerDateField / PointerDateTimeField are back to their released popover behavior (toggle button, combobox role and ARIA, popover render, click/ArrowDown open) unconditionally. - Presentation tests: remove the text-input cases; the FR4 precedence test now pits presentation="bottom-sheet" against nativePicker="always". - Docs (en/zh/dense) and Storybook controls drop 'text-input' for DateInput/DateTimeInput; the changeset spells out their five values against TimeInput's six. - Review follow-ups: DateTimeInput usage prose describes `presentation` (adaptive-native default) instead of `nativePicker`; the `nativePicker` Storybook control in all three stories is marked deprecated with its `presentation` mapping.
There was a problem hiding this comment.
Thanks for adding the narrowing — this now lines up with the governing spec in full. presentation is five values on DateInput and DateTimeInput and six on TimeInput, with text-input excluded from the date inputs' exported types (a compile-time error, as the spec requires), their picker-less dispatch removed, and docs and Storybook controls stating the same split. The shared resolver, the deprecated nativePicker preservation, and the codemod all agree as well, including the direction that nativePicker="always" behavior should not change: for unmigrated callsites, seconds, custom increments/steps, and preset time options keep the Astryx field on TimeInput and DateTimeInput, while explicit presentation="native" stays forced, and a partially dynamic conditional nativePicker is left byte-identical by the codemod while a migratable sibling still migrates.
The earlier strict-typecheck blocker also stays fixed, and CI at this head is green across the test, lint, codemod, and Storybook jobs.
One note for completeness: real-browser surface evidence was not available in this review environment, so please make sure the Storybook/preview evidence for the forced surfaces is visible on the PR.
[Automated review]
There was a problem hiding this comment.
Thanks — this now lines up with the governing spec in full, including the latest change. presentation is five values on DateInput and DateTimeInput and six on TimeInput, with text-input excluded from the date inputs' exported types, and the deprecated nativePicker preservation holds: for unmigrated callsites, seconds, custom increments/steps, and preset time options keep the Astryx field on TimeInput and DateTimeInput, while explicit presentation="native" stays forced, and a partially dynamic conditional nativePicker is left byte-identical by the codemod while a migratable sibling still migrates.
The new TimeInput bottom sheet's chrome also now matches the DateTimeInput sheet it is the time half of: the same top/side/bottom insets (with clearance for the floating handle), the same wheel height and spacing, and the same footer spacing, with no change to the wheels' own sizing or height.
One note for completeness: real-browser surface evidence was not available in this review environment, and the CI test and Storybook jobs were still running at the final check, so please make sure the Storybook/preview evidence for the forced surfaces and the aligned sheet is visible on the PR.
[Automated review]
There was a problem hiding this comment.
Thanks — this lines up with the governing spec in full. presentation is five values on DateInput and DateTimeInput and six on TimeInput, with text-input excluded from the date inputs' exported types, and the deprecated nativePicker preservation holds: for unmigrated callsites, seconds, custom increments/steps, and preset time options keep the Astryx field on TimeInput and DateTimeInput, while explicit presentation="native" stays forced, and a partially dynamic conditional nativePicker is left byte-identical by the codemod while a migratable sibling still migrates.
The new TimeInput bottom sheet's chrome also matches the DateTimeInput sheet it is the time half of: the same insets (with clearance for the floating handle), the same wheel height and spacing, and the same footer spacing. The Storybook row and the constrained-time template both use the explicit adaptive-bottom-sheet value — bottom sheet on a coarse pointer, typed field on a fine pointer — which is the way the spec provides for reaching a TimeInput sheet, and the template's min/max purpose still holds on that surface.
At this revision the only change is a merge bringing in the current base; the PR's own files are unchanged, and the four focused presentation/native suites were re-run locally and pass (28 tests). One note for completeness: real-browser frame capture was not available in this review environment, and a couple of CI jobs were still running at the final check, so please make sure the Storybook/preview evidence for the forced surfaces and the aligned sheet is visible on the PR.
[Automated review]
User need
Builders choosing a picker surface for
DateInput/DateTimeInput/TimeInputhad to learnnativePicker(touch|always|never) while menus/selectors usepresentation— andneverhid that Astryx-desktop, Astryx-sheet, and (forTimeInput) the typed field are different surfaces. Why it matters: the prop name/value a builder picks silently decides native vs Astryx behavior per pointer, and the old vocabulary cannot express forced surfaces or aTimeInputsheet at all.Problem and solution fit
Implements
spec:AST-043exactly: onepresentationprop (defaultadaptive-native; six values onTimeInput, five onDateInput/DateTimeInputper merged #6644) on the three inputs, forced surfaces, the FR2 fallback split, and deprecated-but-workingnativePicker— no surface's design changes beyond the DEC-3-approved new reach.Current specification
spec:AST-043— merged in #6614 (0899f21aeb,current/accepted). This branch is rebased onto thatmain: implementation commits only, no spec changes.Public delta and caller burden
presentation(six values incl.text-inputonTimeInputonly; five onDateInput/DateTimeInput, docs(spec): AST-043 — text-input is TimeInput-only #6644) + exportedDateInputPresentation/DateTimeInputPresentation/TimeInputPresentation; newTimeInputbottom-sheet surface (DEC-3).adaptive-native= today'stouch). Explicitpresentation="native"is forced native (FR2, no fallbacks); deprecatednativePicker="always"without explicitpresentationkeeps its released fallbacks exactly (legacy mode), as doadaptive-native/default. Covered by updated+new tests.nativePicker+*NativePickertypes (docs,@deprecated, dev warning);presentationwins when both are set (FR4). Nonbreaking per AST-017 FR4; changesetpatchfor core+cli.astryx upgradecodemodmigrate-native-picker-to-presentation(static literals; already-dual callsites drop the deprecated prop; dynamic left working).Before:
<TimeInput nativePicker="never" />→ After:<TimeInput presentation="text-input" />(old code keeps working unchanged).Design and alternatives
Shared resolver
utils/inputPresentation.tsowns FR1–FR3 tables; each component dispatches to its existing fields (Pointer/Touch/Native),TimeInputgainsTouchTimeField(time wheels fromDateTimeInput's sheet). Rejected per spec DEC-1/DEC-2.Evidence
a7fbec578d: all Time/Date/DateTime suites incl.Presentation.test.tsxper component (per-component values × pointers, precedence,TimeInput:never→text-input, sheet opening) and updated FR2 cases inNativeTimeInput.test.tsx.docPropLiterals/docPropReferencespass;check:changesetspass; tsc/eslint clean on changed files (pre-existing env-only a11y-spec tsc noise elsewhere).presentationcontrols/showcases in this PR — CIbuild-storybook/preview on this head is the browser layer (jsdom cannot report pointer type or draw native pickers, per spec).Scope
Testing
vitest run packages/core/src/{TimeInput,DateInput,DateTimeInput}(570 pass), codemod suite, doc-prop suites,tsc,eslint, prettier.