wally-ui 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/playground/showcase/src/app/app.routes.server.ts +4 -0
- package/playground/showcase/src/app/components/dialog/dialog-close/dialog-close.html +1 -0
- package/playground/showcase/src/app/components/dialog/dialog-close/dialog-close.ts +16 -0
- package/playground/showcase/src/app/components/dialog/dialog-content/dialog-content.html +15 -0
- package/playground/showcase/src/app/components/dialog/dialog-content/dialog-content.ts +19 -0
- package/playground/showcase/src/app/components/dialog/dialog-description/dialog-description.html +3 -0
- package/playground/showcase/src/app/components/dialog/dialog-description/dialog-description.ts +8 -0
- package/playground/showcase/src/app/components/dialog/dialog-footer/dialog-footer.html +3 -0
- package/playground/showcase/src/app/components/dialog/dialog-footer/dialog-footer.ts +8 -0
- package/playground/showcase/src/app/components/dialog/dialog-header/dialog-header.html +3 -0
- package/playground/showcase/src/app/components/dialog/dialog-header/dialog-header.ts +8 -0
- package/playground/showcase/src/app/components/dialog/dialog-title/dialog-title.html +3 -0
- package/playground/showcase/src/app/components/dialog/dialog-title/dialog-title.ts +8 -0
- package/playground/showcase/src/app/components/dialog/dialog-trigger/dialog-trigger.html +1 -0
- package/playground/showcase/src/app/components/dialog/dialog-trigger/dialog-trigger.ts +16 -0
- package/playground/showcase/src/app/components/dialog/dialog.html +1 -0
- package/playground/showcase/src/app/components/dialog/dialog.service.ts +20 -0
- package/playground/showcase/src/app/components/dialog/dialog.ts +29 -0
- package/playground/showcase/src/app/pages/documentation/components/components.html +310 -126
- package/playground/showcase/src/app/pages/documentation/components/components.routes.ts +44 -40
- package/playground/showcase/src/app/pages/documentation/components/dialog-docs/dialog-docs.examples.ts +275 -0
- package/playground/showcase/src/app/pages/documentation/components/dialog-docs/dialog-docs.html +701 -0
- package/playground/showcase/src/app/pages/documentation/components/dialog-docs/dialog-docs.ts +84 -0
package/package.json
CHANGED
|
@@ -45,6 +45,10 @@ export const serverRoutes: ServerRoute[] = [
|
|
|
45
45
|
path: 'documentation/components/combobox',
|
|
46
46
|
renderMode: RenderMode.Prerender,
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
path: 'documentation/components/dialog',
|
|
50
|
+
renderMode: RenderMode.Prerender,
|
|
51
|
+
},
|
|
48
52
|
{
|
|
49
53
|
path: 'documentation/chat-sdk',
|
|
50
54
|
renderMode: RenderMode.Prerender,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, HostListener, inject } from '@angular/core';
|
|
2
|
+
import { DialogService } from '../dialog.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'wally-dialog-close',
|
|
6
|
+
imports: [],
|
|
7
|
+
templateUrl: './dialog-close.html'
|
|
8
|
+
})
|
|
9
|
+
export class DialogClose {
|
|
10
|
+
dialogService = inject(DialogService);
|
|
11
|
+
|
|
12
|
+
@HostListener('click')
|
|
13
|
+
onClick(): void {
|
|
14
|
+
this.dialogService.close();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@if (dialogService.isOpen()) {
|
|
2
|
+
<div
|
|
3
|
+
class="fixed inset-0 z-50 bg-black/50 backdrop-blur-sm transition-all duration-200"
|
|
4
|
+
(click)="onBackdropClick($event)"
|
|
5
|
+
role="dialog"
|
|
6
|
+
aria-modal="true">
|
|
7
|
+
<div class="flex min-h-screen items-center justify-center p-4">
|
|
8
|
+
<div
|
|
9
|
+
class="relative w-full max-w-lg bg-white dark:bg-neutral-950 border border-neutral-300 dark:border-neutral-700 rounded-xl shadow-2xl transition-all duration-200 ease-out"
|
|
10
|
+
(click)="$event.stopPropagation()">
|
|
11
|
+
<ng-content></ng-content>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ElementRef, inject } from '@angular/core';
|
|
2
|
+
import { DialogService } from '../dialog.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'wally-dialog-content',
|
|
6
|
+
imports: [],
|
|
7
|
+
templateUrl: './dialog-content.html'
|
|
8
|
+
})
|
|
9
|
+
export class DialogContent {
|
|
10
|
+
dialogService = inject(DialogService);
|
|
11
|
+
private elementRef = inject(ElementRef);
|
|
12
|
+
|
|
13
|
+
onBackdropClick(event: MouseEvent): void {
|
|
14
|
+
// Close only if clicking directly on backdrop (not on dialog content)
|
|
15
|
+
if (event.target === event.currentTarget && this.dialogService.closeOnBackdropClick()) {
|
|
16
|
+
this.dialogService.close();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, HostListener, inject } from '@angular/core';
|
|
2
|
+
import { DialogService } from '../dialog.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'wally-dialog-trigger',
|
|
6
|
+
imports: [],
|
|
7
|
+
templateUrl: './dialog-trigger.html'
|
|
8
|
+
})
|
|
9
|
+
export class DialogTrigger {
|
|
10
|
+
dialogService = inject(DialogService);
|
|
11
|
+
|
|
12
|
+
@HostListener('click')
|
|
13
|
+
onClick(): void {
|
|
14
|
+
this.dialogService.open();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<ng-content></ng-content>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Injectable, signal } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Injectable()
|
|
4
|
+
export class DialogService {
|
|
5
|
+
isOpen = signal<boolean>(false);
|
|
6
|
+
closeOnBackdropClick = signal<boolean>(true);
|
|
7
|
+
closeOnEsc = signal<boolean>(true);
|
|
8
|
+
|
|
9
|
+
open(): void {
|
|
10
|
+
this.isOpen.set(true);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
close(): void {
|
|
14
|
+
this.isOpen.set(false);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
toggle(): void {
|
|
18
|
+
this.isOpen.update(value => !value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, effect, HostListener, inject, input } from '@angular/core';
|
|
2
|
+
import { DialogService } from './dialog.service';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'wally-dialog',
|
|
6
|
+
imports: [],
|
|
7
|
+
providers: [DialogService],
|
|
8
|
+
templateUrl: './dialog.html'
|
|
9
|
+
})
|
|
10
|
+
export class Dialog {
|
|
11
|
+
dialogService = inject(DialogService);
|
|
12
|
+
|
|
13
|
+
closeOnBackdropClick = input<boolean>(true);
|
|
14
|
+
closeOnEsc = input<boolean>(true);
|
|
15
|
+
|
|
16
|
+
constructor() {
|
|
17
|
+
effect(() => {
|
|
18
|
+
this.dialogService.closeOnBackdropClick.set(this.closeOnBackdropClick());
|
|
19
|
+
this.dialogService.closeOnEsc.set(this.closeOnEsc());
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@HostListener('document:keydown.escape')
|
|
24
|
+
onEscape(): void {
|
|
25
|
+
if (this.dialogService.isOpen() && this.dialogService.closeOnEsc()) {
|
|
26
|
+
this.dialogService.close();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|