@ng-cn/core 1.0.16 → 1.0.17
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/src/app/lib/components/ui/accordion/accordion-content.component.ts +11 -14
- package/src/app/lib/components/ui/accordion/accordion-context.ts +1 -0
- package/src/app/lib/components/ui/accordion/accordion-item.component.ts +8 -0
- package/src/app/lib/components/ui/accordion/accordion-trigger.component.ts +5 -1
- package/src/app/lib/components/ui/accordion/accordion.component.ts +24 -6
- package/src/app/lib/components/ui/alert/alert-variants.ts +18 -4
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-action.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-cancel.component.ts +1 -1
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-content.component.ts +25 -9
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-description.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-footer.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-header.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-title.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/alert-dialog/alert-dialog.component.ts +4 -0
- package/src/app/lib/components/ui/aspect-ratio/aspect-ratio.component.ts +1 -0
- package/src/app/lib/components/ui/avatar/avatar-context.ts +9 -0
- package/src/app/lib/components/ui/avatar/avatar-fallback.component.ts +6 -9
- package/src/app/lib/components/ui/avatar/avatar-image.component.ts +40 -11
- package/src/app/lib/components/ui/avatar/avatar.component.ts +18 -13
- package/src/app/lib/components/ui/avatar/index.ts +1 -0
- package/src/app/lib/components/ui/avatar/ui-avatar.component.ts +9 -20
- package/src/app/lib/components/ui/badge/badge-variants.ts +1 -1
- package/src/app/lib/components/ui/badge/badge.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-ellipsis.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-item.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-link.component.ts +4 -11
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-list.component.ts +3 -7
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-page.component.ts +1 -0
- package/src/app/lib/components/ui/breadcrumb/breadcrumb-separator.component.ts +20 -24
- package/src/app/lib/components/ui/breadcrumb/breadcrumb.component.ts +1 -0
- package/src/app/lib/components/ui/button/button-variants.ts +3 -3
- package/src/app/lib/components/ui/button/button.component.ts +1 -0
- package/src/app/lib/components/ui/button-group/button-group.component.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible-content.component.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/collapsible/collapsible.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-content.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-empty.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-group.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-input.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-item.component.ts +1 -4
- package/src/app/lib/components/ui/combobox/combobox-list.component.ts +1 -1
- package/src/app/lib/components/ui/combobox/combobox-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox-value.component.ts +1 -0
- package/src/app/lib/components/ui/combobox/combobox.component.ts +1 -1
- package/src/app/lib/components/ui/command/command-dialog.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-empty.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-group.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-input.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-item.component.ts +2 -1
- package/src/app/lib/components/ui/command/command-list.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-separator.component.ts +1 -0
- package/src/app/lib/components/ui/command/command-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/command/command.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-content.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-item.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-label.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-radio-item.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-separator.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-content.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-sub-trigger.component.ts +2 -1
- package/src/app/lib/components/ui/context-menu/context-menu-sub.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/context-menu/context-menu.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-content.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-pagination.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-search.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-toolbar.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table-view-options.component.ts +1 -0
- package/src/app/lib/components/ui/data-table/data-table.component.ts +1 -1
- package/src/app/lib/components/ui/dialog/dialog-close.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-content.component.ts +20 -16
- package/src/app/lib/components/ui/dialog/dialog-description.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-footer.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-header.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-title.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/dialog/dialog.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-close.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-content.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-description.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-footer.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-header.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-title.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/drawer/drawer.component.ts +4 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-content.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-item.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-label.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-separator.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.component.ts +2 -1
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-sub.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/dropdown-menu/dropdown-menu.component.ts +1 -0
- package/src/app/lib/components/ui/hover-card/hover-card-content.component.ts +1 -0
- package/src/app/lib/components/ui/hover-card/hover-card-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/hover-card/hover-card.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-group.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-separator.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp-slot.component.ts +1 -0
- package/src/app/lib/components/ui/input-otp/input-otp.component.ts +1 -0
- package/src/app/lib/components/ui/kbd/kbd.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-checkbox-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-content.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-label.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-menu.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-group.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-radio-item.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-separator.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-shortcut.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-content.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-sub.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/menubar/menubar.component.ts +1 -0
- package/src/app/lib/components/ui/native-select/native-select.component.ts +1 -1
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-content.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-indicator.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-item.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-link.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-list.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu-viewport.component.ts +1 -0
- package/src/app/lib/components/ui/navigation-menu/navigation-menu.component.ts +4 -0
- package/src/app/lib/components/ui/pagination/pagination-content.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-ellipsis.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-item.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-link.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-next.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination-previous.component.ts +1 -0
- package/src/app/lib/components/ui/pagination/pagination.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover-anchor.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover-content.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/popover/popover.component.ts +1 -0
- package/src/app/lib/components/ui/resizable/resizable-handle.component.ts +1 -0
- package/src/app/lib/components/ui/resizable/resizable-panel-group.component.ts +1 -0
- package/src/app/lib/components/ui/resizable/resizable-panel.component.ts +1 -0
- package/src/app/lib/components/ui/scroll-area/scroll-area.component.ts +1 -0
- package/src/app/lib/components/ui/scroll-area/scroll-bar.component.ts +1 -0
- package/src/app/lib/components/ui/select/select-content.component.ts +3 -2
- package/src/app/lib/components/ui/sheet/sheet-close.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-content.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-description.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-footer.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-header.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-title.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/sheet/sheet.component.ts +4 -0
- package/src/app/lib/components/ui/sidebar/sidebar-content.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-footer.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-action.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-content.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group-label.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-group.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-header.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-input.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-inset.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-action.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-badge.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-button.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-item.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-skeleton.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-button.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub-item.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu-sub.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-menu.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-provider.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-rail.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-separator.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/sidebar/sidebar.component.ts +1 -0
- package/src/app/lib/components/ui/spinner/spinner.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-body.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-caption.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-cell.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-footer.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-head.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-header.component.ts +1 -0
- package/src/app/lib/components/ui/table/table-row.component.ts +1 -0
- package/src/app/lib/components/ui/table/table.component.ts +1 -0
- package/src/app/lib/components/ui/tabs/tabs-content.component.ts +3 -6
- package/src/app/lib/components/ui/tabs/tabs-list.component.ts +1 -0
- package/src/app/lib/components/ui/tabs/tabs-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/tabs/tabs.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-action.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-description.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast-title.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toast.component.ts +1 -0
- package/src/app/lib/components/ui/toast/toaster.component.ts +1 -0
- package/src/app/lib/components/ui/toggle/toggle-variants.ts +1 -1
- package/src/app/lib/components/ui/tooltip/tooltip-content.component.ts +1 -0
- package/src/app/lib/components/ui/tooltip/tooltip-provider.component.ts +4 -0
- package/src/app/lib/components/ui/tooltip/tooltip-trigger.component.ts +1 -0
- package/src/app/lib/components/ui/tooltip/tooltip.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-blockquote.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h1.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h2.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h3.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-h4.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-inline-code.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-large.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-lead.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-list.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-muted.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-p.component.ts +1 -0
- package/src/app/lib/components/ui/typography/typography-small.component.ts +1 -0
|
@@ -10,9 +10,13 @@ import {
|
|
|
10
10
|
HostListener,
|
|
11
11
|
inject,
|
|
12
12
|
input,
|
|
13
|
+
signal,
|
|
13
14
|
} from '@angular/core';
|
|
14
15
|
import { DIALOG_CONTEXT } from './dialog-context';
|
|
15
16
|
|
|
17
|
+
/** Animation duration in ms — must match Tailwind's duration-200 */
|
|
18
|
+
const EXIT_ANIMATION_MS = 200;
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* DialogContent component - the content of the dialog.
|
|
18
22
|
* Matches shadcn/ui React DialogContent exactly.
|
|
@@ -21,10 +25,11 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
21
25
|
selector: 'DialogContent',
|
|
22
26
|
imports: [FocusTrapDirective],
|
|
23
27
|
template: `
|
|
24
|
-
@if (
|
|
28
|
+
@if (shouldRender()) {
|
|
25
29
|
<!-- Overlay -->
|
|
26
30
|
<div
|
|
27
|
-
class="fixed inset-0 z-50 bg-black/80"
|
|
31
|
+
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-200"
|
|
32
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
28
33
|
(click)="onOverlayClick($event)"
|
|
29
34
|
aria-hidden="true"
|
|
30
35
|
></div>
|
|
@@ -36,6 +41,7 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
36
41
|
[restoreFocus]="true"
|
|
37
42
|
[initialFocus]="initialFocus()"
|
|
38
43
|
[class]="computedClass()"
|
|
44
|
+
[attr.data-state]="context.isOpen() ? 'open' : 'closed'"
|
|
39
45
|
[attr.id]="context.contentId"
|
|
40
46
|
[attr.aria-labelledby]="context.titleId"
|
|
41
47
|
[attr.aria-describedby]="context.descriptionId"
|
|
@@ -43,7 +49,6 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
43
49
|
aria-modal="true"
|
|
44
50
|
>
|
|
45
51
|
<ng-content />
|
|
46
|
-
<!-- Close button -->
|
|
47
52
|
@if (showClose()) {
|
|
48
53
|
<button
|
|
49
54
|
type="button"
|
|
@@ -74,41 +79,41 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
74
79
|
}
|
|
75
80
|
`,
|
|
76
81
|
host: {
|
|
82
|
+
'attr.data-slot': '"dialog-content"',
|
|
77
83
|
class: 'contents',
|
|
78
84
|
},
|
|
79
85
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
80
86
|
})
|
|
81
87
|
export class DialogContent {
|
|
82
88
|
constructor() {
|
|
83
|
-
// Handle body scroll lock based on open state
|
|
84
89
|
effect(() => {
|
|
85
90
|
const isOpen = this.context.isOpen();
|
|
86
|
-
|
|
87
|
-
// Force change detection since context.isOpen() might update outside of this component's hierarchy
|
|
88
|
-
// and we are using OnPush
|
|
89
91
|
this._cdr.markForCheck();
|
|
90
92
|
|
|
91
93
|
if (isOpen) {
|
|
94
|
+
this.shouldRender.set(true);
|
|
92
95
|
this.lockBodyScroll();
|
|
93
96
|
} else {
|
|
94
97
|
this.unlockBodyScroll();
|
|
98
|
+
if (this.shouldRender()) {
|
|
99
|
+
// Keep DOM alive for the exit animation, then unmount
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
this.shouldRender.set(false);
|
|
102
|
+
this._cdr.markForCheck();
|
|
103
|
+
}, EXIT_ANIMATION_MS);
|
|
104
|
+
}
|
|
95
105
|
}
|
|
96
106
|
});
|
|
97
107
|
|
|
98
|
-
// Cleanup on destroy
|
|
99
108
|
this._destroyRef.onDestroy(() => {
|
|
100
109
|
this.unlockBodyScroll();
|
|
101
110
|
this.restoreFocus();
|
|
102
111
|
});
|
|
103
112
|
}
|
|
104
113
|
|
|
105
|
-
/** Additional CSS classes */
|
|
106
114
|
readonly class = input<string>('');
|
|
107
|
-
/** Whether to show close button */
|
|
108
115
|
readonly showClose = input<boolean>(true);
|
|
109
|
-
/** Aria label for close button */
|
|
110
116
|
readonly ariaCloselabel = input<string>('Close dialog');
|
|
111
|
-
/** Selector for initial focus element */
|
|
112
117
|
readonly initialFocus = input<string | undefined>(undefined);
|
|
113
118
|
|
|
114
119
|
private readonly _destroyRef = inject(DestroyRef);
|
|
@@ -116,6 +121,8 @@ export class DialogContent {
|
|
|
116
121
|
|
|
117
122
|
readonly context = inject(DIALOG_CONTEXT);
|
|
118
123
|
|
|
124
|
+
protected readonly shouldRender = signal(false);
|
|
125
|
+
|
|
119
126
|
protected readonly computedClass = computed(() =>
|
|
120
127
|
cn(
|
|
121
128
|
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background text-foreground p-6 shadow-lg duration-200',
|
|
@@ -129,7 +136,6 @@ export class DialogContent {
|
|
|
129
136
|
),
|
|
130
137
|
);
|
|
131
138
|
|
|
132
|
-
/** Previous body overflow for restoration */
|
|
133
139
|
private previousBodyOverflow = '';
|
|
134
140
|
|
|
135
141
|
@HostListener('document:keydown.escape')
|
|
@@ -164,9 +170,7 @@ export class DialogContent {
|
|
|
164
170
|
private restoreFocus(): void {
|
|
165
171
|
const triggerEl = this.context.getTriggerElement();
|
|
166
172
|
if (triggerEl) {
|
|
167
|
-
setTimeout(() =>
|
|
168
|
-
triggerEl.focus();
|
|
169
|
-
}, 0);
|
|
173
|
+
setTimeout(() => triggerEl.focus(), 0);
|
|
170
174
|
}
|
|
171
175
|
}
|
|
172
176
|
}
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DialogFooter',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-footer"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DialogHeader',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-header"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { DIALOG_CONTEXT } from './dialog-context';
|
|
|
9
9
|
selector: 'DialogTrigger',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dialog-trigger"',
|
|
12
13
|
'(click)': 'onClick($event)',
|
|
13
14
|
'[attr.aria-haspopup]': '"dialog"',
|
|
14
15
|
'[attr.aria-expanded]': 'context.isOpen()',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DrawerFooter',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-footer"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DrawerHeader',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-header"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -9,6 +9,7 @@ import { DRAWER_CONTEXT } from './drawer-context';
|
|
|
9
9
|
selector: 'DrawerTrigger',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"drawer-trigger"',
|
|
12
13
|
'(click)': 'onClick($event)',
|
|
13
14
|
'[attr.aria-controls]': 'context.contentId',
|
|
14
15
|
'[attr.aria-expanded]': 'context.open()',
|
|
@@ -37,6 +37,10 @@ import { DRAWER_CONTEXT, type DrawerContextValue } from './drawer-context';
|
|
|
37
37
|
@Component({
|
|
38
38
|
selector: 'Drawer',
|
|
39
39
|
template: `<ng-content />`,
|
|
40
|
+
host: {
|
|
41
|
+
'attr.data-slot': '"drawer"',
|
|
42
|
+
style: 'display: contents',
|
|
43
|
+
},
|
|
40
44
|
providers: [
|
|
41
45
|
{
|
|
42
46
|
provide: DRAWER_CONTEXT,
|
|
@@ -27,6 +27,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
27
27
|
<ng-content />
|
|
28
28
|
`,
|
|
29
29
|
host: {
|
|
30
|
+
'attr.data-slot': '"dropdown-menu-checkbox-item"',
|
|
30
31
|
'[class]': 'computedClass()',
|
|
31
32
|
'[attr.role]': '"menuitemcheckbox"',
|
|
32
33
|
'[attr.aria-checked]': 'checked()',
|
|
@@ -42,6 +42,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
42
42
|
</Presence>
|
|
43
43
|
`,
|
|
44
44
|
host: {
|
|
45
|
+
'attr.data-slot': '"dropdown-menu-content"',
|
|
45
46
|
class: 'contents',
|
|
46
47
|
'(document:click)': 'onDocumentClick($event)',
|
|
47
48
|
'(document:keydown.escape)': 'onEscapeKey()',
|
|
@@ -8,6 +8,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
|
8
8
|
selector: 'DropdownMenuGroup',
|
|
9
9
|
template: `<ng-content />`,
|
|
10
10
|
host: {
|
|
11
|
+
'attr.data-slot': '"dropdown-menu-group"',
|
|
11
12
|
'[attr.role]': '"group"',
|
|
12
13
|
},
|
|
13
14
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -10,6 +10,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
10
10
|
selector: 'DropdownMenuItem',
|
|
11
11
|
template: `<ng-content />`,
|
|
12
12
|
host: {
|
|
13
|
+
'attr.data-slot': '"dropdown-menu-item"',
|
|
13
14
|
'[class]': 'computedClass()',
|
|
14
15
|
'[attr.role]': '"menuitem"',
|
|
15
16
|
'[attr.tabindex]': 'disabled() ? -1 : 0',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuLabel',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-label"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -20,6 +20,7 @@ import { DROPDOWN_MENU_RADIO_GROUP_CONTEXT } from './dropdown-menu-radio-group.c
|
|
|
20
20
|
<ng-content />
|
|
21
21
|
`,
|
|
22
22
|
host: {
|
|
23
|
+
'attr.data-slot': '"dropdown-menu-radio-item"',
|
|
23
24
|
'[class]': 'computedClass()',
|
|
24
25
|
'[attr.role]': '"menuitemradio"',
|
|
25
26
|
'[attr.aria-checked]': 'isSelected()',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuSeparator',
|
|
10
10
|
template: ``,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-separator"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
'[attr.role]': '"separator"',
|
|
14
15
|
},
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'DropdownMenuShortcut',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-shortcut"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -15,6 +15,7 @@ import { DROPDOWN_MENU_SUB_CONTEXT } from './dropdown-menu-sub.component';
|
|
|
15
15
|
<lucide-icon [img]="ChevronRightIcon" class="ml-auto h-4 w-4" />
|
|
16
16
|
`,
|
|
17
17
|
host: {
|
|
18
|
+
'attr.data-slot': '"dropdown-menu-sub-trigger"',
|
|
18
19
|
'[class]': 'computedClass()',
|
|
19
20
|
'(mouseenter)': 'onMouseEnter()',
|
|
20
21
|
'(mouseleave)': 'onMouseLeave()',
|
|
@@ -33,7 +34,7 @@ export class DropdownMenuSubTrigger {
|
|
|
33
34
|
|
|
34
35
|
protected readonly computedClass = computed(() =>
|
|
35
36
|
cn(
|
|
36
|
-
'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&>svg]:size-4 [&>svg]:shrink-0',
|
|
37
|
+
'flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&>svg]:size-4 [&>svg]:shrink-0 [&>lucide-icon]:size-4 [&>lucide-icon]:shrink-0',
|
|
37
38
|
this.inset() && 'pl-8',
|
|
38
39
|
this.class(),
|
|
39
40
|
),
|
|
@@ -9,6 +9,7 @@ import { DROPDOWN_MENU_CONTEXT } from './dropdown-menu-context';
|
|
|
9
9
|
selector: 'DropdownMenuTrigger',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"dropdown-menu-trigger"',
|
|
12
13
|
class: 'cursor-pointer',
|
|
13
14
|
'(click)': 'toggle()',
|
|
14
15
|
'(keydown)': 'onKeyDown($event)',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'InputOTPGroup',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"input-otp-group"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -27,6 +27,7 @@ import { MENUBAR_CONTEXT, MENUBAR_MENU_CONTEXT } from './menubar-context';
|
|
|
27
27
|
<ng-content />
|
|
28
28
|
`,
|
|
29
29
|
host: {
|
|
30
|
+
'attr.data-slot': '"menubar-checkbox-item"',
|
|
30
31
|
'[class]': 'computedClass()',
|
|
31
32
|
'[attr.role]': '"menuitemcheckbox"',
|
|
32
33
|
'[attr.aria-checked]': 'checked()',
|
|
@@ -35,6 +35,7 @@ import { MENUBAR_CONTEXT, MENUBAR_MENU_CONTEXT } from './menubar-context';
|
|
|
35
35
|
</Presence>
|
|
36
36
|
`,
|
|
37
37
|
host: {
|
|
38
|
+
'attr.data-slot': '"menubar-content"',
|
|
38
39
|
class: 'contents',
|
|
39
40
|
'(document:click)': 'onDocumentClick($event)',
|
|
40
41
|
'(document:keydown.escape)': 'onEscapeKey()',
|
|
@@ -11,6 +11,7 @@ import { MENUBAR_CONTEXT, MENUBAR_MENU_CONTEXT } from './menubar-context';
|
|
|
11
11
|
selector: 'MenubarItem',
|
|
12
12
|
template: `<ng-content />`,
|
|
13
13
|
host: {
|
|
14
|
+
'attr.data-slot': '"menubar-item"',
|
|
14
15
|
'[class]': 'computedClass()',
|
|
15
16
|
'[attr.role]': '"menuitem"',
|
|
16
17
|
'[attr.tabindex]': 'disabled() ? -1 : -1',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'MenubarLabel',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"menubar-label"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -19,6 +19,7 @@ import { MENUBAR_RADIO_GROUP_CONTEXT } from './menubar-radio-group.component';
|
|
|
19
19
|
<ng-content />
|
|
20
20
|
`,
|
|
21
21
|
host: {
|
|
22
|
+
'attr.data-slot': '"menubar-radio-item"',
|
|
22
23
|
'[class]': 'computedClass()',
|
|
23
24
|
'[attr.role]': '"menuitemradio"',
|
|
24
25
|
'[attr.aria-checked]': 'isSelected()',
|
|
@@ -9,6 +9,7 @@ import { ChangeDetectionStrategy, Component, computed, input } from '@angular/co
|
|
|
9
9
|
selector: 'MenubarShortcut',
|
|
10
10
|
template: `<ng-content />`,
|
|
11
11
|
host: {
|
|
12
|
+
'attr.data-slot': '"menubar-shortcut"',
|
|
12
13
|
'[class]': 'computedClass()',
|
|
13
14
|
},
|
|
14
15
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
@@ -15,6 +15,7 @@ import { MENUBAR_SUB_CONTEXT } from './menubar-sub.component';
|
|
|
15
15
|
<lucide-icon [img]="ChevronRightIcon" class="ml-auto h-4 w-4" />
|
|
16
16
|
`,
|
|
17
17
|
host: {
|
|
18
|
+
'attr.data-slot': '"menubar-sub-trigger"',
|
|
18
19
|
'[class]': 'computedClass()',
|
|
19
20
|
'[attr.data-state]': 'subContext.open() ? "open" : "closed"',
|
|
20
21
|
'(mouseenter)': 'onMouseEnter()',
|
|
@@ -19,6 +19,7 @@ import { MENUBAR_CONTEXT, MENUBAR_MENU_CONTEXT } from './menubar-context';
|
|
|
19
19
|
selector: 'MenubarTrigger',
|
|
20
20
|
template: `<ng-content />`,
|
|
21
21
|
host: {
|
|
22
|
+
'attr.data-slot': '"menubar-trigger"',
|
|
22
23
|
'[class]': 'computedClass()',
|
|
23
24
|
'[attr.role]': '"menuitem"',
|
|
24
25
|
'[attr.tabindex]': 'isFocused() ? 0 : -1',
|
|
@@ -42,7 +42,7 @@ import { nativeSelectVariants, type NativeSelectVariants } from './native-select
|
|
|
42
42
|
template: `<ng-content />`,
|
|
43
43
|
host: {
|
|
44
44
|
'[class]': 'computedClass()',
|
|
45
|
-
'data-slot': 'native-select',
|
|
45
|
+
'attr.data-slot': '"native-select"',
|
|
46
46
|
},
|
|
47
47
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
48
|
})
|