Skip to content

feat(lab): MobileTokenizer — touch Tokenizer prototype - #6640

Merged
imdreamrunner merged 4 commits into
mainfrom
feat/mobile-tokenizer-lab
Sep 26, 2026
Merged

imdreamrunner merged 4 commits into
mainfrom
feat/mobile-tokenizer-lab

Conversation

@imdreamrunner

Copy link
Copy Markdown
Contributor

User need

On compact touch devices, the Core Tokenizer's inline combobox (tokens + input + anchored menu in one field) cannot hold token chips, a 44px-target result list, and the software keyboard at once. Builders need a way to try the touch flow — summary field, stacked manage/add sheets — before it is specified for Core.

Lab is the staging area for exactly this: canary-only, no stability promise, iterate freely.

Problem and solution fit

  • Primary: MobileTokenizer in @astryxdesign/lab — field trigger opens a manage BottomSheet (selected rows, remove, Clear all, Add item), Add item stacks an add BottomSheet (result rows above, filter + Done in the bottom row above the keyboard, tap +/check toggles immediately).
  • Supporting: Storybook story Lab/MobileTokenizer, colocated tests, component doc.

Current specification

None for Lab (by design). The Core graduation is a separate stacked change: Tokenizer presentation="bottom-sheet" | "adaptive", mirroring the released Selector/MultiSelector presentation contract. This Lab API mirrors Core Tokenizer (searchSource/value/onChange with single-item change, hasCreate, maxEntries, renderItem) so graduation is an import swap.

Public delta and caller burden

New Lab-only export; no Core API changed.

import {MobileTokenizer} from '@astryxdesign/lab';

<MobileTokenizer label="Tags" searchSource={source} value={value} onChange={setValue} />

Defaults: no maxEntries cap, debounceMs=150, emptySearchResultsText='No results found'.

Design and alternatives

  • Two sheets via BottomSheetSwitcher (one dialog, one scrim, stacked handoff) — rejected: two standalone sheets (two modals/scrims).
  • Immediate toggle on tap — rejected: staged commit on Done (would need a bulk change event Tokenizer does not have; Done is back-navigation).
  • Filter at the bottom beside Done, as drawn — keyboard accommodation is owned by the tall BottomSheet (useMobileKeyboard scrolls the focused filter into the safe area).
  • No visible sheet headings or selection count, per the design sketch; sheet accessible names come from BottomSheet label.

Evidence

  • Vitest: packages/lab/src/MobileTokenizer 2/2 (field→manage→add flow, remove/clear).
  • Real-browser (Chromium, 390x844, touch): field, manage sheet, add sheet with bottom filter verified visually.
  • Core Tokenizer unchanged in this PR.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

vitest run packages/lab/src/MobileTokenizer/ — 2 passed. Storybook: Lab/MobileTokenizer — Touch flow.

Standalone Lab port of the stacked manage+add sheet flow using
public Core APIs only; API mirrors Core Tokenizer for graduation.
Core promotion (Tokenizer presentation) stacks on top separately.
Remove Tags/Add item headings and the N selected text; manage
sheet is rows + close, add sheet is rows + bottom filter/Done.
Sheet accessible names remain via BottomSheet label.
@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 25, 2026 11:18pm 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
@astracat-bot

astracat-bot Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Sep 25, 2026, 11:44 PM UTC

New Lab component adds components/lab/mobile-tokenizer; refresh
the reviewed route lock (generate-data.mjs checkShadcnRouteLock).
@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox are not both ready on the exact-head Vercel preview.

New Components

MobileTokenizer (@astryxdesign/lab)
Metric Value
Bundle Size (ESM) N/A
Bundle Size (CJS) 328B
Lines of Code 442
Source Files 2
Complexity Very High (43)
Exports MobileTokenizer
Props Count N/A
Has Tests Yes
Has Stories Yes

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/lab N/A 3.8KB 1.6KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

