Skip to content

Commit 6c6779f

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 2c925f7 commit 6c6779f

15 files changed

Lines changed: 586 additions & 202 deletions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@astryxdesign/core': minor
3+
---
4+
5+
[breaking] PowerSearch's `presentation` defaults to `'adaptive'` instead of `'popover'`. A PowerSearch that passes no `presentation` keeps the tokenizer field and editor popover with a mouse or trackpad, on a screen that is not compact, in the server render, and while it hydrates; on a compact coarse-pointer screen (a phone) the whole field becomes one trigger with display-only filter tokens that opens the stacked filter sheets. There, filters are added and edited in the Filters, Add filter and value sheets instead of the typeahead and editor popover, a filter reaches `onChange` when its value step confirms, and `menuWidth` and `tokenOverflowBehavior` have no surface, with a development warning that names them. Migration: pass `presentation="popover"` to keep the tokenizer field and editor popover on every device. No codemod adds it, because adding it to every PowerSearch would opt every caller out of the new default; add it where your product needs the popover on phones.
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: `'popover' | 'bottom-sheet' | 'adaptive'`, typed by the new exported `PowerSearchPresentation`. It promotes the touch sheet flow that `experimental.presentation` selected, with the same values and behavior. `experimental={{presentation: 'adaptive'}}` becomes `presentation="adaptive"`, and `astryx upgrade` rewrites it. The earlier spelling keeps working as a deprecated experimental alias; when both are set, `presentation` wins and the field warns once in development.
6+
7+
@imdreamrunner

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,6 +1816,7 @@ export const OverflowInline: Story = {
18161816
filters={filters}
18171817
onChange={newFilters => setFilters([...newFilters])}
18181818
tokenOverflowBehavior="unfocusedInline"
1819+
presentation="popover"
18191820
/>
18201821
<p style={{marginTop: 8}}>
18211822
This text will shift down when the search bar expands on focus.
@@ -1841,6 +1842,7 @@ export const OverflowLayer: Story = {
18411842
filters={filters}
18421843
onChange={newFilters => setFilters([...newFilters])}
18431844
tokenOverflowBehavior="unfocusedLayer"
1845+
presentation="popover"
18441846
/>
18451847
<p style={{marginTop: 8}}>
18461848
This text should not shift when the search bar expands on focus.
@@ -2058,7 +2060,7 @@ export const StatusVariantComparison: Story = {
20582060
};
20592061

20602062
// =============================================================================
2061-
// Experimental bottom-sheet presentation
2063+
// Bottom-sheet presentation
20622064
// =============================================================================
20632065

20642066
// The sheet flow is designed for a phone: view these stories at a compact
@@ -2102,14 +2104,14 @@ const sheetPresetFilters: ReadonlyArray<PowerSearchFilter> = [
21022104
];
21032105

21042106
/**
2105-
* `experimental={{presentation: 'bottom-sheet'}}`: the field is one trigger
2107+
* `presentation="bottom-sheet"`: the field is one trigger
21062108
* with display-only tokens; a tap opens the Filters sheet, whose rows edit or
21072109
* remove a filter, Add filter opens above it with the fields, and the value
21082110
* step opens above that and stages operator → value. Dismissing a step
21092111
* reveals the one beneath. Clear all asks first. List values (Assignee, Tags)
21102112
* open the Tokenizer's own sheet above the step.
21112113
*/
2112-
export const ExperimentalBottomSheet: Story = {
2114+
export const SheetPresentation: Story = {
21132115
render: args => {
21142116
const [filters, setFilters] =
21152117
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2124,22 +2126,22 @@ export const ExperimentalBottomSheet: Story = {
21242126
// Clear all) changes it and the flow announces the change.
21252127
resultCount={Math.max(1, Math.round(240 / (filters.length + 1)))}
21262128
timezoneID="America/Los_Angeles"
2127-
experimental={{presentation: 'bottom-sheet'}}
2129+
presentation="bottom-sheet"
21282130
/>
21292131
<FilterDump filters={filters} />
21302132
</PhoneFrame>
21312133
);
21322134
},
2133-
name: 'Experimental: bottom sheet (forced)',
2135+
name: 'Bottom sheet (forced)',
21342136
parameters: {viewport: {defaultViewport: 'mobile2'}},
21352137
};
21362138

21372139
/**
2138-
* `experimental={{presentation: 'adaptive'}}`: the sheet flow on a compact
2140+
* The default presentation, `adaptive`: the sheet flow on a compact
21392141
* coarse-pointer screen, the tokenizer field and editor popover otherwise.
21402142
* Resize the viewport or switch the pointer emulation to see it switch.
21412143
*/
2142-
export const ExperimentalAdaptive: Story = {
2144+
export const AdaptivePresentation: Story = {
21432145
render: args => {
21442146
const [filters, setFilters] =
21452147
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2151,21 +2153,20 @@ export const ExperimentalAdaptive: Story = {
21512153
filters={filters}
21522154
onChange={next => setFilters(next)}
21532155
timezoneID="America/Los_Angeles"
2154-
experimental={{presentation: 'adaptive'}}
21552156
/>
21562157
<FilterDump filters={filters} />
21572158
</PhoneFrame>
21582159
);
21592160
},
2160-
name: 'Experimental: adaptive',
2161+
name: 'Adaptive (default)',
21612162
};
21622163

21632164
/**
21642165
* With `contentSearchFieldKey`, Add filter carries the content search: the
21652166
* field typeahead's suggestions list inline under the search box, and a value
21662167
* suggestion commits a filter straight away.
21672168
*/
2168-
export const ExperimentalBottomSheetContentSearch: Story = {
2169+
export const SheetPresentationContentSearch: Story = {
21692170
render: args => {
21702171
const [filters, setFilters] = useState<ReadonlyArray<PowerSearchFilter>>(
21712172
[],
@@ -2178,13 +2179,13 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21782179
filters={filters}
21792180
onChange={next => setFilters(next)}
21802181
placeholder="Search issues…"
2181-
experimental={{presentation: 'bottom-sheet'}}
2182+
presentation="bottom-sheet"
21822183
/>
21832184
<FilterDump filters={filters} />
21842185
</PhoneFrame>
21852186
);
21862187
},
2187-
name: 'Experimental: bottom sheet with content search',
2188+
name: 'Bottom sheet with content search',
21882189
parameters: {viewport: {defaultViewport: 'mobile2'}},
21892190
};
21902191

@@ -2193,7 +2194,7 @@ export const ExperimentalBottomSheetContentSearch: Story = {
21932194
* keeps the trigger focusable (aria-disabled) and shows its reason; the result
21942195
* count renders at the end of the field in both presentations.
21952196
*/
2196-
export const ExperimentalBottomSheetStates: Story = {
2197+
export const SheetPresentationStates: Story = {
21972198
render: () => {
21982199
const [filters, setFilters] =
21992200
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
@@ -2208,7 +2209,7 @@ export const ExperimentalBottomSheetStates: Story = {
22082209
isLabelHidden={false}
22092210
isReadOnly
22102211
resultCount={42}
2211-
experimental={{presentation: 'bottom-sheet'}}
2212+
presentation="bottom-sheet"
22122213
/>
22132214
<PowerSearch
22142215
config={fullConfig}
@@ -2218,7 +2219,7 @@ export const ExperimentalBottomSheetStates: Story = {
22182219
isLabelHidden={false}
22192220
isDisabled
22202221
disabledMessage="Pick a project first"
2221-
experimental={{presentation: 'bottom-sheet'}}
2222+
presentation="bottom-sheet"
22222223
/>
22232224
<PowerSearch
22242225
config={fullConfig}
@@ -2228,12 +2229,12 @@ export const ExperimentalBottomSheetStates: Story = {
22282229
isLabelHidden={false}
22292230
status={{type: 'error', message: 'Add at least one filter'}}
22302231
startIcon={MagnifyingGlassIcon}
2231-
experimental={{presentation: 'bottom-sheet'}}
2232+
presentation="bottom-sheet"
22322233
/>
22332234
</div>
22342235
</PhoneFrame>
22352236
);
22362237
},
2237-
name: 'Experimental: bottom sheet states',
2238+
name: 'Bottom sheet states',
22382239
parameters: {viewport: {defaultViewport: 'mobile2'}},
22392240
};

0 commit comments

Comments
 (0)