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

@ethereal-nexus/dialog-ui-core

v1.2.4

Published

Headless React package with hooks and logic for AEM dialog processing

Downloads

412

Readme

@ethereal-nexus/dialog-ui-core

A headless React package providing hooks and logic for AEM dialog processing. This package contains the core business logic for handling dynamic form dialogs without any UI components.

Features

  • 🔧 Headless Architecture: Pure logic without UI dependencies
  • ⚛️ React Hooks: Modern React patterns with useDialogProcessor
  • 🔍 Type Safety: Full TypeScript support with comprehensive type definitions
  • Validation: Built-in field validation with error handling
  • 🔄 Adapters: Extensible adapter pattern for different data sources
  • 📝 Form Management: State management for complex nested forms
  • 🎯 Multifield Support: Handle arrays of complex field configurations

Installation

npm install @ethereal-nexus/dialog-ui-core
# or
pnpm add @ethereal-nexus/dialog-ui-core
# or
yarn add @ethereal-nexus/dialog-ui-core

Quick Start

import { useDialogProcessor, DialogConfig } from '@ethereal-nexus/dialog-ui-core';

const dialogConfig: DialogConfig = {
  fields: [
    {
      id: 'title',
      name: 'title',
      label: 'Title',
      type: 'textfield',
      required: true,
      placeholder: 'Enter title...'
    },
    {
      id: 'description',
      name: 'description',
      label: 'Description',
      type: 'textarea',
      required: false
    }
  ]
};

function MyComponent() {
  const {
    formData,
    errors,
    isValid,
    updateField,
    resetForm,
    validateForm
  } = useDialogProcessor(dialogConfig, {});

  const handleSubmit = () => {
    if (validateForm()) {
      console.log('Form data:', formData);
    }
  };

  return (
    <div>
      <input
        value={formData.title || ''}
        onChange={(e) => updateField('title', e.target.value)}
        placeholder="Title"
      />
      {errors.title && <span className="error">{errors.title}</span>}
      
      <button onClick={handleSubmit} disabled={!isValid}>
        Submit
      </button>
    </div>
  );
}

Core Concepts

DialogConfig

The DialogConfig interface defines the structure of your dialog:

interface DialogConfig {
  fields: FieldConfig[];
}

FieldConfig

Each field in your dialog is defined by a FieldConfig:

interface FieldConfig {
  id: string;                    // Unique identifier
  name: string;                  // Field name for form data
  label?: string;                // Display label
  type: string;                  // Field type (textfield, textarea, select, etc.)
  required?: boolean;            // Validation requirement
  placeholder?: string;          // Placeholder text
  multiple?: boolean;            // Allow multiple values
  defaultValue?: any;            // Default field value
  tooltip?: string | null;       // Help text
  min?: string;                  // Minimum length/value
  max?: string;                  // Maximum length/value
  children?: FieldConfig[];      // Nested fields (for multifield, groups)
  options?: Array<{ value: string; label: string }>; // Select options
  showastoggle?: boolean;        // Show as toggle component
}

useDialogProcessor Hook

The main hook for managing dialog state:

const {
  formData,      // Current form values
  errors,        // Validation errors
  isValid,       // Overall form validity
  updateField,   // Update a field value
  resetForm,     // Reset form to initial state
  validateForm   // Trigger validation
} = useDialogProcessor(config, initialValues);

Supported Field Types

  • textfield: Single-line text input
  • textarea: Multi-line text input
  • select: Dropdown selection
  • multifield: Array of nested field groups
  • checkbox: Boolean toggle
  • radio: Single selection from options
  • pathbrowser: File/path selection
  • datepicker: Date selection

Validation

Built-in validation includes:

  • Required field validation: Ensures required fields have values
  • Length validation: Min/max character limits for text fields
  • Nested validation: Validates multifield items and nested structures
  • Custom validation: Extensible validation through field configuration
// Example with validation
const fieldConfig: FieldConfig = {
  id: 'username',
  name: 'username',
  label: 'Username',
  type: 'textfield',
  required: true,
  min: '3',
  max: '20'
};

Adapters

The package includes an adapter pattern for integrating with different data sources:

import { AEMAdapter } from '@ethereal-nexus/dialog-ui-core/adapters';

// Extend the base adapter for your specific needs
class CustomAdapter extends AEMAdapter {
  // Implement custom data fetching/transformation logic
}

Advanced Usage

Multifield Support

Handle complex nested structures:

const multifieldConfig: FieldConfig = {
  id: 'items',
  name: 'items',
  label: 'Items',
  type: 'multifield',
  children: [
    {
      id: 'itemTitle',
      name: 'title',
      label: 'Item Title',
      type: 'textfield',
      required: true
    },
    {
      id: 'itemDescription',
      name: 'description',
      label: 'Description',
      type: 'textarea'
    }
  ]
};

Dynamic Field Updates

React to field changes:

const { updateField, formData } = useDialogProcessor(config, {});

// Update field programmatically
updateField('dynamicField', computedValue);

// React to field changes
useEffect(() => {
  if (formData.category === 'advanced') {
    updateField('advancedOptions', defaultAdvancedOptions);
  }
}, [formData.category]);

TypeScript Support

Full TypeScript support with exported types:

import type {
  DialogConfig,
  FieldConfig,
  FormData,
  ValidationErrors,
  UseDialogProcessorReturn
} from '@ethereal-nexus/dialog-ui-core';

Integration with UI Libraries

This headless package works with any UI library. For Adobe React Spectrum integration, see @ethereal-nexus/dialog-ui-spectrum.

API Reference

Types

  • DialogConfig - Configuration for the entire dialog
  • FieldConfig - Configuration for individual fields
  • FormData - Type for form data object
  • ValidationErrors - Type for validation error messages
  • UseDialogProcessorReturn - Return type of the main hook

Hooks

  • useDialogProcessor(config, initialValues) - Main dialog processing hook

Classes

  • DialogProcessor - Core dialog processing class
  • FieldRenderer - Base field rendering logic

Adapters

  • AEMAdapter - Adobe Experience Manager integration adapter

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

ISC License - see LICENSE for details.