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

@3kles/kles-material-dialog

v22.0.2

Published

@3kles/kles-material-dialog is a angular library to create dialog.

Downloads

1,132

Readme

@3kles/kles-material-dialog

@3kles/kles-material-dialog is a angular library to create dialog.

Changelog

Check out the changelog to check all the latest changes.

Models

Components

  • AlertDialogComponent -> Component to create an alert dialog
  • ConfirmDialogComponent -> Component to create a confirm dialog
  • SpinnerDialogComponent -> Component to create a spinner dialog
  • KlesDynamicFormDialogComponent -> Component to create a dialog with a form
  • KlesDialogLayoutComponent -> Standalone layout for custom dialogs

Install

npm

npm install --save @3kles/kles-material-dialog

How to use

constructor(protected dialog: MatDialog) {}

open(): void {
    this.dialog.open(DialogComponent, {
        data: {
            ...
        },
        ...
    });
}

Check the documentation to use component and directive.

Custom dialog with a dynamic form

KlesDialogLayoutComponent exposes six projection zones: klesDialogTitle, klesDialogTitleContent, klesDialogContent, klesDialogStatus, klesDialogActionsStart and klesDialogActionsEnd. The content is scrollable; the status and actions remain together in a fixed footer.

The additional title content is right-aligned by default. Use titleContentAlign to place it at the start, center or end of the available title row:

<kles-dialog-layout titleContentAlign="center">
  <span klesDialogTitle>Connection</span>
  <span klesDialogTitleContent>Environment: production</span>
</kles-dialog-layout>

The following custom dialog keeps the domain-specific "test connection" action in the application while reusing the library layout and KlesDynamicFormComponent.

import { Component, ViewChild } from '@angular/core';
import { FormsModule, Validators } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule, MatDialogRef } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import {
  IKlesFieldConfig,
  KlesDynamicFormComponent,
  KlesFormInputComponent,
  KlesMaterialDynamicformsModule,
} from '@3kles/kles-material-dynamicforms';
import {
  KlesDialogAbstractComponent,
  KlesDialogLayoutComponent,
} from '@3kles/kles-material-dialog';
import { finalize } from 'rxjs/operators';
import { ConnectionService } from './connection.service';

@Component({
  selector: 'app-connection-dialog',
  standalone: true,
  imports: [
    KlesDialogLayoutComponent,
    KlesMaterialDynamicformsModule,
    FormsModule,
    MatButtonModule,
    MatDialogModule,
    MatIconModule,
    MatProgressSpinnerModule,
    MatSlideToggleModule,
  ],
  templateUrl: './connection-dialog.component.html',
})
export class ConnectionDialogComponent extends KlesDialogAbstractComponent {
  @ViewChild(KlesDynamicFormComponent, { static: true })
  dynamicForm!: KlesDynamicFormComponent;

  active = true;
  testing = false;
  status?: { kind: 'success' | 'error'; message: string };
  fields: IKlesFieldConfig[] = [
    {
      component: KlesFormInputComponent,
      name: 'host',
      label: 'Host',
      validations: [
        {
          name: 'required',
          validator: Validators.required,
          message: 'Host is required',
        },
      ],
    },
  ];

  constructor(
    dialogRef: MatDialogRef<ConnectionDialogComponent>,
    private readonly connections: ConnectionService,
  ) {
    super(dialogRef);
    this.fullsizeButton.set(true);
  }

  testConnection(): void {
    if (!this.validateForm()) return;

    this.testing = true;
    this.status = undefined;
    this.connections
      .test({ ...this.dynamicForm.form.getRawValue(), active: this.active })
      .pipe(finalize(() => (this.testing = false)))
      .subscribe({
        next: () =>
          (this.status = { kind: 'success', message: 'Connection successful' }),
        error: () =>
          (this.status = { kind: 'error', message: 'Connection failed' }),
      });
  }

  save(): void {
    if (!this.validateForm()) return;
    this.dialogRef.close({
      ...this.dynamicForm.form.getRawValue(),
      active: this.active,
    });
  }

  private validateForm(): boolean {
    this.dynamicForm.form.markAllAsTouched();
    return this.dynamicForm.form.valid;
  }
}
<kles-dialog-layout
  icon="settings_ethernet"
  [fullsize]="fullsize()"
  [fullsizeButton]="fullsizeButton()"
  (fullsizeToggle)="toggleFullsize()"
>
  <span klesDialogTitle>Connection</span>

  <app-kles-dynamic-form klesDialogContent [fields]="fields" />

  @if (status; as result) {
    <div klesDialogStatus [class.connection-success]="result.kind === 'success'"
      [class.connection-error]="result.kind === 'error'">
      {{ result.message }}
    </div>
  }

  <mat-slide-toggle klesDialogActionsStart [(ngModel)]="active">
    Active
  </mat-slide-toggle>

  <div klesDialogActionsEnd>
    <button mat-button type="button" mat-dialog-close>Annuler</button>
    <button mat-button type="button" [disabled]="testing" (click)="testConnection()">
      Tester la connexion
      @if (testing) { <mat-spinner diameter="18" /> }
    </button>
    <button mat-flat-button type="button" [disabled]="testing" (click)="save()">
      Enregistrer
    </button>
  </div>
</kles-dialog-layout>

testConnection() does not call dialogRef.close(): the dialog therefore stays open while the test runs and when its result is displayed.

Tests

npm install
npm test

License

MIT