You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c1d1852
Browse filesBrowse the repository at this point in the historyBrowse files
Ports the Lab MobileTokenizer touch flow into Tokenizer as the
`bottom-sheet` value of the experimental `presentation` option
(`experimental={{presentation: 'popover' | 'bottom-sheet' | 'adaptive'}}`,
spec:AST-017 FR21). `adaptive` resolves through useAdaptivePresentation,
the policy Selector, MultiSelector and DropdownMenu share. Omitting
`experimental` keeps the inline combobox unchanged.
The sheet is one standalone BottomSheet driven by `isOpen`: the shared
PanelSearchInput on top (grown to the 44px rows through a new internal
fieldXstyle), checkbox rows that keep their place while the sheet is open
and regroup selected-first on the next open, 50-row progressive rendering,
a Create row with a trailing Add action under hasCreate, and a footer with
a confirmed Clear all and Done. The list is busy from open and from each
query change until the search settles. Selection stays in Tokenizer so the
add, remove and create paths and their announcements are the inline
field's own. The trigger is the control: base props and `ref` reach it, its
accessible description lists the selected tokens, and a field that becomes
disabled while the sheet is open closes it and takes focus back. Props with
no sheet surface warn once in development. The surface loads with
React.lazy and renders nothing during hydration, so a Tokenizer that does
not opt in does not carry it. The sheet's parts expose no theming targets
while the option is experimental.
Also: @astryx.tokenizer.* catalog keys for the sheet's strings, doc.mjs
prop and examples, a `Tokenizer — Adaptive presentation` block template
(and its ShadCN route), three Core/Tokenizer stories, tests for the
resolution and the ported flow, an [experimental] core changeset and a
[docs] cli changeset, and the deletion of the spec's implementation-gap
notes.
[experimental] Tokenizer gains a touch surface behind `experimental={{presentation: 'bottom-sheet' | 'adaptive'}}`. `bottom-sheet` replaces the inline combobox with a trigger that shows the selected tokens and opens one tall modal sheet: a search row on top, full-width checkbox rows that keep their place while the sheet is open and regroup selected-first on the next open, 50-row progressive rendering for long lists, a `Create "…"` row with a trailing Add action under `hasCreate`, and a footer with a confirmed Clear all and Done. `adaptive` uses the sheet on compact coarse-pointer screens and the popover otherwise, resolved the same way Selector resolves it. The sheet surface loads on demand, so a Tokenizer that does not opt in does not carry it. The trigger describes its selected tokens to assistive technology, announcements made while the sheet is open reach assistive technology through a live region inside the sheet, with `experimental` passed the component also accepts a `Ref<HTMLInputElement | HTMLButtonElement>` because `ref` reaches the trigger in the sheet presentation (the exported `TokenizerProps` interface is unchanged), and in development the field warns once about props that have no surface in the sheet presentation (`renderItem`, `renderToken`, `endContent`, `hasClear`, `hasEntriesOnFocus`, `menuWidth`, `tokenOverflowBehavior`, `hasAutoFocus`). New `@astryx.tokenizer.*` catalog keys for the sheet's strings; the sheet's parts expose no theming targets while the option is experimental. Anything inside Tokenizer's `experimental` prop may change or be removed in a patch release; omitting it keeps the stable behavior.
Copy file name to clipboardExpand all lines: packages/core/locales/en.json
+52Lines changed: 52 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1599,6 +1599,58 @@
1599
1599
"defaultMessage": "Removed {label}",
1600
1600
"description": "Polite screen-reader announcement after a token is removed from a Tokenizer, by its × button or by Backspace. Live-region text, never shown on screen; `{label}` is the token's visible text."
1601
1601
},
1602
+
"@astryx.tokenizer.search": {
1603
+
"defaultMessage": "Search {label}",
1604
+
"description": "Accessible name of the search field at the top of a Tokenizer's bottom sheet (the touch presentation). `{label}` is the field's own label, e.g. `Search Tags`. Not shown on screen."
1605
+
},
1606
+
"@astryx.tokenizer.searchPlaceholder": {
1607
+
"defaultMessage": "Search…",
1608
+
"description": "Placeholder inside the search field at the top of a Tokenizer's bottom sheet, shown while the query is empty. Single word plus ellipsis."
1609
+
},
1610
+
"@astryx.tokenizer.noItems": {
1611
+
"defaultMessage": "No items available",
1612
+
"description": "Title of the empty state inside a Tokenizer's bottom sheet when the search source has nothing to choose from and no query is typed. Neutral tone (not error-y)."
1613
+
},
1614
+
"@astryx.tokenizer.noItemsDescription": {
1615
+
"defaultMessage": "There are no items to choose from.",
1616
+
"description": "Supporting sentence under the `No items available` empty-state title inside a Tokenizer's bottom sheet."
1617
+
},
1618
+
"@astryx.tokenizer.noResultsDescription": {
1619
+
"defaultMessage": "Try a different search.",
1620
+
"description": "Supporting sentence under the no-results empty-state title inside a Tokenizer's bottom sheet, suggesting the person change the query."
1621
+
},
1622
+
"@astryx.tokenizer.create": {
1623
+
"defaultMessage": "Create \"{value}\"",
1624
+
"description": "Label of the create row inside a Tokenizer's bottom sheet when `hasCreate` is set and the typed text matches no existing item. `{value}` is the typed text, e.g. `Create \"Marketing\"`."
1625
+
},
1626
+
"@astryx.tokenizer.add": {
1627
+
"defaultMessage": "Add",
1628
+
"description": "Visible label of the button at the end of the create row inside a Tokenizer's bottom sheet; pressing it adds the typed text as a new token. Imperative verb; short."
1629
+
},
1630
+
"@astryx.tokenizer.addValue": {
1631
+
"defaultMessage": "Add {value}",
1632
+
"description": "Screen-reader-only name of the create row's Add button inside a Tokenizer's bottom sheet. `{value}` is the typed text, e.g. `Add Marketing`."
1633
+
},
1634
+
"@astryx.tokenizer.done": {
1635
+
"defaultMessage": "Done",
1636
+
"description": "Label of the primary footer button inside a Tokenizer's bottom sheet; pressing it closes the sheet. Selections are already applied, so this is not a confirm."
1637
+
},
1638
+
"@astryx.tokenizer.clearAllTitle": {
1639
+
"defaultMessage": "Clear all selected items?",
1640
+
"description": "Title of the confirmation dialog shown when the person presses Clear all inside a Tokenizer's bottom sheet. A question."
1641
+
},
1642
+
"@astryx.tokenizer.clearAllDescription": {
1643
+
"defaultMessage": "This removes all selected items from {label}.",
1644
+
"description": "Body of the Clear all confirmation dialog inside a Tokenizer's bottom sheet. `{label}` is the field's own label, e.g. `This removes all selected items from Tags.`"
1645
+
},
1646
+
"@astryx.tokenizer.selectedCount": {
1647
+
"defaultMessage": "{count, number} selected",
1648
+
"description": "Screen-reader-only lead-in of the description on a Tokenizer's bottom-sheet trigger (the touch presentation), followed by the selected token labels. `{count}` is how many tokens are selected, e.g. `2 selected`. Not shown on screen."
1649
+
},
1650
+
"@astryx.tokenizer.clearSelection": {
1651
+
"defaultMessage": "Clear selection",
1652
+
"description": "Label of the destructive action button in the Clear all confirmation dialog inside a Tokenizer's bottom sheet. Imperative verb phrase; confirms removing every token."
1653
+
},
1602
1654
"@astryx.lightbox.imagePosition": {
1603
1655
"defaultMessage": "Image {index, number} of {total, number}",
1604
1656
"description": "Polite screen-reader announcement when a Lightbox moves to a media item that has no alt text. Live-region text, never shown on screen; `{index}` is 1-based, example: `Image 3 of 12`."
"Experimental options: anything in this object may change or be removed in a patch release, and omitting it keeps the stable behavior. presentation (default 'popover') chooses how the field presents its choices. popover is the inline combobox with its anchored suggestion menu. bottom-sheet replaces it with a trigger showing the selected tokens that opens one tall modal sheet: a search row on top, full-width checkbox rows that keep their place while the sheet is open, a Create row with hasCreate, and a footer with a confirmed Clear all and Done. adaptive uses the bottom sheet on compact touch screens and the popover otherwise, resolved the same way Selector resolves it. In the sheet presentation the trigger is the control (ref, id, aria-* and data-* reach it; with experimental passed, ref also accepts a Ref<HTMLInputElement | HTMLButtonElement>; the exported TokenizerProps interface is unchanged), and renderItem, renderToken, endContent, hasClear, hasEntriesOnFocus, menuWidth, tokenOverflowBehavior and hasAutoFocus have no surface to act on; the field warns once in development when they are passed.",
label: 'Touch sheet on compact screens (experimental)',
325
+
code: `const [tags, setTags] = useState([]);
326
+
<Tokenizer
327
+
label="Tags"
328
+
searchSource={tagSource}
329
+
value={tags}
330
+
onChange={items => setTags(items)}
331
+
placeholder="Add tags"
332
+
hasCreate
333
+
experimental={{presentation: 'adaptive'}}
334
+
/>`,
335
+
},
336
+
],
302
337
usage: {
303
338
description:
304
339
'Tokenizer is a multi-select input that lets users search, select, and manage multiple items displayed as removable chips. Use it when users need to build a set of selections from a searchable data source, like adding team members, applying tags, or choosing filters.',
containerXstyle: 'StyleX styles for the field container; no effect in InputGroup or horizontal-labels FormLayout. No root xstyle/className/style.',
825
+
containerXstyle:
826
+
'StyleX styles for the field container; no effect in InputGroup or horizontal-labels FormLayout. No root xstyle/className/style.',
784
827
containerClassName: 'Class name for the field container.',
785
828
containerStyle: 'Inline styles for the field container.',
786
-
controlXstyle: 'StyleX styles for the visual control box (border, background, icons); not the native input.',
829
+
controlXstyle:
830
+
'StyleX styles for the visual control box (border, background, icons); not the native input.',
787
831
controlClassName: 'Class name for the visual control box.',
788
832
controlStyle: 'Inline styles for the visual control box.',
789
833
label: 'Accessible label for input.',
@@ -825,5 +869,7 @@ export const docsDense = {
825
869
'Icon at input start, before tokens. Icon name, SVG component, or ReactNode.',
826
870
endContent: 'Content at input row end. For buttons, counts, controls.',
827
871
handleRef: 'Imperative handle for focus() and blur() control.',
872
+
experimental:
873
+
"Experimental; may change in a patch. presentation: 'popover' (default, inline combobox) | 'bottom-sheet' (trigger + one searchable modal sheet of checkbox rows) | 'adaptive' (sheet on compact touch, else popover).",
0 commit comments