Skip to content

WebComponent: Implement ClickToSign behavior and rendering #4

@mikewolfd

Description

@mikewolfd

Motivation

The webcomponent package needs to render ClickToSign so forms with click-to-sign attestation work in the browser.

Scope

  • Add useClickToSign behavior hook in packages/formspec-webcomponent/src/behaviors/
    • Reads the bound group's children (accepted, signedBy, signedAt, statement)
    • On sign click: sets accepted=true, signedBy to provided/typed name, signedAt to current ISO datetime, statement to the configured text
    • On revoke (if revocable): clears all children back to defaults
    • Exposes reactive state for signed/unsigned rendering
  • Add ClickToSign to the default adapter component registry
  • Add ClickToSign rendering in the default adapter (display statement text, sign button, signed state display)
  • Add fallback logic: Core processors replace ClickToSign with Stack + Text + Toggle + readonly fields
  • Add story to packages/formspec-webcomponent/stories/
  • Add E2E test covering sign, revoke, validation, and readonly states

Acceptance Criteria

  • ClickToSign renders and captures structured attestation data
  • Signed state displays who signed and when
  • Revoke works when enabled
  • Required validation works (accepted must be true)
  • Readonly state prevents signing/revoking
  • Fallback produces a functional Stack + Toggle layout
  • Story demonstrates the component
  • E2E test passes

Dependencies

Depends on #3 (schema must validate the component nodes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions