Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .changeset/powersearch-experimental-bottom-sheet.md

This file was deleted.

9 changes: 9 additions & 0 deletions .changeset/powersearch-presentation-stable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@astryxdesign/core': patch
---

[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.

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.

Blocking: on a phone this default turns the combobox into a dialog trigger, and menuWidth, tokenOverflowBehavior and focusTypeahead()'s input focus stop working unless the caller adds presentation="popover". spec:AST-017 FR3 judges such a default under FR1, FR6 says engineering approval does not make it nonbreaking, and FR25/FR31 keep a breaking change out of a patch while main declares 0.7.8. Suggest graduating presentation with the popover default here and moving the adaptive default to its own [breaking] Changeset for the next declared minor (as Selector's DEP-0011/CLN-0020 do), unless an owner-approved change to spec:AST-017 and INV3 lands first.


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.

@imdreamrunner
36 changes: 19 additions & 17 deletions apps/storybook/stories/PowerSearch.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,7 @@ export const IssueTracker: Story = {
maxSearchResults: 2,
maxOperatorMenuItems: 2,
menuWidth: 700,
presentation: 'popover',
},
parameters: {
docs: {
Expand Down Expand Up @@ -1816,6 +1817,7 @@ export const OverflowInline: Story = {
filters={filters}
onChange={newFilters => setFilters([...newFilters])}
tokenOverflowBehavior="unfocusedInline"
presentation="popover"
/>
<p style={{marginTop: 8}}>
This text will shift down when the search bar expands on focus.
Expand All @@ -1841,6 +1843,7 @@ export const OverflowLayer: Story = {
filters={filters}
onChange={newFilters => setFilters([...newFilters])}
tokenOverflowBehavior="unfocusedLayer"
presentation="popover"
/>
<p style={{marginTop: 8}}>
This text should not shift when the search bar expands on focus.
Expand Down Expand Up @@ -2058,7 +2061,7 @@ export const StatusVariantComparison: Story = {
};

// =============================================================================
// Experimental bottom-sheet presentation
// Bottom-sheet presentation
// =============================================================================

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

/**
* `experimental={{presentation: 'bottom-sheet'}}`: the field is one trigger
* `presentation="bottom-sheet"`: the field is one trigger
* with display-only tokens; a tap opens the Filters sheet, whose rows edit or
* remove a filter, Add filter opens above it with the fields, and the value
* step opens above that and stages operator → value. Dismissing a step
* reveals the one beneath. Clear all asks first. List values (Assignee, Tags)
* open the Tokenizer's own sheet above the step.
*/
export const ExperimentalBottomSheet: Story = {
export const SheetPresentation: Story = {
render: args => {
const [filters, setFilters] =
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
Expand All @@ -2124,22 +2127,22 @@ export const ExperimentalBottomSheet: Story = {
// Clear all) changes it and the flow announces the change.
resultCount={Math.max(1, Math.round(240 / (filters.length + 1)))}
timezoneID="America/Los_Angeles"
experimental={{presentation: 'bottom-sheet'}}
presentation="bottom-sheet"
/>
<FilterDump filters={filters} />
</PhoneFrame>
);
},
name: 'Experimental: bottom sheet (forced)',
name: 'Bottom sheet (forced)',
parameters: {viewport: {defaultViewport: 'mobile2'}},
};

/**
* `experimental={{presentation: 'adaptive'}}`: the sheet flow on a compact
* The default presentation, `adaptive`: the sheet flow on a compact
* coarse-pointer screen, the tokenizer field and editor popover otherwise.
* Resize the viewport or switch the pointer emulation to see it switch.
*/
export const ExperimentalAdaptive: Story = {
export const AdaptivePresentation: Story = {
render: args => {
const [filters, setFilters] =
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
Expand All @@ -2151,21 +2154,20 @@ export const ExperimentalAdaptive: Story = {
filters={filters}
onChange={next => setFilters(next)}
timezoneID="America/Los_Angeles"
experimental={{presentation: 'adaptive'}}
/>
<FilterDump filters={filters} />
</PhoneFrame>
);
},
name: 'Experimental: adaptive',
name: 'Adaptive (default)',
};

/**
* With `contentSearchFieldKey`, Add filter carries the content search: the
* field typeahead's suggestions list inline under the search box, and a value
* suggestion commits a filter straight away.
*/
export const ExperimentalBottomSheetContentSearch: Story = {
export const SheetPresentationContentSearch: Story = {
render: args => {
const [filters, setFilters] = useState<ReadonlyArray<PowerSearchFilter>>(
[],
Expand All @@ -2178,13 +2180,13 @@ export const ExperimentalBottomSheetContentSearch: Story = {
filters={filters}
onChange={next => setFilters(next)}
placeholder="Search issues…"
experimental={{presentation: 'bottom-sheet'}}
presentation="bottom-sheet"
/>
<FilterDump filters={filters} />
</PhoneFrame>
);
},
name: 'Experimental: bottom sheet with content search',
name: 'Bottom sheet with content search',
parameters: {viewport: {defaultViewport: 'mobile2'}},
};

Expand All @@ -2193,7 +2195,7 @@ export const ExperimentalBottomSheetContentSearch: Story = {
* keeps the trigger focusable (aria-disabled) and shows its reason; the result
* count renders at the end of the field in both presentations.
*/
export const ExperimentalBottomSheetStates: Story = {
export const SheetPresentationStates: Story = {
render: () => {
const [filters, setFilters] =
useState<ReadonlyArray<PowerSearchFilter>>(sheetPresetFilters);
Expand All @@ -2208,7 +2210,7 @@ export const ExperimentalBottomSheetStates: Story = {
isLabelHidden={false}
isReadOnly
resultCount={42}
experimental={{presentation: 'bottom-sheet'}}
presentation="bottom-sheet"
/>
<PowerSearch
config={fullConfig}
Expand All @@ -2218,7 +2220,7 @@ export const ExperimentalBottomSheetStates: Story = {
isLabelHidden={false}
isDisabled
disabledMessage="Pick a project first"
experimental={{presentation: 'bottom-sheet'}}
presentation="bottom-sheet"
/>
<PowerSearch
config={fullConfig}
Expand All @@ -2228,12 +2230,12 @@ export const ExperimentalBottomSheetStates: Story = {
isLabelHidden={false}
status={{type: 'error', message: 'Add at least one filter'}}
startIcon={MagnifyingGlassIcon}
experimental={{presentation: 'bottom-sheet'}}
presentation="bottom-sheet"
/>
</div>
</PhoneFrame>
);
},
name: 'Experimental: bottom sheet states',
name: 'Bottom sheet states',
parameters: {viewport: {defaultViewport: 'mobile2'}},
};
Loading
Loading