Skip to content

feat(core): add presentation to DateInput, DateTimeInput, TimeInput (AST-043) - #6628

Merged
imdreamrunner merged 10 commits into
mainfrom
feat/input-presentation
Sep 28, 2026
Merged

imdreamrunner merged 10 commits into
mainfrom
feat/input-presentation

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

User need

Builders choosing a picker surface for DateInput/DateTimeInput/TimeInput had to learn nativePicker (touch|always|never) while menus/selectors use presentation — and never hid that Astryx-desktop, Astryx-sheet, and (for TimeInput) 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 a TimeInput sheet at all.

Problem and solution fit

Implements spec:AST-043 exactly: one presentation prop (default adaptive-native; six values on TimeInput, five on DateInput/DateTimeInput per merged #6644) on the three inputs, forced surfaces, the FR2 fallback split, and deprecated-but-working nativePicker — 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 that main: implementation commits only, no spec changes.

Public delta and caller burden

  • New: presentation (six values incl. text-input on TimeInput only; five on DateInput/DateTimeInput, docs(spec): AST-043 — text-input is TimeInput-only #6644) + exported DateInputPresentation/DateTimeInputPresentation/TimeInputPresentation; new TimeInput bottom-sheet surface (DEC-3).
  • Behavior: default unchanged (adaptive-native = today's touch). Explicit presentation="native" is forced native (FR2, no fallbacks); deprecated nativePicker="always" without explicit presentation keeps its released fallbacks exactly (legacy mode), as do adaptive-native/default. Covered by updated+new tests.
  • Deprecated: nativePicker + *NativePicker types (docs, @deprecated, dev warning); presentation wins when both are set (FR4). Nonbreaking per AST-017 FR4; changeset patch for core+cli.
  • Migration: astryx upgrade codemod migrate-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.ts owns FR1–FR3 tables; each component dispatches to its existing fields (Pointer/Touch/Native), TimeInput gains TouchTimeField (time wheels from DateTimeInput's sheet). Rejected per spec DEC-1/DEC-2.

Evidence

  • 568 unit tests pass at a7fbec578d: all Time/Date/DateTime suites incl. Presentation.test.tsx per component (per-component values × pointers, precedence, TimeInput:never→text-input, sheet opening) and updated FR2 cases in NativeTimeInput.test.tsx.
  • Codemod tests (4) + staged-manifest test updated; docPropLiterals/docPropReferences pass; check:changesets pass; tsc/eslint clean on changed files (pre-existing env-only a11y-spec tsc noise elsewhere).
  • Real-browser forced-surface evidence: Storybook presentation controls/showcases in this PR — CI build-storybook/preview on this head is the browser layer (jsdom cannot report pointer type or draw native pickers, per spec).

Scope

  • One capability is added (spec:AST-043 implementation).
  • Consumer docs (en/zh+dense), focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

vitest run packages/core/src/{TimeInput,DateInput,DateTimeInput} (570 pass), codemod suite, doc-prop suites, tsc, eslint, prettier.

@vercel

vercel Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 28, 2026 5:20pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 25, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 25, 2026
@astracat-bot

astracat-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Sep 28, 2026, 5:34 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 25, 2026
@imdreamrunner
imdreamrunner marked this pull request as ready for review September 25, 2026 05:32

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 25, 2026
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Previews ready: Storybook and Sandbox were built with this PR's docsite. CI evidence will be added when available.

View Storybook for this PR · View Sandbox for this PR

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 25, 2026
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).
@imdreamrunner
imdreamrunner force-pushed the feat/input-presentation branch from b547933 to 39feac6 Compare September 25, 2026 19:35
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Sep 25, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 25, 2026
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}`.

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 25, 2026
…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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 26, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

github-actions Bot added a commit that referenced this pull request Sep 28, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

@imdreamrunner
imdreamrunner merged commit c1c2335 into main Sep 28, 2026
44 checks passed
@github-actions
github-actions Bot deleted the feat/input-presentation branch September 29, 2026 06:24

This branch was successfully deployed

1 active deployment
Preview — 023767c6 Deployed Sep 28, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant