Skip to content

Commit f50bc74

Browse files
feat(PowerSearch): presentation is a stable prop, and adaptive is its default (#9797)
PowerSearch's touch sheet flow ships behind 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. The unreleased `experimental.presentation` option is removed, so `presentation` is the only spelling. `presentation="popover"` keeps the inline field everywhere; stories that pass `menuWidth` or `tokenOverflowBehavior`, which the sheet does not render, pin it. The engineering owner ships the `adaptive` default as a `[feat]` patch: the API change is additive, the behavior change is limited to compact touch screens, and desktop and server output are unchanged.
1 parent 3372c22 commit f50bc74

13 files changed

Lines changed: 251 additions & 226 deletions

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

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'@astryxdesign/core': patch
3+
---
4+
5+
[feat] PowerSearch gains a touch surface through a new `presentation` prop, `'popover' | 'bottom-sheet' | 'adaptive'`, typed by the new exported `PowerSearchPresentation`, with `'adaptive'` the default. `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.
6+
7+
The API change is additive: the prop is new and optional, and no existing prop, type or export is removed or narrowed. The behavior changes only on compact coarse-pointer screens (phones), which is what `'adaptive'` is for: there a PowerSearch with no `presentation` shows the trigger and the sheet flow, 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.
8+
9+
@imdreamrunner

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

Lines changed: 19 additions & 17 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+
* `presentation="bottom-sheet"`: 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,22 @@ 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"
2127-
experimental={{presentation: 'bottom-sheet'}}
2130+
presentation="bottom-sheet"
21282131
/>
21292132
<FilterDump filters={filters} />
21302133
</PhoneFrame>
21312134
);
21322135
},
2133-
name: 'Experimental: bottom sheet (forced)',
2136+
name: 'Bottom sheet (forced)',
21342137
parameters: {viewport: {defaultViewport: 'mobile2'}},
21352138
};
21362139

21372140
/**
2138-
* `experimental={{presentation: 'adaptive'}}`: the sheet flow on a compact
2141+
* The default presentation, `adaptive`: the sheet flow on a compact
21392142
* coarse-pointer screen, the tokenizer field and editor popover otherwise.
21402143
* Resize the viewport or switch the pointer emulation to see it switch.
21412144
*/
2142-
export const ExperimentalAdaptive: Story = {
2145+
export const AdaptivePresentation: Story = {
21432146
render: args => {
21442147
const [filters, setFilters] =
21452148
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2151,21 +2154,20 @@ export const ExperimentalAdaptive: Story = {
21512154
filters={filters}
21522155
onChange={next => setFilters(next)}
21532156
timezoneID="America/Los_Angeles"
2154-
experimental={{presentation: 'adaptive'}}
21552157
/>
21562158
<FilterDump filters={filters} />
21572159
</PhoneFrame>
21582160
);
21592161
},
2160-
name: 'Experimental: adaptive',
2162+
name: 'Adaptive (default)',
21612163
};
21622164

21632165
/**
21642166
* With `contentSearchFieldKey`, Add filter carries the content search: the
21652167
* field typeahead's suggestions list inline under the search box, and a value
21662168
* suggestion commits a filter straight away.
21672169
*/
2168-
export const ExperimentalBottomSheetContentSearch: Story = {
2170+
export const SheetPresentationContentSearch: Story = {
21692171
render: args => {
21702172
const [filters, setFilters] = useState<ReadonlyArray<PowerSearchFilter>>(
21712173
[],
@@ -2178,13 +2180,13 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21782180
filters={filters}
21792181
onChange={next => setFilters(next)}
21802182
placeholder="Search issues…"
2181-
experimental={{presentation: 'bottom-sheet'}}
2183+
presentation="bottom-sheet"
21822184
/>
21832185
<FilterDump filters={filters} />
21842186
</PhoneFrame>
21852187
);
21862188
},
2187-
name: 'Experimental: bottom sheet with content search',
2189+
name: 'Bottom sheet with content search',
21882190
parameters: {viewport: {defaultViewport: 'mobile2'}},
21892191
};
21902192

@@ -2193,7 +2195,7 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21932195
* keeps the trigger focusable (aria-disabled) and shows its reason; the result
21942196
* count renders at the end of the field in both presentations.
21952197
*/
2196-
export const ExperimentalBottomSheetStates: Story = {
2198+
export const SheetPresentationStates: Story = {
21972199
render: () => {
21982200
const [filters, setFilters] =
21992201
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2208,7 +2210,7 @@ export const ExperimentalBottomSheetStates: Story = {
22082210
isLabelHidden={false}
22092211
isReadOnly
22102212
resultCount={42}
2211-
experimental={{presentation: 'bottom-sheet'}}
2213+
presentation="bottom-sheet"
22122214
/>
22132215
<PowerSearch
22142216
config={fullConfig}
@@ -2218,7 +2220,7 @@ export const ExperimentalBottomSheetStates: Story = {
22182220
isLabelHidden={false}
22192221
isDisabled
22202222
disabledMessage="Pick a project first"
2221-
experimental={{presentation: 'bottom-sheet'}}
2223+
presentation="bottom-sheet"
22222224
/>
22232225
<PowerSearch
22242226
config={fullConfig}
@@ -2228,12 +2230,12 @@ export const ExperimentalBottomSheetStates: Story = {
22282230
isLabelHidden={false}
22292231
status={{type: 'error', message: 'Add at least one filter'}}
22302232
startIcon={MagnifyingGlassIcon}
2231-
experimental={{presentation: 'bottom-sheet'}}
2233+
presentation="bottom-sheet"
22322234
/>
22332235
</div>
22342236
</PhoneFrame>
22352237
);
22362238
},
2237-
name: 'Experimental: bottom sheet states',
2239+
name: 'Bottom sheet states',
22382240
parameters: {viewport: {defaultViewport: 'mobile2'}},
22392241
};

0 commit comments

Comments
 (0)