Skip to content

Commit 5d33dd5

Browse files
committed
feat(PowerSearch): presentation is a stable prop, and adaptive is its default
PowerSearch's touch sheet flow graduates from `experimental.presentation` to a stable top-level `presentation` prop (`'popover' | 'bottom-sheet' | 'adaptive'`, typed by the new exported `PowerSearchPresentation`), and an omitted `presentation` resolves `adaptive`: the stacked filter sheets on a compact coarse-pointer screen, and the tokenizer field with its editor popover with a fine pointer, on a screen that is not compact, on the server, and while hydrating. `experimental.presentation` stays as a deprecated experimental alias; the top-level prop wins when both are set, with one development warning. A staged codemod rewrites a static `experimental={{presentation: x}}` to `presentation={x}`. Stories that pass `menuWidth` or `tokenOverflowBehavior`, which the sheet does not render, pin `presentation="popover"`. The default change is `[breaking]` under spec:AST-017 FR1, FR3, and FR31, so it is held for a declared minor; the promotion is `[feat]`.
1 parent 7a8a648 commit 5d33dd5

20 files changed

Lines changed: 725 additions & 361 deletions

‎.changeset/powersearch-experimental-bottom-sheet.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
'@astryxdesign/core': patch
33
---
44

5-
[experimental] PowerSearch gains a touch surface behind `experimental={{presentation: 'bottom-sheet' | 'adaptive'}}`. `bottom-sheet` makes the whole field one trigger showing display-only filter tokens, and moves filter editing into a flow of tall modal sheets that stack: each step opens above the one that led to it, and dismissing a step reveals the one beneath, so no sheet has a Back action. A Filters sheet lists the active filters as rows that edit a filter, each with a trailing remove button, under a fixed header with Add filter and over a fixed footer with Clear all and Done; with no filter it shows one centered Add filter. Clear all asks for confirmation, removes the editable filters, keeps read-only ones, and leaves Filters open. An Add filter sheet lists the fields grouped (searchable from eight fields), or the content search with the field typeahead's suggestions listed inline, and leaves its search unfocused until tapped; a field whose only operator takes no value adds at once. A value step stages operator → value and confirms from its footer, the editor on the sheet's surface, or in muted sections beside the operator choice. Closed vocabularies are full-width rows, numbers stage as typed, and `string_list` / `entity_list` values edit through the Tokenizer's own sheet presentation titled with the field label. `adaptive` uses the sheet on compact coarse-pointer screens and the popover otherwise, resolved the same way Selector resolves it. The sheet flow loads on demand, so a PowerSearch that does not opt in does not carry it. New `@astryx.powersearch.sheet.*` catalog keys for the sheets' strings; no new theming target. Anything inside PowerSearch's `experimental` prop may change or be removed in a patch release; omitting it keeps the stable behavior.
5+
[experimental] PowerSearch gains a touch surface behind `experimental={{presentation: 'bottom-sheet' | 'adaptive'}}`. `bottom-sheet` makes the whole field one trigger showing display-only filter tokens, and moves filter editing into a flow of tall modal sheets that stack: each step opens above the one that led to it, and dismissing a step reveals the one beneath, so no sheet has a Back action. A Filters sheet lists the active filters as rows that edit a filter, each with a trailing remove button, under a fixed header with Add filter and over a fixed footer with Clear all and Done; with no filter it shows one centered Add filter. Clear all asks for confirmation, removes the editable filters, keeps read-only ones, and leaves Filters open. An Add filter sheet lists the fields grouped (searchable from eight fields), or the content search with the field typeahead's suggestions listed inline, and leaves its search unfocused until tapped; a field whose only operator takes no value adds at once. A value step stages operator → value and confirms from its footer, the editor on the sheet's surface, or in muted sections beside the operator choice. Closed vocabularies are full-width rows, numbers stage as typed, and `string_list` / `entity_list` values edit through the Tokenizer's own sheet presentation titled with the field label. `adaptive` uses the sheet on compact coarse-pointer screens and the popover otherwise, resolved the same way Selector resolves it. The sheet flow loads on demand, only when a field presents it. New `@astryx.powersearch.sheet.*` catalog keys for the sheets' strings; no new theming target. Anything inside PowerSearch's `experimental` prop may change or be removed in a patch release.
66

77
@imdreamrunner
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/cli': patch
3+
---
4+
5+
[feat] `astryx upgrade` gains the `promote-powersearch-presentation` codemod, which rewrites a static `experimental={{presentation: x}}` on PowerSearch to the stable `presentation={x}`. It and `promote-tokenizer-presentation` share one set of rules: each leaves a TODO, and keeps the working deprecated spelling, where it cannot prove the rewrite. That includes any call that spreads props, because a spread can carry its own `presentation`, also as `undefined`.
6+
7+
@imdreamrunner
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[feat] PowerSearch's `presentation` prop is stable, and its default is `'adaptive'`. `presentation` takes `'popover' | 'bottom-sheet' | 'adaptive'`, typed by the new exported `PowerSearchPresentation`. The API change is additive: the prop is new and optional, no existing prop, type or export is removed or narrowed, and `experimental={{presentation: x}}` keeps working as a deprecated experimental alias that `astryx upgrade` rewrites to `presentation={x}`; when both are set, `presentation` wins and the field warns once in development. The behavior changes only on compact coarse-pointer screens (phones), which is what `'adaptive'` is for: there a PowerSearch with no `presentation` becomes one trigger with display-only filter tokens that opens the stacked Filters, Add filter and value sheets, a filter reaches `onChange` when its value step confirms, and `menuWidth` and `tokenOverflowBehavior` have no surface, with a development warning that names them. With a mouse or trackpad, on a screen that is not compact, in the server render and while hydrating, nothing changes. Pass `presentation="popover"` to keep the previous behavior on every device. Shipping this default in a patch is a product decision of the engineering owner, agreed with the owner of the compatibility policy.
6+
7+
@imdreamrunner

