npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@esheet/renderer

v0.0.3

Published

Read-only questionnaire form renderer for eSheet. Renders forms in fill-out mode with conditional visibility logic.

Downloads

971

Readme

@esheet/renderer

Read-only questionnaire form renderer for eSheet. Renders forms in fill-out mode with conditional visibility logic.

Features

  • ✅ Renders all 19 eSheet field types (reuses @esheet/fields components)
  • ✅ Conditional visibility enforcement (fields/sections hide based on logic rules)
  • ✅ Section nesting with recursive rendering
  • ✅ Initial response pre-fill support
  • ✅ YAML/JSON schema parsing with Zod validation
  • ✅ Ref API for collecting responses
  • ✅ TypeScript-first with full type safety

Installation

npm install @esheet/renderer @esheet/fields @esheet/core

Standalone and Blaze integrations now ship as separate packages:

npm install @esheet/renderer-standalone
npm install @esheet/renderer-blaze

Migration for old subpath imports:

  • @esheet/renderer/standalone -> @esheet/renderer-standalone
  • @esheet/renderer/blaze -> @esheet/renderer-blaze

Usage

Basic Example

import { EsheetRenderer } from '@esheet/renderer';
import type { FormDefinition } from '@esheet/core';

const myForm: FormDefinition = {
  schemaType: 'mieforms-v1.0',
  title: 'Patient Intake',
  fields: [
    {
      id: 'name',
      fieldType: 'text',
      question: 'Full Name',
      required: true,
    },
    {
      id: 'age',
      fieldType: 'text',
      question: 'Age',
    },
  ],
};

function App() {
  return (
    <div className="app-container">
      <EsheetRenderer formData={myForm} />
    </div>
  );
}

With Response Collection

import { useRef } from 'react';
import { EsheetRenderer, type EsheetRendererHandle } from '@esheet/renderer';

function App() {
  const rendererRef = useRef<EsheetRendererHandle>(null);

  const handleSubmit = () => {
    const responses = rendererRef.current?.getResponse();
    console.log('Form responses:', responses);
    // { name: '...', age: '...' }
  };

  return (
    <>
      <EsheetRenderer formData={myForm} ref={rendererRef} />
      <button onClick={handleSubmit}>Submit</button>
    </>
  );
}

With Pre-filled Data

<EsheetRenderer
  formData={myForm}
  initialResponses={{
    name: 'John Doe',
    age: '42',
  }}
/>

With YAML/JSON String

const yamlSchema = `
schemaType: mieforms-v1.0
title: Simple Form
fields:
  - id: q1
    fieldType: text
    question: Your name?
`;

<EsheetRenderer formData={yamlSchema} />;

API

<EsheetRenderer>

Props:

  • formData: FormDefinition | string - Form schema (object, JSON string, or YAML string)
  • initialResponses?: FormResponse - Pre-fill form with initial data
  • className?: string - Additional CSS classes for root container
  • ref?: Ref<EsheetRendererHandle> - Access ref API for collecting responses

Ref API:

interface EsheetRendererHandle {
  getResponse: () => FormResponse;
  getFormStore: () => FormStore;
  getUIStore: () => UIStore;
}

Architecture

EsheetRenderer is a thin wrapper that:

  1. Creates form and UI stores (vanilla Zustand)
  2. Parses and validates input (YAML/JSON → Zod schema check)
  3. Loads definition into store
  4. Sets preview mode (read-only, no editing UI)
  5. Iterates over visible fields via RendererBody
  6. Renders each field via FieldNode (uses @esheet/fields components)

Conditional Logic:

  • Reuses form.isVisible(), form.isEnabled(), form.isRequired() from core
  • Sections auto-hide when all children are invisible
  • Field visibility updates reactively when responses change

Section Nesting:

  • FieldNode recursively renders section children
  • Each depth level adds left border and padding
  • Respects visibility rules at every level

Example: Conditional Visibility

const conditionalForm: FormDefinition = {
  schemaType: 'mieforms-v1.0',
  title: 'Conditional Form',
  fields: [
    {
      id: 'hasAllergies',
      fieldType: 'boolean',
      question: 'Do you have any allergies?',
    },
    {
      id: 'allergyList',
      fieldType: 'longtext',
      question: 'Please list your allergies',
      visible: {
        conditions: [
          {
            conditionType: 'comparison',
            fieldId: 'hasAllergies',
            operator: '==',
            value: true,
          },
        ],
        logicalOperator: 'AND',
      },
    },
  ],
};

// "allergyList" only shows when "hasAllergies" is checked
<EsheetRenderer formData={conditionalForm} />;

CSS Architecture

The renderer uses Tailwind CSS v4 with ms: prefix. CSS is compiled via @tailwindcss/cli and embedded into the JS bundle at build time — consumers never need to import a stylesheet. A scoped reset on .esheet-renderer-root prevents style leakage in either direction. Dark mode is supported via .dark class on the root.

License

MIT

Building

Run nx build @esheet/renderer to build the library.

Running unit tests

Run nx test @esheet/renderer to execute the unit tests via Vitest.