25 of 420 shot(s) changed. View the report

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 42,708
Chat Empty State probe light 42,708
Chat Full AI Chat probe dark 41,786
Chat Empty State probe dark 41,786
Slider Default probe light 15,617
Slider Default probe dark 15,615
Chat With Attachments probe light 12,964
Chat With Attachments probe dark 12,114
InputGroup With Typeahead probe light 11,012
InputGroup With Typeahead probe dark 9,189
ComplexSelector Tree list with search probe light 6,245
TextArea Vertical Form Alignment probe light 5,634
ComplexSelector Tree list with search probe dark 5,602
TextArea Vertical Form Alignment probe dark 5,047
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
ToggleButton Group Single probe dark 1,538
ToggleButton Group Single probe light 1,538
MediaTheme On Dark neutral dark 838
Banner Collapsible Content (Expanded) probe dark 92

and 5 more.

Chat — Full AI Chat — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — Empty State — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — Full AI Chat — probe dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | View full report

TextInput Field root shrink-wraps; give it flex-basis 0 + width
100% so it takes all filter-row space except Done and gap.

@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 putting this touch Tokenizer flow together as a Lab prototype — the problem it addresses is clear, and keeping Core unchanged while the flow is tried in Lab is the right shape.

Approval needs a maintainer decision first. This adds MobileTokenizer as a new public @astryxdesign/lab export, and the PR notes there is currently no specification for it. A maintainer needs to provide or identify the governing spec for this addition — specifically what settles its public API (searchSource/value/onChange, hasCreate, maxEntries, renderItem) and its stacked manage/add-sheet behaviour with immediate tap-to-toggle selection — before it can be approved.

Two smaller fixes are also needed, independent of that decision:

  • If the search source rejects, the add sheet keeps showing the previous query's results as if they matched the current filter, and those stale rows can still be tapped. Please clear the results (or show the empty-results text) when a search fails.
  • The component doc describes label as a sheet heading even though the sheets deliberately render no heading, and its props list omits several exported props (description, isOptional, isDisabled, maxMenuItems, minQueryLength, debounceMs, emptySearchResultsText, onChangeQuery). Please align the doc with the exported interface.

No Core behaviour changes in this PR, and the additive, canary-only scope is welcome.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 25, 2026
@imdreamrunner
imdreamrunner merged commit e983e37 into main Sep 26, 2026
49 checks passed
AKnassa added a commit to AKnassa/astryx that referenced this pull request Sep 26, 2026
The pre-commit hook (lint-staged: eslint --fix + prettier --write) ran on
the upstream/main merge commit dc0e1e4 and rewrote 12 files that this PR
never touched, so they showed up as formatting-only churn in the PR diff.
This restores each of them byte-for-byte from upstream/main (82fb22c,
the merge's second parent):

- apps/storybook/stories/MobileTokenizer.stories.tsx
- internal/vibe-tests/stepper-collapse-naming-test/PLAN.md
- internal/vibe-tests/stepper-collapse-naming-test/docs/arm-{a-collapsed,b-bare,c-summary,d-enum,recall}.md
  (gen-docs.mjs output; PLAN.md relies on the arms staying byte-identical
  outside their substitutions)
- packages/core/src/Carousel/Carousel.test.tsx
- packages/core/src/Chat/__tests__/ChatMessageMetadata.a11y.chromium.spec.ts
- packages/core/src/TextInput/TextInput.test.tsx
- packages/lab/src/MobileTokenizer/MobileTokenizer.{tsx,test.tsx} (meta#6640)

Committed with the hook bypassed, because lint-staged would otherwise
re-prettify exactly these staged files. After this commit,
`git diff --stat upstream/main HEAD` lists only the PR's 16 files.
@github-actions
github-actions Bot deleted the feat/mobile-tokenizer-lab branch September 26, 2026 06:21
@jiunshinn jiunshinn mentioned this pull request Sep 30, 2026
4 tasks done

This branch was successfully deployed

1 active deployment
Preview — 1fa72908 Deployed Sep 25, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant