8000 DT-3027: Setup Basic Super Form by rossnelson · Pull Request #2765 · temporalio/ui · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DT-3027: Setup Basic Super Form #2765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 27, 2025
Merged

DT-3027: Setup Basic Super Form #2765

merged 2 commits into from
Jun 27, 2025

Conversation

rossnelson
Copy link
Collaborator
@rossnelson rossnelson commented Jun 13, 2025

Description & motivation 💭

This PR implements direct SuperForms integration for form handling in the UI. It adds a minimal wrapper utility and documentation to help developers use SuperForms effectively.

Key changes:

  • Added createSPAForm wrapper that configures SuperForms with SPA defaults
  • Added documentation with examples for both wrapper and raw SuperForms usage
  • Created Storybook examples showing various form patterns
  • Added unit tests with proper mocking to avoid Svelte lifecycle issues
  • Updated basic page to demonstrate SuperForms usage
  • Added project guidelines in CLAUDE.md for development standards

Screenshots (if applicable) 📸

Storybook story shows a simple form with text input that successfully posts form data to the actions pane when submitted.

In Page Storybook
CleanShot 2025-06-18 at 14 25 24 CleanShot 2025-06-23 at 17 52 42

Form Usage

Forms use direct SuperForms integration:

import { createSPAForm } from '$lib/utilities/form/create-spa-form';
import { z } from 'zod';

const schema = z.object({
  username: z.string().min(3),
  email: z.string().email(),
});

const { form, errors, enhance } = createSPAForm({
  schema,
  defaultValues: { username: '', email: '' },
  options: {
    onUpdate: async ({ form }) => {
      // Handle form submission
    },
  },
});
<form use:enhance>
  <Input bind:value={$form.username} error={$errors.username?.[0]} />
  <Input bind:value={$form.email} error={$errors.email?.[0]} />
  <Button type="submit">Submit</Button>
</form>

Benefits ✨

  1. Type safety - Full TypeScript support from SuperForms
  2. Developer experience - Direct access to SuperForms APIs
  3. Performance - No wrapper overhead
  4. Future-proof - Built on well-maintained SuperForms library

Testing 🧪

  • Unit tests for createSPAForm function with mocked SuperForms
  • Storybook examples with interactive forms
  • Basic page demonstrates usage
  • All linting and type checking passes

Steps to test: 🚶‍♂️🚶‍♀️

  1. Run pnpm stories:dev to start Storybook
  2. Navigate to "Form/SuperForms Examples" story
  3. Test all four form examples (basic, raw, loading, validation)
  4. Visit /basic route to see form in action
  5. Run pnpm test src/lib/utilities/form/create-spa-form.test.ts to verify tests
  6. Run pnpm check and pnpm lint to verify code quality

Checklists ✅

Completed

  • C 8000 reate SuperForms wrapper utility
  • Add documentation and examples
  • Create unit tests with proper mocking
  • Update Storybook with interactive examples
  • Remove barrel imports for direct file paths
  • Ensure all linting and type checking passes
  • Add project coding standards (CLAUDE.md)

Issue(s) closed

Completes DT-3027 SuperForms integration - adds form handling with direct SuperForms usage.

Closes DT-3034, DT-3028, DT-3029, DT-3032

Copy link
vercel bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
holocene ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 27, 2025 8:01pm

@rossnelson rossnelson force-pushed the DT-3027-setup-basic-form branch from b583c4d to 4f755cf Compare June 23, 2025 21:19
@@ -0,0 +1,134 @@
// @vitest-environment jsdom
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This test feels pointless. is there a better way to unit test svelte components?

Adds foundational form infrastructure using SuperForms for SPA
applications. Includes SuperForms integration with Zod validation,
comprehensive documentation, and Storybook examples.

Key implementation details:
- SuperForms dependency with Zod for schema validation
- Example components demonstrating various form patterns
- Documentation covering both wrapper and raw SuperForms usage
- Storybook integration for interactive form examples
- Testing infrastructure setup with proper mocking
- CLAUDE.md documentation for project coding standards

The infrastructure provides a foundation for building robust forms with
client-side validation, loading states, error handling, and proper
accessibility support.
@rossnelson rossnelson force-pushed the DT-3027-setup-basic-form branch from 106fbc3 to ad40516 Compare June 27, 2025 20:00
@rossnelson rossnelson merged commit 34b06aa into main Jun 27, 2025
16 checks passed
@rossnelson rossnelson deleted the DT-3027-setup-basic-form branch June 27, 2025 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0