‎apps/storybook/stories/PowerSearch.stories.tsx‎

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ export const IssueTracker: Story = {
10381038
maxSearchResults: 2,
10391039
maxOperatorMenuItems: 2,
10401040
menuWidth: 700,
1041+
presentation: 'popover',
10411042
},
10421043
parameters: {
10431044
docs: {
@@ -1816,6 +1817,7 @@ export const OverflowInline: Story = {
18161817
filters={filters}
18171818
onChange={newFilters => setFilters([...newFilters])}
18181819
tokenOverflowBehavior="unfocusedInline"
1820+
presentation="popover"
18191821
/>
18201822
<p style={{marginTop: 8}}>
18211823
This text will shift down when the search bar expands on focus.
@@ -1841,6 +1843,7 @@ export const OverflowLayer: Story = {
18411843
filters={filters}
18421844
onChange={newFilters => setFilters([...newFilters])}
18431845
tokenOverflowBehavior="unfocusedLayer"
1846+
presentation="popover"
18441847
/>
18451848
<p style={{marginTop: 8}}>
18461849
This text should not shift when the search bar expands on focus.
@@ -2058,7 +2061,7 @@ export const StatusVariantComparison: Story = {
20582061
};
20592062

20602063
// =============================================================================
2061-
// Experimental bottom-sheet presentation
2064+
// Bottom-sheet presentation
20622065
// =============================================================================
20632066

20642067
// The sheet flow is designed for a phone: view these stories at a compact
@@ -2102,14 +2105,14 @@ const sheetPresetFilters: ReadonlyArray<PowerSearchFilter> = [
21022105
];
21032106

21042107
/**
2105-
* `experimental={{presentation: 'bottom-sheet'}}`: the field is one trigger
2108+
* The bottom-sheet presentation: the field is one trigger
21062109
* with display-only tokens; a tap opens the Filters sheet, whose rows edit or
21072110
* remove a filter, Add filter opens above it with the fields, and the value
21082111
* step opens above that and stages operator → value. Dismissing a step
21092112
* reveals the one beneath. Clear all asks first. List values (Assignee, Tags)
21102113
* open the Tokenizer's own sheet above the step.
21112114
*/
2112-
export const ExperimentalBottomSheet: Story = {
2115+
export const SheetPresentation: Story = {
21132116
render: args => {
21142117
const [filters, setFilters] =
21152118
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2124,22 +2127,23 @@ export const ExperimentalBottomSheet: Story = {
21242127
// Clear all) changes it and the flow announces the change.
21252128
resultCount={Math.max(1, Math.round(240 / (filters.length + 1)))}
21262129
timezoneID="America/Los_Angeles"
2130+
/* TODO(astryx upgrade): experimental.presentation is deprecated. Pass presentation instead; this one was left unchanged because the codemod could not prove the rewrite. */
21272131
experimental={{presentation: 'bottom-sheet'}}
21282132
/>
21292133
<FilterDump filters={filters} />
21302134
</PhoneFrame>
21312135
);
21322136
},
2133-
name: 'Experimental: bottom sheet (forced)',
2137+
name: 'Bottom sheet (forced)',
21342138
parameters: {viewport: {defaultViewport: 'mobile2'}},
21352139
};
21362140

21372141
/**
2138-
* `experimental={{presentation: 'adaptive'}}`: the sheet flow on a compact
2142+
* The `adaptive` presentation, the default: the sheet flow on a compact
21392143
* coarse-pointer screen, the tokenizer field and editor popover otherwise.
21402144
* Resize the viewport or switch the pointer emulation to see it switch.
21412145
*/
2142-
export const ExperimentalAdaptive: Story = {
2146+
export const AdaptivePresentation: Story = {
21432147
render: args => {
21442148
const [filters, setFilters] =
21452149
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2151,21 +2155,22 @@ export const ExperimentalAdaptive: Story = {
21512155
filters={filters}
21522156
onChange={next => setFilters(next)}
21532157
timezoneID="America/Los_Angeles"
2158+
/* TODO(astryx upgrade): experimental.presentation is deprecated. Pass presentation instead; this one was left unchanged because the codemod could not prove the rewrite. */
21542159
experimental={{presentation: 'adaptive'}}
21552160
/>
21562161
<FilterDump filters={filters} />
21572162
</PhoneFrame>
21582163
);
21592164
},
2160-
name: 'Experimental: adaptive',
2165+
name: 'Adaptive (default)',
21612166
};
21622167

21632168
/**
21642169
* With `contentSearchFieldKey`, Add filter carries the content search: the
21652170
* field typeahead's suggestions list inline under the search box, and a value
21662171
* suggestion commits a filter straight away.
21672172
*/
2168-
export const ExperimentalBottomSheetContentSearch: Story = {
2173+
export const SheetPresentationContentSearch: Story = {
21692174
render: args => {
21702175
const [filters, setFilters] = useState<ReadonlyArray<PowerSearchFilter>>(
21712176
[],
@@ -2178,13 +2183,14 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21782183
filters={filters}
21792184
onChange={next => setFilters(next)}
21802185
placeholder="Search issues…"
2186+
/* TODO(astryx upgrade): experimental.presentation is deprecated. Pass presentation instead; this one was left unchanged because the codemod could not prove the rewrite. */
21812187
experimental={{presentation: 'bottom-sheet'}}
21822188
/>
21832189
<FilterDump filters={filters} />
21842190
</PhoneFrame>
21852191
);
21862192
},
2187-
name: 'Experimental: bottom sheet with content search',
2193+
name: 'Bottom sheet with content search',
21882194
parameters: {viewport: {defaultViewport: 'mobile2'}},
21892195
};
21902196

@@ -2193,7 +2199,7 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21932199
* keeps the trigger focusable (aria-disabled) and shows its reason; the result
21942200
* count renders at the end of the field in both presentations.
21952201
*/
2196-
export const ExperimentalBottomSheetStates: Story = {
2202+
export const SheetPresentationStates: Story = {
21972203
render: () => {
21982204
const [filters, setFilters] =
21992205
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2208,7 +2214,7 @@ export const ExperimentalBottomSheetStates: Story = {
22082214
isLabelHidden={false}
22092215
isReadOnly
22102216
resultCount={42}
2211-
experimental={{presentation: 'bottom-sheet'}}
2217+
presentation="bottom-sheet"
22122218
/>
22132219
<PowerSearch
22142220
config={fullConfig}
@@ -2218,7 +2224,7 @@ export const ExperimentalBottomSheetStates: Story = {
22182224
isLabelHidden={false}
22192225
isDisabled
22202226
disabledMessage="Pick a project first"
2221-
experimental={{presentation: 'bottom-sheet'}}
2227+
presentation="bottom-sheet"
22222228
/>
22232229
<PowerSearch
22242230
config={fullConfig}
@@ -2228,12 +2234,12 @@ export const ExperimentalBottomSheetStates: Story = {
22282234
isLabelHidden={false}
22292235
status={{type: 'error', message: 'Add at least one filter'}}
22302236
startIcon={MagnifyingGlassIcon}
2231-
experimental={{presentation: 'bottom-sheet'}}
2237+
presentation="bottom-sheet"
22322238
/>
22332239
</div>
22342240
</PhoneFrame>
22352241
);
22362242
},
2237-
name: 'Experimental: bottom sheet states',
2243+
name: 'Bottom sheet states',
22382244
parameters: {viewport: {defaultViewport: 'mobile2'}},
22392245
};

0 commit comments

Comments
 (0)