@loomui-ng/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +46 -2
- package/accordion/README.md +38 -0
- package/alert/README.md +32 -0
- package/alert-dialog/README.md +37 -0
- package/aspect-ratio/README.md +24 -0
- package/attachment/README.md +40 -0
- package/avatar/README.md +34 -0
- package/badge/README.md +29 -0
- package/breadcrumb/README.md +33 -0
- package/bubble/README.md +32 -0
- package/button/README.md +31 -0
- package/button-group/README.md +30 -0
- package/calendar/README.md +35 -0
- package/card/README.md +41 -0
- package/carousel/README.md +41 -0
- package/chart/README.md +25 -0
- package/checkbox/README.md +31 -0
- package/collapsible/README.md +31 -0
- package/combobox/README.md +47 -0
- package/command/README.md +44 -0
- package/context-menu/README.md +36 -0
- package/data-table/README.md +39 -0
- package/date-picker/README.md +23 -0
- package/dialog/README.md +52 -0
- package/direction/README.md +19 -0
- package/drawer/README.md +37 -0
- package/dropdown-menu/README.md +46 -0
- package/empty/README.md +38 -0
- package/fesm2022/loomui-ng-ui-accordion.mjs +555 -0
- package/fesm2022/loomui-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-alert-dialog.mjs +652 -0
- package/fesm2022/loomui-ng-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-alert.mjs +286 -0
- package/fesm2022/loomui-ng-ui-alert.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-aspect-ratio.mjs +97 -0
- package/fesm2022/loomui-ng-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-attachment.mjs +713 -0
- package/fesm2022/loomui-ng-ui-attachment.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-avatar.mjs +561 -0
- package/fesm2022/loomui-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-badge.mjs +102 -0
- package/fesm2022/loomui-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-breadcrumb.mjs +520 -0
- package/fesm2022/loomui-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-bubble.mjs +386 -0
- package/fesm2022/loomui-ng-ui-bubble.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-button-group.mjs +193 -0
- package/fesm2022/loomui-ng-ui-button-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-button.mjs +162 -0
- package/fesm2022/loomui-ng-ui-button.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-calendar.mjs +681 -0
- package/fesm2022/loomui-ng-ui-calendar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-card.mjs +461 -0
- package/fesm2022/loomui-ng-ui-card.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-carousel.mjs +532 -0
- package/fesm2022/loomui-ng-ui-carousel.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-chart.mjs +373 -0
- package/fesm2022/loomui-ng-ui-chart.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-checkbox.mjs +265 -0
- package/fesm2022/loomui-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-collapsible.mjs +274 -0
- package/fesm2022/loomui-ng-ui-collapsible.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-combobox.mjs +971 -0
- package/fesm2022/loomui-ng-ui-combobox.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-command.mjs +982 -0
- package/fesm2022/loomui-ng-ui-command.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-context-menu.mjs +1359 -0
- package/fesm2022/loomui-ng-ui-context-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-data-table.mjs +535 -0
- package/fesm2022/loomui-ng-ui-data-table.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-date-picker.mjs +312 -0
- package/fesm2022/loomui-ng-ui-date-picker.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-dialog.mjs +508 -0
- package/fesm2022/loomui-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-direction.mjs +112 -0
- package/fesm2022/loomui-ng-ui-direction.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-drawer.mjs +590 -0
- package/fesm2022/loomui-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-dropdown-menu.mjs +1322 -0
- package/fesm2022/loomui-ng-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-empty.mjs +408 -0
- package/fesm2022/loomui-ng-ui-empty.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-field.mjs +630 -0
- package/fesm2022/loomui-ng-ui-field.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-hover-card.mjs +230 -0
- package/fesm2022/loomui-ng-ui-hover-card.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-icon.mjs +498 -0
- package/fesm2022/loomui-ng-ui-icon.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input-group.mjs +463 -0
- package/fesm2022/loomui-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input-otp.mjs +586 -0
- package/fesm2022/loomui-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-input.mjs +289 -0
- package/fesm2022/loomui-ng-ui-input.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-item.mjs +598 -0
- package/fesm2022/loomui-ng-ui-item.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-kbd.mjs +129 -0
- package/fesm2022/loomui-ng-ui-kbd.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-label.mjs +68 -0
- package/fesm2022/loomui-ng-ui-label.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-marker.mjs +234 -0
- package/fesm2022/loomui-ng-ui-marker.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-menubar.mjs +1523 -0
- package/fesm2022/loomui-ng-ui-menubar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-message-scroller.mjs +519 -0
- package/fesm2022/loomui-ng-ui-message-scroller.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-message.mjs +408 -0
- package/fesm2022/loomui-ng-ui-message.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-native-select.mjs +389 -0
- package/fesm2022/loomui-ng-ui-native-select.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-navigation-menu.mjs +609 -0
- package/fesm2022/loomui-ng-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-pagination.mjs +611 -0
- package/fesm2022/loomui-ng-ui-pagination.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-popover.mjs +358 -0
- package/fesm2022/loomui-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-progress.mjs +159 -0
- package/fesm2022/loomui-ng-ui-progress.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-questionnaire.mjs +1012 -0
- package/fesm2022/loomui-ng-ui-questionnaire.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-radio-group.mjs +399 -0
- package/fesm2022/loomui-ng-ui-radio-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-resizable.mjs +518 -0
- package/fesm2022/loomui-ng-ui-resizable.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-scroll-area.mjs +135 -0
- package/fesm2022/loomui-ng-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-select.mjs +863 -0
- package/fesm2022/loomui-ng-ui-select.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-separator.mjs +114 -0
- package/fesm2022/loomui-ng-ui-separator.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-sheet.mjs +530 -0
- package/fesm2022/loomui-ng-ui-sheet.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-sidebar.mjs +1918 -0
- package/fesm2022/loomui-ng-ui-sidebar.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-skeleton.mjs +69 -0
- package/fesm2022/loomui-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-slider.mjs +390 -0
- package/fesm2022/loomui-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-spinner.mjs +85 -0
- package/fesm2022/loomui-ng-ui-spinner.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-switch.mjs +212 -0
- package/fesm2022/loomui-ng-ui-switch.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-table.mjs +559 -0
- package/fesm2022/loomui-ng-ui-table.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-tabs.mjs +544 -0
- package/fesm2022/loomui-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-textarea.mjs +206 -0
- package/fesm2022/loomui-ng-ui-textarea.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toast.mjs +432 -0
- package/fesm2022/loomui-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toggle-group.mjs +477 -0
- package/fesm2022/loomui-ng-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-toggle.mjs +219 -0
- package/fesm2022/loomui-ng-ui-toggle.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-tooltip.mjs +240 -0
- package/fesm2022/loomui-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-typography.mjs +129 -0
- package/fesm2022/loomui-ng-ui-typography.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui-utils.mjs +1533 -0
- package/fesm2022/loomui-ng-ui-utils.mjs.map +1 -0
- package/fesm2022/loomui-ng-ui.mjs +4 -0
- package/fesm2022/loomui-ng-ui.mjs.map +1 -0
- package/field/README.md +43 -0
- package/hover-card/README.md +31 -0
- package/icon/README.md +42 -0
- package/input/README.md +26 -0
- package/input-group/README.md +40 -0
- package/input-otp/README.md +35 -0
- package/item/README.md +33 -0
- package/kbd/README.md +21 -0
- package/label/README.md +24 -0
- package/marker/README.md +24 -0
- package/menubar/README.md +40 -0
- package/message/README.md +32 -0
- package/message-scroller/README.md +40 -0
- package/native-select/README.md +26 -0
- package/navigation-menu/README.md +39 -0
- package/package.json +325 -3
- package/pagination/README.md +37 -0
- package/popover/README.md +37 -0
- package/progress/README.md +25 -0
- package/questionnaire/README.md +52 -0
- package/radio-group/README.md +33 -0
- package/resizable/README.md +37 -0
- package/scroll-area/README.md +25 -0
- package/select/README.md +45 -0
- package/separator/README.md +28 -0
- package/sheet/README.md +38 -0
- package/sidebar/README.md +60 -0
- package/skeleton/README.md +21 -0
- package/slider/README.md +29 -0
- package/spinner/README.md +15 -0
- package/styles/loomui.css +330 -0
- package/switch/README.md +29 -0
- package/table/README.md +31 -0
- package/tabs/README.md +42 -0
- package/textarea/README.md +28 -0
- package/toast/README.md +27 -0
- package/toggle/README.md +27 -0
- package/toggle-group/README.md +37 -0
- package/tooltip/README.md +31 -0
- package/types/loomui-ng-ui-accordion.d.ts +141 -0
- package/types/loomui-ng-ui-alert-dialog.d.ts +175 -0
- package/types/loomui-ng-ui-alert.d.ts +77 -0
- package/types/loomui-ng-ui-aspect-ratio.d.ts +31 -0
- package/types/loomui-ng-ui-attachment.d.ts +192 -0
- package/types/loomui-ng-ui-avatar.d.ts +147 -0
- package/types/loomui-ng-ui-badge.d.ts +32 -0
- package/types/loomui-ng-ui-breadcrumb.d.ts +118 -0
- package/types/loomui-ng-ui-bubble.d.ts +100 -0
- package/types/loomui-ng-ui-button-group.d.ts +51 -0
- package/types/loomui-ng-ui-button.d.ts +57 -0
- package/types/loomui-ng-ui-calendar.d.ts +171 -0
- package/types/loomui-ng-ui-card.d.ts +123 -0
- package/types/loomui-ng-ui-carousel.d.ts +140 -0
- package/types/loomui-ng-ui-chart.d.ts +95 -0
- package/types/loomui-ng-ui-checkbox.d.ts +62 -0
- package/types/loomui-ng-ui-collapsible.d.ts +74 -0
- package/types/loomui-ng-ui-combobox.d.ts +229 -0
- package/types/loomui-ng-ui-command.d.ts +231 -0
- package/types/loomui-ng-ui-context-menu.d.ts +288 -0
- package/types/loomui-ng-ui-data-table.d.ts +111 -0
- package/types/loomui-ng-ui-date-picker.d.ts +63 -0
- package/types/loomui-ng-ui-dialog.d.ts +127 -0
- package/types/loomui-ng-ui-direction.d.ts +42 -0
- package/types/loomui-ng-ui-drawer.d.ts +149 -0
- package/types/loomui-ng-ui-dropdown-menu.d.ts +258 -0
- package/types/loomui-ng-ui-empty.d.ts +109 -0
- package/types/loomui-ng-ui-field.d.ts +169 -0
- package/types/loomui-ng-ui-hover-card.d.ts +62 -0
- package/types/loomui-ng-ui-icon.d.ts +156 -0
- package/types/loomui-ng-ui-input-group.d.ts +130 -0
- package/types/loomui-ng-ui-input-otp.d.ts +149 -0
- package/types/loomui-ng-ui-input.d.ts +89 -0
- package/types/loomui-ng-ui-item.d.ts +157 -0
- package/types/loomui-ng-ui-kbd.d.ts +36 -0
- package/types/loomui-ng-ui-label.d.ts +19 -0
- package/types/loomui-ng-ui-marker.d.ts +61 -0
- package/types/loomui-ng-ui-menubar.d.ts +321 -0
- package/types/loomui-ng-ui-message-scroller.d.ts +138 -0
- package/types/loomui-ng-ui-message.d.ts +109 -0
- package/types/loomui-ng-ui-native-select.d.ts +84 -0
- package/types/loomui-ng-ui-navigation-menu.d.ts +160 -0
- package/types/loomui-ng-ui-pagination.d.ts +130 -0
- package/types/loomui-ng-ui-popover.d.ts +90 -0
- package/types/loomui-ng-ui-progress.d.ts +39 -0
- package/types/loomui-ng-ui-questionnaire.d.ts +274 -0
- package/types/loomui-ng-ui-radio-group.d.ts +109 -0
- package/types/loomui-ng-ui-resizable.d.ts +121 -0
- package/types/loomui-ng-ui-scroll-area.d.ts +44 -0
- package/types/loomui-ng-ui-select.d.ts +204 -0
- package/types/loomui-ng-ui-separator.d.ts +35 -0
- package/types/loomui-ng-ui-sheet.d.ts +124 -0
- package/types/loomui-ng-ui-sidebar.d.ts +485 -0
- package/types/loomui-ng-ui-skeleton.d.ts +20 -0
- package/types/loomui-ng-ui-slider.d.ts +103 -0
- package/types/loomui-ng-ui-spinner.d.ts +19 -0
- package/types/loomui-ng-ui-switch.d.ts +56 -0
- package/types/loomui-ng-ui-table.d.ts +148 -0
- package/types/loomui-ng-ui-tabs.d.ts +148 -0
- package/types/loomui-ng-ui-textarea.d.ts +52 -0
- package/types/loomui-ng-ui-toast.d.ts +97 -0
- package/types/loomui-ng-ui-toggle-group.d.ts +138 -0
- package/types/loomui-ng-ui-toggle.d.ts +63 -0
- package/types/loomui-ng-ui-tooltip.d.ts +63 -0
- package/types/loomui-ng-ui-typography.d.ts +42 -0
- package/types/loomui-ng-ui-utils.d.ts +392 -0
- package/types/loomui-ng-ui.d.ts +5 -0
- package/typography/README.md +29 -0
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Directive, ElementRef, booleanAttribute, computed, inject, input } from "@angular/core";
|
|
3
|
+
import { buttonVariants } from "@loomui-ng/ui/button";
|
|
4
|
+
import * as i1 from "@loomui-ng/ui/utils";
|
|
5
|
+
import { UiElementHost, UiModalContentBase, UiModalRoot, cn } from "@loomui-ng/ui/utils";
|
|
6
|
+
import { LIB_ICONS, iconToSvg } from "@loomui-ng/ui/icon";
|
|
7
|
+
const OVERLAY_CLASS = "fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0";
|
|
8
|
+
const CONTENT_CLASS = "fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 sm:max-w-sm";
|
|
9
|
+
var UiDialog = class UiDialog extends UiModalRoot {
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
11
|
+
minVersion: "12.0.0",
|
|
12
|
+
version: "22.2.2",
|
|
13
|
+
ngImport: i0,
|
|
14
|
+
type: UiDialog,
|
|
15
|
+
deps: null,
|
|
16
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
17
|
+
});
|
|
18
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
19
|
+
minVersion: "14.0.0",
|
|
20
|
+
version: "22.2.2",
|
|
21
|
+
type: UiDialog,
|
|
22
|
+
isStandalone: true,
|
|
23
|
+
selector: "[uiDialog], ui-dialog",
|
|
24
|
+
exportAs: ["uiDialog"],
|
|
25
|
+
usesInheritance: true,
|
|
26
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
27
|
+
ngImport: i0
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
31
|
+
minVersion: "12.0.0",
|
|
32
|
+
version: "22.2.2",
|
|
33
|
+
ngImport: i0,
|
|
34
|
+
type: UiDialog,
|
|
35
|
+
decorators: [{
|
|
36
|
+
type: Directive,
|
|
37
|
+
args: [{
|
|
38
|
+
selector: "[uiDialog], ui-dialog",
|
|
39
|
+
hostDirectives: [UiElementHost],
|
|
40
|
+
exportAs: "uiDialog"
|
|
41
|
+
}]
|
|
42
|
+
}]
|
|
43
|
+
});
|
|
44
|
+
var UiDialogTrigger = class UiDialogTrigger {
|
|
45
|
+
root = inject(UiDialog);
|
|
46
|
+
constructor() {
|
|
47
|
+
this.root.trigger.set(inject(ElementRef).nativeElement);
|
|
48
|
+
}
|
|
49
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
50
|
+
minVersion: "12.0.0",
|
|
51
|
+
version: "22.2.2",
|
|
52
|
+
ngImport: i0,
|
|
53
|
+
type: UiDialogTrigger,
|
|
54
|
+
deps: [],
|
|
55
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
56
|
+
});
|
|
57
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
58
|
+
minVersion: "14.0.0",
|
|
59
|
+
version: "22.2.2",
|
|
60
|
+
type: UiDialogTrigger,
|
|
61
|
+
isStandalone: true,
|
|
62
|
+
selector: "[uiDialogTrigger], ui-dialog-trigger",
|
|
63
|
+
host: {
|
|
64
|
+
attributes: {
|
|
65
|
+
"data-slot": "dialog-trigger",
|
|
66
|
+
"aria-haspopup": "dialog"
|
|
67
|
+
},
|
|
68
|
+
listeners: { "click": "root.toggle()" },
|
|
69
|
+
properties: {
|
|
70
|
+
"attr.aria-expanded": "root.open()",
|
|
71
|
+
"attr.aria-controls": "root.id",
|
|
72
|
+
"attr.data-state": "root.open() ? \"open\" : \"closed\""
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
76
|
+
ngImport: i0
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
80
|
+
minVersion: "12.0.0",
|
|
81
|
+
version: "22.2.2",
|
|
82
|
+
ngImport: i0,
|
|
83
|
+
type: UiDialogTrigger,
|
|
84
|
+
decorators: [{
|
|
85
|
+
type: Directive,
|
|
86
|
+
args: [{
|
|
87
|
+
selector: "[uiDialogTrigger], ui-dialog-trigger",
|
|
88
|
+
hostDirectives: [UiElementHost],
|
|
89
|
+
host: {
|
|
90
|
+
"data-slot": "dialog-trigger",
|
|
91
|
+
"aria-haspopup": "dialog",
|
|
92
|
+
"[attr.aria-expanded]": "root.open()",
|
|
93
|
+
"[attr.aria-controls]": "root.id",
|
|
94
|
+
"[attr.data-state]": "root.open() ? \"open\" : \"closed\"",
|
|
95
|
+
"(click)": "root.toggle()"
|
|
96
|
+
}
|
|
97
|
+
}]
|
|
98
|
+
}],
|
|
99
|
+
ctorParameters: () => []
|
|
100
|
+
});
|
|
101
|
+
var UiDialogContent = class UiDialogContent extends UiModalContentBase {
|
|
102
|
+
root = inject(UiDialog);
|
|
103
|
+
config = {
|
|
104
|
+
slot: "dialog",
|
|
105
|
+
backdropClass: OVERLAY_CLASS
|
|
106
|
+
};
|
|
107
|
+
showCloseButton = input(true, {
|
|
108
|
+
...ngDevMode ? { debugName: "showCloseButton" } : /* istanbul ignore next */ {},
|
|
109
|
+
transform: booleanAttribute
|
|
110
|
+
});
|
|
111
|
+
classes = computed(() => cn(CONTENT_CLASS, this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
112
|
+
constructor() {
|
|
113
|
+
super();
|
|
114
|
+
this.init();
|
|
115
|
+
queueMicrotask(() => {
|
|
116
|
+
if (this.showCloseButton()) this.el.appendChild(this.createCloseButton());
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
createCloseButton() {
|
|
120
|
+
const btn = document.createElement("button");
|
|
121
|
+
btn.type = "button";
|
|
122
|
+
btn.setAttribute("data-slot", "dialog-close");
|
|
123
|
+
btn.setAttribute("data-variant", "ghost");
|
|
124
|
+
btn.setAttribute("data-size", "icon-sm");
|
|
125
|
+
btn.className = cn(buttonVariants({
|
|
126
|
+
variant: "ghost",
|
|
127
|
+
size: "icon-sm"
|
|
128
|
+
}), "absolute end-2 top-2");
|
|
129
|
+
btn.innerHTML = iconToSvg(LIB_ICONS["X"], { size: 16 }).replace("<svg ", "<svg class=\"size-4\" aria-hidden=\"true\" ") + "<span class=\"sr-only\">Close</span>";
|
|
130
|
+
btn.addEventListener("click", () => this.root.close());
|
|
131
|
+
return btn;
|
|
132
|
+
}
|
|
133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
134
|
+
minVersion: "12.0.0",
|
|
135
|
+
version: "22.2.2",
|
|
136
|
+
ngImport: i0,
|
|
137
|
+
type: UiDialogContent,
|
|
138
|
+
deps: [],
|
|
139
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
140
|
+
});
|
|
141
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
142
|
+
minVersion: "17.1.0",
|
|
143
|
+
version: "22.2.2",
|
|
144
|
+
type: UiDialogContent,
|
|
145
|
+
isStandalone: true,
|
|
146
|
+
selector: "[uiDialogContent], ui-dialog-content",
|
|
147
|
+
inputs: { showCloseButton: {
|
|
148
|
+
classPropertyName: "showCloseButton",
|
|
149
|
+
publicName: "showCloseButton",
|
|
150
|
+
isSignal: true,
|
|
151
|
+
isRequired: false,
|
|
152
|
+
transformFunction: null
|
|
153
|
+
} },
|
|
154
|
+
host: {
|
|
155
|
+
attributes: {
|
|
156
|
+
"role": "dialog",
|
|
157
|
+
"data-slot": "dialog-content",
|
|
158
|
+
"tabindex": "-1"
|
|
159
|
+
},
|
|
160
|
+
properties: {
|
|
161
|
+
"id": "root.id",
|
|
162
|
+
"attr.aria-labelledby": "root.titleId",
|
|
163
|
+
"attr.aria-describedby": "root.descriptionId",
|
|
164
|
+
"attr.data-state": "root.state()",
|
|
165
|
+
"attr.class": "classes()"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
usesInheritance: true,
|
|
169
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
170
|
+
ngImport: i0
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
174
|
+
minVersion: "12.0.0",
|
|
175
|
+
version: "22.2.2",
|
|
176
|
+
ngImport: i0,
|
|
177
|
+
type: UiDialogContent,
|
|
178
|
+
decorators: [{
|
|
179
|
+
type: Directive,
|
|
180
|
+
args: [{
|
|
181
|
+
selector: "[uiDialogContent], ui-dialog-content",
|
|
182
|
+
hostDirectives: [UiElementHost],
|
|
183
|
+
host: {
|
|
184
|
+
role: "dialog",
|
|
185
|
+
"data-slot": "dialog-content",
|
|
186
|
+
tabindex: "-1",
|
|
187
|
+
"[id]": "root.id",
|
|
188
|
+
"[attr.aria-labelledby]": "root.titleId",
|
|
189
|
+
"[attr.aria-describedby]": "root.descriptionId",
|
|
190
|
+
"[attr.data-state]": "root.state()",
|
|
191
|
+
"[attr.class]": "classes()"
|
|
192
|
+
}
|
|
193
|
+
}]
|
|
194
|
+
}],
|
|
195
|
+
ctorParameters: () => [],
|
|
196
|
+
propDecorators: { showCloseButton: [{
|
|
197
|
+
type: i0.Input,
|
|
198
|
+
args: [{
|
|
199
|
+
isSignal: true,
|
|
200
|
+
alias: "showCloseButton",
|
|
201
|
+
required: false
|
|
202
|
+
}]
|
|
203
|
+
}] }
|
|
204
|
+
});
|
|
205
|
+
var UiDialogHeader = class UiDialogHeader {
|
|
206
|
+
userClass = input("", {
|
|
207
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
208
|
+
alias: "class"
|
|
209
|
+
});
|
|
210
|
+
classes = computed(() => cn("flex flex-col gap-2", this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
211
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
212
|
+
minVersion: "12.0.0",
|
|
213
|
+
version: "22.2.2",
|
|
214
|
+
ngImport: i0,
|
|
215
|
+
type: UiDialogHeader,
|
|
216
|
+
deps: [],
|
|
217
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
218
|
+
});
|
|
219
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
220
|
+
minVersion: "17.1.0",
|
|
221
|
+
version: "22.2.2",
|
|
222
|
+
type: UiDialogHeader,
|
|
223
|
+
isStandalone: true,
|
|
224
|
+
selector: "[uiDialogHeader], ui-dialog-header",
|
|
225
|
+
inputs: { userClass: {
|
|
226
|
+
classPropertyName: "userClass",
|
|
227
|
+
publicName: "class",
|
|
228
|
+
isSignal: true,
|
|
229
|
+
isRequired: false,
|
|
230
|
+
transformFunction: null
|
|
231
|
+
} },
|
|
232
|
+
host: {
|
|
233
|
+
attributes: { "data-slot": "dialog-header" },
|
|
234
|
+
properties: { "attr.class": "classes()" }
|
|
235
|
+
},
|
|
236
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
237
|
+
ngImport: i0
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
241
|
+
minVersion: "12.0.0",
|
|
242
|
+
version: "22.2.2",
|
|
243
|
+
ngImport: i0,
|
|
244
|
+
type: UiDialogHeader,
|
|
245
|
+
decorators: [{
|
|
246
|
+
type: Directive,
|
|
247
|
+
args: [{
|
|
248
|
+
selector: "[uiDialogHeader], ui-dialog-header",
|
|
249
|
+
hostDirectives: [UiElementHost],
|
|
250
|
+
host: {
|
|
251
|
+
"data-slot": "dialog-header",
|
|
252
|
+
"[attr.class]": "classes()"
|
|
253
|
+
}
|
|
254
|
+
}]
|
|
255
|
+
}],
|
|
256
|
+
propDecorators: { userClass: [{
|
|
257
|
+
type: i0.Input,
|
|
258
|
+
args: [{
|
|
259
|
+
isSignal: true,
|
|
260
|
+
alias: "class",
|
|
261
|
+
required: false
|
|
262
|
+
}]
|
|
263
|
+
}] }
|
|
264
|
+
});
|
|
265
|
+
var UiDialogFooter = class UiDialogFooter {
|
|
266
|
+
userClass = input("", {
|
|
267
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
268
|
+
alias: "class"
|
|
269
|
+
});
|
|
270
|
+
classes = computed(() => cn("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end", this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
272
|
+
minVersion: "12.0.0",
|
|
273
|
+
version: "22.2.2",
|
|
274
|
+
ngImport: i0,
|
|
275
|
+
type: UiDialogFooter,
|
|
276
|
+
deps: [],
|
|
277
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
278
|
+
});
|
|
279
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
280
|
+
minVersion: "17.1.0",
|
|
281
|
+
version: "22.2.2",
|
|
282
|
+
type: UiDialogFooter,
|
|
283
|
+
isStandalone: true,
|
|
284
|
+
selector: "[uiDialogFooter], ui-dialog-footer",
|
|
285
|
+
inputs: { userClass: {
|
|
286
|
+
classPropertyName: "userClass",
|
|
287
|
+
publicName: "class",
|
|
288
|
+
isSignal: true,
|
|
289
|
+
isRequired: false,
|
|
290
|
+
transformFunction: null
|
|
291
|
+
} },
|
|
292
|
+
host: {
|
|
293
|
+
attributes: { "data-slot": "dialog-footer" },
|
|
294
|
+
properties: { "attr.class": "classes()" }
|
|
295
|
+
},
|
|
296
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
297
|
+
ngImport: i0
|
|
298
|
+
});
|
|
299
|
+
};
|
|
300
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
301
|
+
minVersion: "12.0.0",
|
|
302
|
+
version: "22.2.2",
|
|
303
|
+
ngImport: i0,
|
|
304
|
+
type: UiDialogFooter,
|
|
305
|
+
decorators: [{
|
|
306
|
+
type: Directive,
|
|
307
|
+
args: [{
|
|
308
|
+
selector: "[uiDialogFooter], ui-dialog-footer",
|
|
309
|
+
hostDirectives: [UiElementHost],
|
|
310
|
+
host: {
|
|
311
|
+
"data-slot": "dialog-footer",
|
|
312
|
+
"[attr.class]": "classes()"
|
|
313
|
+
}
|
|
314
|
+
}]
|
|
315
|
+
}],
|
|
316
|
+
propDecorators: { userClass: [{
|
|
317
|
+
type: i0.Input,
|
|
318
|
+
args: [{
|
|
319
|
+
isSignal: true,
|
|
320
|
+
alias: "class",
|
|
321
|
+
required: false
|
|
322
|
+
}]
|
|
323
|
+
}] }
|
|
324
|
+
});
|
|
325
|
+
var UiDialogTitle = class UiDialogTitle {
|
|
326
|
+
root = inject(UiDialog);
|
|
327
|
+
userClass = input("", {
|
|
328
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
329
|
+
alias: "class"
|
|
330
|
+
});
|
|
331
|
+
classes = computed(() => cn("text-base leading-none font-medium", this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
332
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
333
|
+
minVersion: "12.0.0",
|
|
334
|
+
version: "22.2.2",
|
|
335
|
+
ngImport: i0,
|
|
336
|
+
type: UiDialogTitle,
|
|
337
|
+
deps: [],
|
|
338
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
339
|
+
});
|
|
340
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
341
|
+
minVersion: "17.1.0",
|
|
342
|
+
version: "22.2.2",
|
|
343
|
+
type: UiDialogTitle,
|
|
344
|
+
isStandalone: true,
|
|
345
|
+
selector: "[uiDialogTitle], ui-dialog-title",
|
|
346
|
+
inputs: { userClass: {
|
|
347
|
+
classPropertyName: "userClass",
|
|
348
|
+
publicName: "class",
|
|
349
|
+
isSignal: true,
|
|
350
|
+
isRequired: false,
|
|
351
|
+
transformFunction: null
|
|
352
|
+
} },
|
|
353
|
+
host: {
|
|
354
|
+
attributes: { "data-slot": "dialog-title" },
|
|
355
|
+
properties: {
|
|
356
|
+
"id": "root.titleId",
|
|
357
|
+
"attr.class": "classes()"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
361
|
+
ngImport: i0
|
|
362
|
+
});
|
|
363
|
+
};
|
|
364
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
365
|
+
minVersion: "12.0.0",
|
|
366
|
+
version: "22.2.2",
|
|
367
|
+
ngImport: i0,
|
|
368
|
+
type: UiDialogTitle,
|
|
369
|
+
decorators: [{
|
|
370
|
+
type: Directive,
|
|
371
|
+
args: [{
|
|
372
|
+
selector: "[uiDialogTitle], ui-dialog-title",
|
|
373
|
+
hostDirectives: [UiElementHost],
|
|
374
|
+
host: {
|
|
375
|
+
"data-slot": "dialog-title",
|
|
376
|
+
"[id]": "root.titleId",
|
|
377
|
+
"[attr.class]": "classes()"
|
|
378
|
+
}
|
|
379
|
+
}]
|
|
380
|
+
}],
|
|
381
|
+
propDecorators: { userClass: [{
|
|
382
|
+
type: i0.Input,
|
|
383
|
+
args: [{
|
|
384
|
+
isSignal: true,
|
|
385
|
+
alias: "class",
|
|
386
|
+
required: false
|
|
387
|
+
}]
|
|
388
|
+
}] }
|
|
389
|
+
});
|
|
390
|
+
var UiDialogDescription = class UiDialogDescription {
|
|
391
|
+
root = inject(UiDialog);
|
|
392
|
+
userClass = input("", {
|
|
393
|
+
...ngDevMode ? { debugName: "userClass" } : /* istanbul ignore next */ {},
|
|
394
|
+
alias: "class"
|
|
395
|
+
});
|
|
396
|
+
classes = computed(() => cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", this.userClass()), ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
397
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
398
|
+
minVersion: "12.0.0",
|
|
399
|
+
version: "22.2.2",
|
|
400
|
+
ngImport: i0,
|
|
401
|
+
type: UiDialogDescription,
|
|
402
|
+
deps: [],
|
|
403
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
404
|
+
});
|
|
405
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
406
|
+
minVersion: "17.1.0",
|
|
407
|
+
version: "22.2.2",
|
|
408
|
+
type: UiDialogDescription,
|
|
409
|
+
isStandalone: true,
|
|
410
|
+
selector: "[uiDialogDescription], ui-dialog-description",
|
|
411
|
+
inputs: { userClass: {
|
|
412
|
+
classPropertyName: "userClass",
|
|
413
|
+
publicName: "class",
|
|
414
|
+
isSignal: true,
|
|
415
|
+
isRequired: false,
|
|
416
|
+
transformFunction: null
|
|
417
|
+
} },
|
|
418
|
+
host: {
|
|
419
|
+
attributes: { "data-slot": "dialog-description" },
|
|
420
|
+
properties: {
|
|
421
|
+
"id": "root.descriptionId",
|
|
422
|
+
"attr.class": "classes()"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
426
|
+
ngImport: i0
|
|
427
|
+
});
|
|
428
|
+
};
|
|
429
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
430
|
+
minVersion: "12.0.0",
|
|
431
|
+
version: "22.2.2",
|
|
432
|
+
ngImport: i0,
|
|
433
|
+
type: UiDialogDescription,
|
|
434
|
+
decorators: [{
|
|
435
|
+
type: Directive,
|
|
436
|
+
args: [{
|
|
437
|
+
selector: "[uiDialogDescription], ui-dialog-description",
|
|
438
|
+
hostDirectives: [UiElementHost],
|
|
439
|
+
host: {
|
|
440
|
+
"data-slot": "dialog-description",
|
|
441
|
+
"[id]": "root.descriptionId",
|
|
442
|
+
"[attr.class]": "classes()"
|
|
443
|
+
}
|
|
444
|
+
}]
|
|
445
|
+
}],
|
|
446
|
+
propDecorators: { userClass: [{
|
|
447
|
+
type: i0.Input,
|
|
448
|
+
args: [{
|
|
449
|
+
isSignal: true,
|
|
450
|
+
alias: "class",
|
|
451
|
+
required: false
|
|
452
|
+
}]
|
|
453
|
+
}] }
|
|
454
|
+
});
|
|
455
|
+
var UiDialogClose = class UiDialogClose {
|
|
456
|
+
root = inject(UiDialog);
|
|
457
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
458
|
+
minVersion: "12.0.0",
|
|
459
|
+
version: "22.2.2",
|
|
460
|
+
ngImport: i0,
|
|
461
|
+
type: UiDialogClose,
|
|
462
|
+
deps: [],
|
|
463
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
464
|
+
});
|
|
465
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
466
|
+
minVersion: "14.0.0",
|
|
467
|
+
version: "22.2.2",
|
|
468
|
+
type: UiDialogClose,
|
|
469
|
+
isStandalone: true,
|
|
470
|
+
selector: "[uiDialogClose], ui-dialog-close",
|
|
471
|
+
host: {
|
|
472
|
+
attributes: { "data-slot": "dialog-close" },
|
|
473
|
+
listeners: { "click": "root.close()" }
|
|
474
|
+
},
|
|
475
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
476
|
+
ngImport: i0
|
|
477
|
+
});
|
|
478
|
+
};
|
|
479
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
480
|
+
minVersion: "12.0.0",
|
|
481
|
+
version: "22.2.2",
|
|
482
|
+
ngImport: i0,
|
|
483
|
+
type: UiDialogClose,
|
|
484
|
+
decorators: [{
|
|
485
|
+
type: Directive,
|
|
486
|
+
args: [{
|
|
487
|
+
selector: "[uiDialogClose], ui-dialog-close",
|
|
488
|
+
hostDirectives: [UiElementHost],
|
|
489
|
+
host: {
|
|
490
|
+
"data-slot": "dialog-close",
|
|
491
|
+
"(click)": "root.close()"
|
|
492
|
+
}
|
|
493
|
+
}]
|
|
494
|
+
}]
|
|
495
|
+
});
|
|
496
|
+
const UI_DIALOG = [
|
|
497
|
+
UiDialog,
|
|
498
|
+
UiDialogTrigger,
|
|
499
|
+
UiDialogContent,
|
|
500
|
+
UiDialogHeader,
|
|
501
|
+
UiDialogFooter,
|
|
502
|
+
UiDialogTitle,
|
|
503
|
+
UiDialogDescription,
|
|
504
|
+
UiDialogClose
|
|
505
|
+
];
|
|
506
|
+
export { UI_DIALOG, UiDialog, UiDialogClose, UiDialogContent, UiDialogDescription, UiDialogFooter, UiDialogHeader, UiDialogTitle, UiDialogTrigger };
|
|
507
|
+
|
|
508
|
+
//# sourceMappingURL=loomui-ng-ui-dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomui-ng-ui-dialog.mjs","names":[],"sources":["../../../libs/ui/dialog/dialog.ts"],"sourcesContent":["import { computed, Directive, ElementRef, inject, input, booleanAttribute } from '@angular/core';\nimport { buttonVariants } from '@loomui-ng/ui/button';\nimport { cn } from '@loomui-ng/ui/utils';\nimport { UiModalContentBase, UiModalRoot, type ModalContentConfig } from '@loomui-ng/ui/utils';\nimport { iconToSvg, LIB_ICONS } from '@loomui-ng/ui/icon';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\nconst OVERLAY_CLASS =\n 'fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0';\n\nconst CONTENT_CLASS =\n 'fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 sm:max-w-sm';\n\n/**\n * <div uiDialog [(open)]=\"open\">\n * <button uiButton uiDialogTrigger>Open</button>\n * <div uiDialogContent>…</div>\n * </div>\n * `uiDialog` renders no element of its own styling; it is a state holder. Content is moved to <body>\n * through a CDK overlay while open.\n */\n@Directive({ selector: '[uiDialog], ui-dialog', hostDirectives: [UiElementHost], exportAs: 'uiDialog' })\nexport class UiDialog extends UiModalRoot {}\n\n@Directive({\n selector: '[uiDialogTrigger], ui-dialog-trigger', hostDirectives: [UiElementHost],\n host: {\n 'data-slot': 'dialog-trigger',\n 'aria-haspopup': 'dialog',\n '[attr.aria-expanded]': 'root.open()',\n '[attr.aria-controls]': 'root.id',\n '[attr.data-state]': 'root.open() ? \"open\" : \"closed\"',\n '(click)': 'root.toggle()',\n },\n})\nexport class UiDialogTrigger {\n protected readonly root = inject(UiDialog);\n constructor() {\n this.root.trigger.set(inject<ElementRef<HTMLElement>>(ElementRef).nativeElement);\n }\n}\n\n@Directive({\n selector: '[uiDialogContent], ui-dialog-content', hostDirectives: [UiElementHost],\n host: {\n role: 'dialog',\n 'data-slot': 'dialog-content',\n tabindex: '-1',\n '[id]': 'root.id',\n '[attr.aria-labelledby]': 'root.titleId',\n '[attr.aria-describedby]': 'root.descriptionId',\n '[attr.data-state]': 'root.state()',\n '[attr.class]': 'classes()',\n },\n})\nexport class UiDialogContent extends UiModalContentBase {\n protected readonly root = inject(UiDialog);\n protected readonly config: ModalContentConfig = { slot: 'dialog', backdropClass: OVERLAY_CLASS };\n /** Built-in top-corner close button, like shadcn's `showCloseButton` (default true). */\n readonly showCloseButton = input(true, { transform: booleanAttribute });\n protected readonly classes = computed(() => cn(CONTENT_CLASS, this.userClass()));\n\n constructor() {\n super();\n this.init();\n queueMicrotask(() => {\n if (this.showCloseButton()) this.el.appendChild(this.createCloseButton());\n });\n }\n\n private createCloseButton(): HTMLButtonElement {\n const btn = document.createElement('button');\n btn.type = 'button';\n btn.setAttribute('data-slot', 'dialog-close');\n btn.setAttribute('data-variant', 'ghost');\n btn.setAttribute('data-size', 'icon-sm');\n btn.className = cn(buttonVariants({ variant: 'ghost', size: 'icon-sm' }), 'absolute end-2 top-2');\n btn.innerHTML = iconToSvg(LIB_ICONS['X'], { size: 16 }).replace('<svg ', '<svg class=\"size-4\" aria-hidden=\"true\" ') + '<span class=\"sr-only\">Close</span>';\n btn.addEventListener('click', () => this.root.close());\n return btn;\n }\n}\n\n@Directive({\n selector: '[uiDialogHeader], ui-dialog-header', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'dialog-header', '[attr.class]': 'classes()' },\n})\nexport class UiDialogHeader {\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() => cn('flex flex-col gap-2', this.userClass()));\n}\n\n@Directive({\n selector: '[uiDialogFooter], ui-dialog-footer', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'dialog-footer', '[attr.class]': 'classes()' },\n})\nexport class UiDialogFooter {\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() =>\n cn('-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end', this.userClass()),\n );\n}\n\n@Directive({\n selector: '[uiDialogTitle], ui-dialog-title', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'dialog-title', '[id]': 'root.titleId', '[attr.class]': 'classes()' },\n})\nexport class UiDialogTitle {\n protected readonly root = inject(UiDialog);\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() => cn('text-base leading-none font-medium', this.userClass()));\n}\n\n@Directive({\n selector: '[uiDialogDescription], ui-dialog-description', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'dialog-description', '[id]': 'root.descriptionId', '[attr.class]': 'classes()' },\n})\nexport class UiDialogDescription {\n protected readonly root = inject(UiDialog);\n readonly userClass = input<string>('', { alias: 'class' });\n protected readonly classes = computed(() =>\n cn('text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground', this.userClass()),\n );\n}\n\n/** Any element/button inside the dialog that should close it. */\n@Directive({\n selector: '[uiDialogClose], ui-dialog-close', hostDirectives: [UiElementHost],\n host: { 'data-slot': 'dialog-close', '(click)': 'root.close()' },\n})\nexport class UiDialogClose {\n protected readonly root = inject(UiDialog);\n}\n\nexport const UI_DIALOG = [\n UiDialog,\n UiDialogTrigger,\n UiDialogContent,\n UiDialogHeader,\n UiDialogFooter,\n UiDialogTitle,\n UiDialogDescription,\n UiDialogClose,\n] as const;\n"],"mappings":";;;;;;AAOA,MAAM,gBACJ;AAEF,MAAM,gBACJ;AAWF,IAAa,WAAb,MAAa,iBAAiB,YAAW;CAA5B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAQ,MAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAR,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAQ,cAAA;EAAA,UAAA;EAAA,UAAA,CAAA,UAAA;EAAA,iBAAA;EAAA,gBAAA,CAAA,EAAA,WAAA,GAAA,cAAA,CAAA;EAAA,UAAA;CAAA,CAAA;;AAAR,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EADpB,MAAA;EAAU,MAAA,CAAA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|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { Directive, ElementRef, EventEmitter, computed, effect, forwardRef, inject, input } from "@angular/core";
|
|
4
|
+
import * as i1 from "@loomui-ng/ui/utils";
|
|
5
|
+
import { UiElementHost } from "@loomui-ng/ui/utils";
|
|
6
|
+
var UiDirection = class UiDirection {
|
|
7
|
+
attrDir = input("", {
|
|
8
|
+
...ngDevMode ? { debugName: "attrDir" } : /* istanbul ignore next */ {},
|
|
9
|
+
alias: "uiDirection"
|
|
10
|
+
});
|
|
11
|
+
elDir = input("", {
|
|
12
|
+
...ngDevMode ? { debugName: "elDir" } : /* istanbul ignore next */ {},
|
|
13
|
+
alias: "dir"
|
|
14
|
+
});
|
|
15
|
+
dir = computed(() => this.attrDir() || this.elDir() || "ltr", ...ngDevMode ? [{ debugName: "dir" }] : /* istanbul ignore next */ []);
|
|
16
|
+
change = new EventEmitter();
|
|
17
|
+
get value() {
|
|
18
|
+
return this.dir() === "rtl" ? "rtl" : "ltr";
|
|
19
|
+
}
|
|
20
|
+
el = inject(ElementRef).nativeElement;
|
|
21
|
+
constructor() {
|
|
22
|
+
effect(() => {
|
|
23
|
+
const d = this.value;
|
|
24
|
+
this.el.setAttribute("dir", d);
|
|
25
|
+
this.change.emit(d);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
ngOnDestroy() {
|
|
29
|
+
this.change.complete();
|
|
30
|
+
}
|
|
31
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
32
|
+
minVersion: "12.0.0",
|
|
33
|
+
version: "22.2.2",
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
type: UiDirection,
|
|
36
|
+
deps: [],
|
|
37
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
38
|
+
});
|
|
39
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
40
|
+
minVersion: "17.1.0",
|
|
41
|
+
version: "22.2.2",
|
|
42
|
+
type: UiDirection,
|
|
43
|
+
isStandalone: true,
|
|
44
|
+
selector: "[uiDirection], ui-direction",
|
|
45
|
+
inputs: {
|
|
46
|
+
attrDir: {
|
|
47
|
+
classPropertyName: "attrDir",
|
|
48
|
+
publicName: "uiDirection",
|
|
49
|
+
isSignal: true,
|
|
50
|
+
isRequired: false,
|
|
51
|
+
transformFunction: null
|
|
52
|
+
},
|
|
53
|
+
elDir: {
|
|
54
|
+
classPropertyName: "elDir",
|
|
55
|
+
publicName: "dir",
|
|
56
|
+
isSignal: true,
|
|
57
|
+
isRequired: false,
|
|
58
|
+
transformFunction: null
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
host: { properties: { "attr.dir": "dir()" } },
|
|
62
|
+
providers: [{
|
|
63
|
+
provide: Directionality,
|
|
64
|
+
useExisting: forwardRef(() => UiDirection)
|
|
65
|
+
}],
|
|
66
|
+
exportAs: ["uiDirection"],
|
|
67
|
+
hostDirectives: [{ directive: i1.UiElementHost }],
|
|
68
|
+
ngImport: i0
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
72
|
+
minVersion: "12.0.0",
|
|
73
|
+
version: "22.2.2",
|
|
74
|
+
ngImport: i0,
|
|
75
|
+
type: UiDirection,
|
|
76
|
+
decorators: [{
|
|
77
|
+
type: Directive,
|
|
78
|
+
args: [{
|
|
79
|
+
selector: "[uiDirection], ui-direction",
|
|
80
|
+
hostDirectives: [UiElementHost],
|
|
81
|
+
exportAs: "uiDirection",
|
|
82
|
+
providers: [{
|
|
83
|
+
provide: Directionality,
|
|
84
|
+
useExisting: forwardRef(() => UiDirection)
|
|
85
|
+
}],
|
|
86
|
+
host: { "[attr.dir]": "dir()" }
|
|
87
|
+
}]
|
|
88
|
+
}],
|
|
89
|
+
ctorParameters: () => [],
|
|
90
|
+
propDecorators: {
|
|
91
|
+
attrDir: [{
|
|
92
|
+
type: i0.Input,
|
|
93
|
+
args: [{
|
|
94
|
+
isSignal: true,
|
|
95
|
+
alias: "uiDirection",
|
|
96
|
+
required: false
|
|
97
|
+
}]
|
|
98
|
+
}],
|
|
99
|
+
elDir: [{
|
|
100
|
+
type: i0.Input,
|
|
101
|
+
args: [{
|
|
102
|
+
isSignal: true,
|
|
103
|
+
alias: "dir",
|
|
104
|
+
required: false
|
|
105
|
+
}]
|
|
106
|
+
}]
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
const UI_DIRECTION = [UiDirection];
|
|
110
|
+
export { UI_DIRECTION, UiDirection };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=loomui-ng-ui-direction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loomui-ng-ui-direction.mjs","names":[],"sources":["../../../libs/ui/direction/direction.ts"],"sourcesContent":["import { Directionality, type Direction } from '@angular/cdk/bidi';\nimport { computed, Directive, effect, ElementRef, EventEmitter, forwardRef, inject, input, OnDestroy } from '@angular/core';\nimport { UiElementHost } from '@loomui-ng/ui/utils';\n\n/**\n * shadcn's DirectionProvider (Radix) sets `dir` for a subtree so every primitive resolves layout/keyboard direction from it.\n * Here the provider sets the `dir` attribute and replaces CDK's `Directionality` for descendants, so all Loom UI components\n * (menus, tabs, carousel, calendar, sliders, overlays) follow the subtree direction instead of the document's.\n *\n * <div uiDirection=\"rtl\"> … </div>\n */\n@Directive({\n selector: '[uiDirection], ui-direction', hostDirectives: [UiElementHost],\n exportAs: 'uiDirection',\n providers: [{ provide: Directionality, useExisting: forwardRef(() => UiDirection) }],\n host: { '[attr.dir]': 'dir()' },\n})\nexport class UiDirection implements OnDestroy {\n /** Attribute form: `<div [uiDirection]=\"'rtl'\">`. */\n readonly attrDir = input<Direction | ''>('', { alias: 'uiDirection' });\n /** Element form: `<ui-direction dir=\"rtl\">`. */\n readonly elDir = input<Direction | ''>('', { alias: 'dir' });\n readonly dir = computed<Direction>(() => (this.attrDir() || this.elDir() || 'ltr') as Direction);\n readonly change = new EventEmitter<Direction>();\n /** Resolved value read by CDK consumers (`Directionality#value`). */\n get value(): Direction {\n return this.dir() === 'rtl' ? 'rtl' : 'ltr';\n }\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n constructor() {\n effect(() => {\n const d = this.value;\n this.el.setAttribute('dir', d);\n this.change.emit(d);\n });\n }\n ngOnDestroy(): void {\n this.change.complete();\n }\n}\n\nexport const UI_DIRECTION = [UiDirection] as const;\n"],"mappings":";;;;;AAiBA,IAAa,cAAb,MAAa,YAAW;CAEb,UAAU,MAAsB,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,OAAO;CAAa,CAAA;CAE1D,QAAQ,MAAsB,IAAE;EAAA,GAAA,YAAA,EAAA,WAAA,QAAA,+BAAA,CAAA;EAAI,OAAO;CAAK,CAAA;CAChD,MAAM,eAA2B,KAAK,QAAO,KAAM,KAAK,MAAK,KAAM,OAAoB,GAAA,YAAA,CAAA,EAAA,WAAA,MAAA,CAAA,+BAAA,CAAA,CAAA;CACvF,SAAS,IAAI,aAAY;CAElC,IAAI,QAAK;EACP,OAAO,KAAK,IAAG,MAAO,QAAQ,QAAQ;CACxC;CACiB,KAAK,OAAgC,UAAU,CAAC,CAAC;CAClE,cAAA;EACE,aAAY;GACV,MAAM,IAAI,KAAK;GACf,KAAK,GAAG,aAAa,OAAO,CAAC;GAC7B,KAAK,OAAO,KAAK,CAAC;EACpB,CAAC;CACH;CACA,cAAW;EACT,KAAK,OAAO,SAAQ;CACtB;CArBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAW,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IA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