Skip to content

feat(ai): add welcomeScreenCards to F0AiChat#4550

Merged
warcos-fact merged 9 commits into
mainfrom
chop/ai-welcome-screen-cards
Jun 30, 2026
Merged

feat(ai): add welcomeScreenCards to F0AiChat#4550
warcos-fact merged 9 commits into
mainfrom
chop/ai-welcome-screen-cards

Conversation

@warcos-fact

Copy link
Copy Markdown
Contributor

Description

Bakes the welcome-cards capability into F0AiChat as a data-driven welcomeScreenCards prop (symmetric with welcomeScreenSuggestions), rendered by an internal WelcomeScreenCardsRow. Prompt cards (with a message) call onCardSelect; action cards (with an onClick) run their own handler. The row is a 2×2 grid capped at 4 cards. Also always renders the welcome suggestions row above the composer so its popover opens upward instead of covering the input.

This replaces the standalone F0AiChatWelcomeCards component (which the consumer had to hand-wire through the footer slot) and supersedes the now-closed #4534 and #4537.

Stacked on #4535 (chop/f0form-no-padding); review that first.

Implementation details

  • feat: add welcomeScreenCards + onCardSelect to F0AiChat/F0AiChatTextArea, rendered by a new internal WelcomeScreenCardsRow (capped at 4, 2×2 grid)
  • refactor: always render the welcome suggestions row above the composer; popover opens upward
  • test: unit tests for WelcomeScreenCardsRow (incl. the 4-card cap) and the welcome-layout placement

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📦 Alpha Package Version Published

Use pnpm i github:factorialco/f0#npm/alpha-pr-4550 to install the package

Use pnpm i github:factorialco/f0#89c94bd0d692fd3ab6d6788e344cf17c05f944dd to install this specific commit

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🔍 Visual review for your branch is published 🔍

Here are the links to:

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for packages/react

Status Category Percentage Covered / Total
🔵 Lines 57.91% 19141 / 33050
🔵 Statements 56.98% 19989 / 35076
🔵 Functions 50.16% 4420 / 8811
🔵 Branches 50.62% 13678 / 27016
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/react/src/sds/ai/F0AiChat/F0AiChat.tsx 73.07% 53.84% 25% 73.07% 67-98, 129, 141, 155-166
packages/react/src/sds/ai/F0AiChat/index.ts 100% 100% 100% 100%
packages/react/src/sds/ai/F0AiChat/internal-types.ts 100% 100% 100% 100%
packages/react/src/sds/ai/F0AiChat/types.ts 100% 100% 100% 100%
packages/react/src/sds/ai/F0AiChat/providers/AiChatStateProvider.tsx 86.48% 77.19% 75% 89.21% 147, 204, 224-230, 237-239, 244, 245, 406, 408
packages/react/src/sds/ai/F0AiChatTextArea/F0AiChatTextArea.tsx 86.66% 61.19% 80.76% 89.51% 46, 112-117, 235, 239, 270, 288-294, 300, 304-305, 478
packages/react/src/sds/ai/F0AiChatTextArea/types.ts 100% 100% 100% 100%
packages/react/src/sds/ai/F0AiChatTextArea/components/WelcomeScreenCardsRow.tsx 100% 100% 100% 100%
packages/react/src/sds/ai/F0AiChatTextArea/components/WelcomeScreenSuggestionsRow.tsx 85.18% 78.57% 85.71% 91.3% 27, 70, 128
Generated in workflow #15229 for commit e8d58d3 by the Vitest Coverage Report Action

warcos-fact and others added 3 commits June 23, 2026 17:09
Opt-out of the default p-4 padding around form content, for embedding a
form flush inside a host surface (e.g. an AI canvas panel).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- test: assert the content wrapper keeps p-4 by default and drops it when
  styling.noPadding is true, for both single-schema and per-section layouts
- docs: add a Styling section to F0Form.mdx documenting showSectionsSidepanel
  and noPadding (nested in F0FormStylingConfig, not surfaced by argTypes)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ting classes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@warcos-fact warcos-fact force-pushed the chop/f0form-no-padding branch from 8adc9b0 to d872f96 Compare June 23, 2026 15:10
@warcos-fact warcos-fact requested a review from a team as a code owner June 23, 2026 15:10
…mposer

Bake the welcome-cards capability into F0AiChat as a data-driven
welcomeScreenCards prop (symmetric with welcomeScreenSuggestions), rendered by
an internal WelcomeScreenCardsRow — capped at 4 (2x2 grid). Replaces the
standalone F0AiChatWelcomeCards component the consumer had to hand-wire through
the footer slot. Also always render the welcome suggestions row above the
composer so its popover opens upward instead of covering the input.

Supersedes #4534 and #4537.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@warcos-fact warcos-fact force-pushed the chop/ai-welcome-screen-cards branch from a5c4870 to 8d88224 Compare June 23, 2026 15:29
Base automatically changed from chop/f0form-no-padding to main June 23, 2026 15:31
…footer

Replace the QuickActions footer in the ApplicationFrame Default story with
the welcome cards (WelcomeScreenCardsRow), wired to the mock chat runtime so
prompt cards send their message. FullscreenWithActions keeps QuickActions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

✅ No New Circular Dependencies

No new circular dependencies detected. Current count: 0

@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

⚠️ Breaking public API changes (2)

These public exports were renamed/removed, or had a property/parameter removed, retyped, or newly required compared to main — that breaks consumers. Adding new exports or new optional props is always safe and is not flagged. If a breaking change is intentional, note it in the PR description and use a feat!:/BREAKING CHANGE commit so the release is a major bump.

Comparing f0, experimental and ai against main. Adding components, types, or optional props is safe. This check is non-blocking.

f0

  • ✏️ useAiChatbreaking change

    • required return.welcomeScreenCards was added
    • required return.setWelcomeScreenCards was added
    before → after
    // before
    () => AiChatProviderReturnValue
    // after
    () => AiChatProviderReturnValue

ai

  • ✏️ useAiChatbreaking change

    • required return.welcomeScreenCards was added
    • required return.setWelcomeScreenCards was added
    before → after
    // before
    () => AiChatProviderReturnValue
    // after
    () => AiChatProviderReturnValue
➕ Additive changes (safe) — 2
  • f0: F0AiChatWelcomeCard
  • ai: F0AiChatWelcomeCard

@developerdanx developerdanx left a comment

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.

💪

@sauldom102 sauldom102 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should all these cards in One full-screen trigger a prompt? What about the templates one?

Address review feedback on welcomeScreenCards: a card click now reports
which card was clicked, not just a prompt string, so different cards can
trigger different behaviors.

- F0AiChatWelcomeCard gains a required, stable id; message stays optional
  and is now pure data (the host decides whether to send it).
- Remove the per-card onClick; clicking any card calls onCardSelect(id,
  message) so the host can branch behavior per card (send a prompt, open
  a dialog, navigate, ...).
- Update WelcomeScreenCardsRow, the F0AiChatTextArea types/passthrough,
  and the stories/tests; the ApplicationFrame demo routes "All templates"
  to a non-prompt branch.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Completes the welcome-cards API. Alongside the data-driven
`welcomeScreenCards`, F0AiChat now exposes an `onCardSelect(id, message)`
handler — both as a prop and as a `setOnCardSelect` registrar on the
provider, so a component rendered inside the chat (one that needs
in-provider context such as `openCanvas`) can wire per-card behavior.

The handler is ref-backed and exposed as a stable dispatcher, so the
connected input always calls the latest registered handler without
re-rendering and consumers can `setOnCardSelect(fn)` directly (no
functional-setState wrapper). Data and its handler now live together in
the provider, symmetric with `welcomeScreenCards`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
warcos-fact added a commit that referenced this pull request Jun 30, 2026
Aligns the survey reference with the reworked welcome-cards API
(PR #4550): cards are now pure data with stable ids instead of
per-card onClick closures, and the three card behaviors collapse
into one id-keyed handler registered with the chat via
setOnCardSelect. The mock connected input forwards the provider
handler to the composer.

Keeps the data-driven welcomeScreenCards approach intact — the
registrar still feeds card data through the provider; only the
click wiring changed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the host-level onCardSelect(id, message) handler and the
setOnCardSelect/onCardSelectRef dispatcher plumbing in the provider.
Each F0AiChatWelcomeCard now owns its behavior via an optional onClick,
so different cards can trigger different things and the host wires each
one directly. Final card shape: id, icon, title, description, message,
onClick.

Tests and stories updated to the new model; a card without onClick
renders non-interactive.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…n-cards

# Conflicts:
#	packages/react/src/patterns/ApplicationFrame/index.stories.tsx
@warcos-fact warcos-fact merged commit f0405f7 into main Jun 30, 2026
24 checks passed
@warcos-fact warcos-fact deleted the chop/ai-welcome-screen-cards branch June 30, 2026 13:01
@eliseo-juan eliseo-juan mentioned this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changes feat react Changes affect packages/react

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants