PR: #732: feat(add-matter): grouped Who-we-represent search-select [Story-2917] by @ayush-pramaan
View PR →

Files changed

18 file(s), +1844 / -326 lines

Path Role + -
messages/en.jsonConfig+14-6
messages/hi.jsonConfig+14-6
src/components/add-matter/add-matter-drawer-types.tsComponent+10-3
src/components/add-matter/add-matter-drawer.stories.tsxComponent+9-1
src/components/add-matter/add-matter-drawer.tsxComponent+1-3
src/components/add-matter/drawer-client-field.stories.tsxComponent+86-0
src/components/add-matter/drawer-client-field.tsxComponent+31-91
src/components/add-matter/drawer-client-popover.stories.tsxComponent+80-0
src/components/add-matter/drawer-client-popover.tsxComponent+64-34
src/components/add-matter/drawer-combobox.stories.tsxComponent+91-0
src/components/add-matter/drawer-combobox.tsxComponent+192-0
src/components/add-matter/participant-label-picker.stories.tsxComponent+176-0
src/components/add-matter/participant-label-picker.tsxComponent+423-0
src/components/add-matter/representing-side-field.stories.tsxComponent+135-19
src/components/add-matter/representing-side-field.tsxComponent+122-121
src/components/add-matter/use-participant-label-picker-data.tsComponent+113-0
tests/unit/representing-side-field.test.tsxTest+283-41
tests/unit/use-add-matter-drawer-form.test.tsxTest+0-1

Story-2917: Grouped search-select as permanent Q2

The Add Matter drawer's second “Who we represent” question is now a permanent search-select. It uses the same trigger, search field, popover, loading rows, and dismissal behavior as the Client field, while retaining participant-label-specific grouping, selection, and inline creation.

This story reads the existing label catalogue and matter-type attachment set. It does not write a new matter-type-to-label attachment; that mapping write remains the scope of pramaan-spec Story-2919.

Behavior walkthrough

State What the user sees
Curated matter type Attached labels appear first under Offered for <matter type> in configured order. The rest of the live firm catalogue follows under Other participant labels, with attached labels removed from that group.
Uncurated matter type When the attachment set is empty, the firm catalogue appears as one flat list without group headings.
Staged matter type A matter type created inline during this drawer session immediately gets the flat catalogue picker. It no longer falls back to “choose a matter type first”.
Picked The chosen label replaces the trigger placeholder. Clicking the trigger reopens search, preserves the choice, and marks it with a check.
Empty / loading / error Each data state is explicit: loading skeletons, empty-firm guidance with the add row, or a load error with Retry. A required-field message is still shown when Create is blocked, including when there are no available options.
Inline mint + Add participant label opens the mint-colored inline form at the foot of the picker. A newly created label is selected through the existing party path.

Implementation seams

Component-driven coverage

Storybook includes the shared combobox, the refactored Client field and popover, and participant-label picker stories for curated, uncurated, empty-firm, loading, error, picked, and inline-mint states. The complete “Who we represent” field also covers a staged matter type and the blocked-Create validation state.

Verification