Skip to content

UpWindow is an Angular library designed to create dynamic, customizable modals and window-based components for web applications.

Notifications You must be signed in to change notification settings

criar-art/up-window-angular

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e19d6c6 · Oct 15, 2024

History

67 Commits
Oct 14, 2024
Oct 14, 2024
Oct 15, 2024
Oct 14, 2024
Oct 14, 2024
Oct 15, 2024
Oct 14, 2024
Oct 14, 2024
Oct 14, 2024
Oct 15, 2024
Oct 14, 2024
Oct 14, 2024
Oct 15, 2024
Oct 15, 2024
Oct 14, 2024
Oct 14, 2024
Oct 14, 2024

Repository files navigation

up-window-angular

An Angular library designed to create dynamic, customizable windows and window-based components for web applications. With a simple and intuitive API, UpWindow enables developers to easily integrate responsive windows, popups, and floating windows into their projects. It provides full control over window size, position, animations, and behavior, offering a flexible solution for creating engaging user interfaces.

Install

npm install up-window-angular

Usage Example

import { Component } from '@angular/core';
import { signal, WritableSignal } from 'signals';
import UpWindowAngularModule from 'up-window-angular';

@Component({
  selector: 'app-window-example',
  templateUrl: './window-example.component.html',
})
export class WindowExampleComponent {
  isWindowOpenExample: WritableSignal<boolean> = signal(false);

  openWindowExample() {
    this.isWindowOpenExample.set(true);
  }
}

HTML Template

<button class="button-window-example" type="button" (click)="openWindowExample()">
  Open Window Example
</button>

<up-window-angular
  [isOpen]="isWindowOpenExample"
  title="Window Title"
  subtitle="This is the subtitle of the window."
>
  Window Example content!
</up-window-angular>

Component Setup

  • In the WindowExampleComponent, a WritableSignal<boolean> named isWindowOpenExample is defined, initialized to false.
  • The openWindowExample method sets isWindowOpenExample to true, which opens the window.

Inputs

  • @Input() title!: string;

    • Example: Set the title of the window.
    <up-window-angular title="My Custom Title" />
  • @Input() subtitle!: string;

    • Example: Set the subtitle of the window.
    <up-window-angular subtitle="This is a custom subtitle" />
  • @Input() class: string | undefined;

    • Example: Add custom CSS classes.
    <up-window-angular class="custom-window-class" />
  • @Input() isOpen: WritableSignal<boolean> = signal(false);

    • Example: Control the visibility of the window.
    this.isWindowOpenExample.set(true); // Opens the window
  • @Input() animation: string = 'fade';

    • Example: Set a different animation type.
    <up-window-angular animation="slide" />
  • @Input() restrictMode: boolean = false;

    • Example: Enable restricted mode.
    <up-window-angular restrictMode="true" />
  • @Input() fullScreen: boolean = false;

    • Example: Enable fullscreen mode for the window.
    <up-window-angular [fullScreen]="true" />
  • @Input() confirmText: string = 'Confirm';

    • Example: Customize the confirm button text.
    <up-window-angular confirmText="Agree" />
  • @Input() cancelText: string = 'Cancel';

    • Example: Customize the cancel button text.
    <up-window-angular cancelText="Dismiss" />
  • @Input() confirmType: string = 'primary';

    • Example: Set the style of the confirm button.
    <up-window-angular confirmType="success" />
  • @Input() cancelType: string = 'default';

    • Example: Set the style of the cancel button.
    <up-window-angular cancelType="danger" />
  • @Input() buttonAlignment: 'start' | 'end' | 'center' = 'end';

    • Example: Align the buttons to the center.
    <up-window-angular buttonAlignment="center" />
  • @Input() onConfirmClick: () => void = () => this.onConfirm();

    • Example: Custom confirm action.
    onConfirm() {
      console.log('Confirmed!');
    }
  • @Input() onCancelClick: () => void = () => this.onCancel();

    • Example: Custom cancel action.
    onCancel() {
      console.log('Cancelled!');
    }

Outputs

  • @Output() confirm = new EventEmitter<void>();

    • Example: Emit an event when confirm is clicked.
    this.confirm.subscribe(() => {
      console.log('Confirmed action triggered');
    });
  • @Output() cancel = new EventEmitter<void>();

    • Example: Emit an event when cancel is clicked.
    this.cancel.subscribe(() => {
      console.log('Cancel action triggered');
    });

About

UpWindow is an Angular library designed to create dynamic, customizable modals and window-based components for web applications.

Topics

Resources

Stars

Watchers

Forks