Scripture text picker prototype + LanguageMultipicker (design exploration)#2282
Draft
merchako wants to merge 3 commits into
Draft
Scripture text picker prototype + LanguageMultipicker (design exploration)#2282merchako wants to merge 3 commits into
merchako wants to merge 3 commits into
Conversation
Design-exploration prototype for replacing the current ResourcePickerDialog with a Scripture-text-focused picker. Pulls the language multi-select filter out as its own component (LanguageMultipicker) so it can later evolve into a system- wide content-language picker. Picker behavior: progressive disclosure with a footer toggle between "Included only" and "Browse all". Single- and multi-select via host-owned displayedIds. Listbox keyboard navigation (Arrow/Home/End/Enter/Space/Delete) with focus restoration after action-driven re-renders. Container-query responsive collapse for name and language. Click a language chip to filter by it. "Maybe you meant…" out-of-filter results when in-filter is sparse. Lock icon (with tooltip) for non-removable items. Leaving dist/ and package-lock.json out of this commit — they were touched by the local build workaround for the stale-dist issue that origin already fixed.
Wraps the prototype with documentation and authoring affordances meant to preserve the reasoning behind design choices once this thread ends. Component docs - Rich TSDoc on ScriptureTextPickerProgressive covering: what it does, the two-job (membership vs display) framing, why it's presentational, the keyboard model, sizing/responsive behavior, variants, examples. - LanguageMultipicker TSDoc rewritten for newcomers: explains "Preferred" preset, references BCP-47, calls out gaps before promotion to system-wide. Localization - New *.strings.ts modules colocated with each component. Each string key has a `// meaning:` comment describing intent and constraints. English defaults serve as the reference implementation; components accept an optional `localizedStrings` prop that falls back to defaults. Mirrors the existing ResourcePickerDialog pattern. Storybook - ScriptureTextPicker gets a `Playground` story with full controls (dataset, mode, autoDisplayOnInclude, shell size). - Every story has a `parameters.docs.description.story` explaining why that variant exists. - LanguageMultipicker stories use `autodocs` and describe each label degradation state. - Removed the "Drag the bottom-right corner ↘ to resize" hint bar from the resizable shell. Replaced with a small `↘` glyph over the native CSS resize grip plus a `title="Drag ↘ to resize"` tooltip on the container. Sizing - Picker shrinks to fit its content (no `flex-1` to fill the host). List area capped at `max-h-[24rem]`. When the user is actively typing in the search, the list area takes `min-h-[14rem]` to prevent jitter as results narrow. Design patterns - New DESIGN.md co-located with the scripture text picker, capturing 17 patterns we landed on along the way — each as pattern/chosen/rejected. Includes a "Where this doc should live" section suggesting alternative locations (`lib/platform-bible-react/decisions/`, `docs/design-system/`, ADRs, external wiki). - Doc lives next to the component because `lib/platform-bible-react/docs/` is gitignored (typedoc target). BCP-47 alignment - Mock language data changed from 3-letter ISO 639-3 codes (`eng`, `spa`) to BCP-47 conventional forms (`en`, `es`, `de`, etc; `grc` retained for Koine Greek which has no 639-1). Aligns with the rest of platform-bible. Screenshots regenerated to reflect new shrink-to-fit behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Design-exploration prototype on top of pt-3976-shared-resource-picker-ui. Sketches a redesigned scripture-text picker and extracts the language multi-select filter as its own component.
Not for merge as-is. Draft so reviewers can poke at the Storybook variants and feed back. The eventual outcome may be folding the best ideas into the existing
ResourcePickerDialograther than landing this folder verbatim.Screenshots
In context — single-select, populated project (display-switcher mode)
Default view = Included only. Footer toggles to "Browse all texts (4)". Currently-displayed item gets a Check; locked item gets a Lock icon.
In context — single-select, sparse project (add-mode)
Same component, but the initial state has only one included text, so the picker opens in "Browse all" view. Footer reads "← Show only included". Status icons distinguish Lock / HardDrive / Cloud.
Bare component — single populated
The picker without the surrounding mock viewer.
Container-query responsive collapse — narrow (340 px)
Full names collapse to abbreviations (NIV, RVR60, ESV), language chips collapse to ISO codes. Tooltips carry the full info on hover.
LanguageMultipicker popover
Standalone component, popover open. Each row shows English/ISO name + autonym (Español, Français, Deutsch, Português, עברית, Ἑλληνικά) + 3-letter code.
What's in here
New:
LanguageMultipicker(lib/platform-bible-react/src/components/advanced/language-multipicker/)Tertiary, compact multi-select language filter. Designed to sit next to a search input and stay visually quiet until interacted with.
Any→Preferred→ single ISO code → space-separated codes →N langs.value / options / preferred / onChangeAPI.LanguageInfoshape matchesui-language-selector.component.tsx(autonym,otherNames).Known gaps for promotion to a system-wide content-language picker: should accept
LanguageInfo[](or an async loader) instead of just names; needs virtualization + in-popover search to handle thousands of languages; needs RTL autonym handling. Called out in the component's TSDoc.New:
ScriptureTextPicker(lib/platform-bible-react/src/components/advanced/scripture-text-picker/)Single-component scripture-text picker exploring:
displayedIds: string[]; same picker serves single-select (host keeps ≤ 1 id) and multi-select (host toggles in a set).toggleDisplay; click Installed/Available →include. Available items get a download spinner. Locked-included items show a Lock icon with explanatory tooltip and cannot be removed.pendingFocusIdRef+useLayoutEffect, so activating an Installed row doesn't drop focus when the row remounts into the Included group.bg-accent), focused (inset ring, no background change), hovered (bg-muted). Selected + focused at the same time stays distinguishable.Storybook
Advanced/ScriptureTextPicker— pure-component stories (Single/Multi × sparse/populated, narrow-width, short-height) all rendered in a resizable shell (drag the bottom-right corner). Three trigger stories show the picker in a popover from a mocked scripture viewer.Advanced/LanguageMultipicker— minimal coverage of trigger-label states.Background
Iterated on three variants (unified scroll, tabs, progressive disclosure) and converged on progressive disclosure with a footer view toggle. The collapsing inline expander was dropped in favor of the toggle because it was visually confusing when expanded.
The existing
ResourcePickerDialogon the parent branch is untouched.Test plan
npm run storybook:platform-bible-react) and visit the newAdvanced/ScriptureTextPickerstories.Follow-ups (not in this PR)
ResourcePickerDialograther than land a parallel component.LanguageMultipickertoward a system-wide content-language picker (large-list handling, async metadata, RTL).language-info.tsto a real source (IETF/ISO + autonym dataset).includeauto-display behavior — the host stories auto-display when nothing is displayed; that's host policy not picker policy.This change is