@4sh/ui-kit 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 +201 -0
- package/NOTICE +7 -0
- package/README.md +229 -0
- package/fesm2022/4sh-ui-kit-forms.mjs +501 -0
- package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-motion.mjs +155 -0
- package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-overlay.mjs +61 -0
- package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-theming.mjs +120 -0
- package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-types.mjs +12 -0
- package/fesm2022/4sh-ui-kit-types.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-accordion.mjs +244 -0
- package/fesm2022/4sh-ui-kit-ui-accordion.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-alert.mjs +160 -0
- package/fesm2022/4sh-ui-kit-ui-alert.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs +926 -0
- package/fesm2022/4sh-ui-kit-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs +34 -0
- package/fesm2022/4sh-ui-kit-ui-avatar-group.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-avatar.mjs +122 -0
- package/fesm2022/4sh-ui-kit-ui-avatar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-badge.mjs +95 -0
- package/fesm2022/4sh-ui-kit-ui-badge.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs +190 -0
- package/fesm2022/4sh-ui-kit-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-button-split.mjs +151 -0
- package/fesm2022/4sh-ui-kit-ui-button-split.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-button.mjs +222 -0
- package/fesm2022/4sh-ui-kit-ui-button.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-card.mjs +164 -0
- package/fesm2022/4sh-ui-kit-ui-card.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-checkbox.mjs +118 -0
- package/fesm2022/4sh-ui-kit-ui-checkbox.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-chip.mjs +205 -0
- package/fesm2022/4sh-ui-kit-ui-chip.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-context-menu.mjs +219 -0
- package/fesm2022/4sh-ui-kit-ui-context-menu.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-datepicker.mjs +1508 -0
- package/fesm2022/4sh-ui-kit-ui-datepicker.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-drawer.mjs +300 -0
- package/fesm2022/4sh-ui-kit-ui-drawer.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-empty-state.mjs +148 -0
- package/fesm2022/4sh-ui-kit-ui-empty-state.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-field.mjs +102 -0
- package/fesm2022/4sh-ui-kit-ui-field.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-file-upload.mjs +568 -0
- package/fesm2022/4sh-ui-kit-ui-file-upload.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-helper.mjs +85 -0
- package/fesm2022/4sh-ui-kit-ui-helper.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-icon.mjs +98 -0
- package/fesm2022/4sh-ui-kit-ui-icon.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-image.mjs +201 -0
- package/fesm2022/4sh-ui-kit-ui-image.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-group.mjs +119 -0
- package/fesm2022/4sh-ui-kit-ui-input-group.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-mask.mjs +125 -0
- package/fesm2022/4sh-ui-kit-ui-input-mask.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-number.mjs +234 -0
- package/fesm2022/4sh-ui-kit-ui-input-number.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-otp.mjs +288 -0
- package/fesm2022/4sh-ui-kit-ui-input-otp.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input-tags.mjs +679 -0
- package/fesm2022/4sh-ui-kit-ui-input-tags.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-input.mjs +121 -0
- package/fesm2022/4sh-ui-kit-ui-input.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-label.mjs +61 -0
- package/fesm2022/4sh-ui-kit-ui-label.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-link.mjs +147 -0
- package/fesm2022/4sh-ui-kit-ui-link.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-menu.mjs +484 -0
- package/fesm2022/4sh-ui-kit-ui-menu.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-modal.mjs +555 -0
- package/fesm2022/4sh-ui-kit-ui-modal.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-nudger.mjs +168 -0
- package/fesm2022/4sh-ui-kit-ui-nudger.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-paginator.mjs +245 -0
- package/fesm2022/4sh-ui-kit-ui-paginator.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-popover.mjs +296 -0
- package/fesm2022/4sh-ui-kit-ui-popover.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs +124 -0
- package/fesm2022/4sh-ui-kit-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-radio.mjs +92 -0
- package/fesm2022/4sh-ui-kit-ui-radio.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-rating.mjs +185 -0
- package/fesm2022/4sh-ui-kit-ui-rating.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-read-only.mjs +146 -0
- package/fesm2022/4sh-ui-kit-ui-read-only.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-segment-control.mjs +386 -0
- package/fesm2022/4sh-ui-kit-ui-segment-control.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-select.mjs +868 -0
- package/fesm2022/4sh-ui-kit-ui-select.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-separator.mjs +77 -0
- package/fesm2022/4sh-ui-kit-ui-separator.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-sidebar.mjs +577 -0
- package/fesm2022/4sh-ui-kit-ui-sidebar.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-skeleton.mjs +81 -0
- package/fesm2022/4sh-ui-kit-ui-skeleton.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-slider.mjs +340 -0
- package/fesm2022/4sh-ui-kit-ui-slider.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-spinner.mjs +132 -0
- package/fesm2022/4sh-ui-kit-ui-spinner.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-stepper.mjs +389 -0
- package/fesm2022/4sh-ui-kit-ui-stepper.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-table.mjs +1406 -0
- package/fesm2022/4sh-ui-kit-ui-table.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tabs.mjs +503 -0
- package/fesm2022/4sh-ui-kit-ui-tabs.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tag.mjs +84 -0
- package/fesm2022/4sh-ui-kit-ui-tag.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-textarea.mjs +119 -0
- package/fesm2022/4sh-ui-kit-ui-textarea.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-toast.mjs +424 -0
- package/fesm2022/4sh-ui-kit-ui-toast.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-toggle.mjs +120 -0
- package/fesm2022/4sh-ui-kit-ui-toggle.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit-ui-tooltip.mjs +445 -0
- package/fesm2022/4sh-ui-kit-ui-tooltip.mjs.map +1 -0
- package/fesm2022/4sh-ui-kit.mjs +16 -0
- package/fesm2022/4sh-ui-kit.mjs.map +1 -0
- package/package.json +287 -0
- package/styles/base/_base.scss +19 -0
- package/styles/base/_motion.scss +144 -0
- package/styles/base/_typography.scss +99 -0
- package/styles/generated/_tokens-breakpoint.scss +8 -0
- package/styles/generated/_tokens-metrics.scss +37 -0
- package/styles/generated/_tokens-primitives.scss +284 -0
- package/styles/generated/_tokens-responsive.scss +99 -0
- package/styles/generated/_tokens-semantics.scss +1274 -0
- package/styles/generated/_tokens-styles.scss +35 -0
- package/styles/generated/_tokens-transitions.scss +11 -0
- package/styles/generated/_tokens-typography.scss +14 -0
- package/styles/generated/_tokens.scss +10 -0
- package/styles/index.scss +25 -0
- package/styles/settings/_ui-config.scss +67 -0
- package/styles/utils/_functions.scss +67 -0
- package/styles/utils/_helpers.scss +129 -0
- package/styles/utils/_mixins.scss +186 -0
- package/styles/utils/_motion.scss +47 -0
- package/styles/utils/_overlay.scss +26 -0
- package/styles/utils.scss +15 -0
- package/styles.css +1 -0
- package/types/4sh-ui-kit-forms.d.ts +259 -0
- package/types/4sh-ui-kit-motion.d.ts +111 -0
- package/types/4sh-ui-kit-overlay.d.ts +31 -0
- package/types/4sh-ui-kit-theming.d.ts +54 -0
- package/types/4sh-ui-kit-types.d.ts +13 -0
- package/types/4sh-ui-kit-ui-accordion.d.ts +140 -0
- package/types/4sh-ui-kit-ui-alert.d.ts +89 -0
- package/types/4sh-ui-kit-ui-autocomplete.d.ts +411 -0
- package/types/4sh-ui-kit-ui-avatar-group.d.ts +17 -0
- package/types/4sh-ui-kit-ui-avatar.d.ts +55 -0
- package/types/4sh-ui-kit-ui-badge.d.ts +38 -0
- package/types/4sh-ui-kit-ui-breadcrumb.d.ts +131 -0
- package/types/4sh-ui-kit-ui-button-split.d.ts +102 -0
- package/types/4sh-ui-kit-ui-button.d.ts +91 -0
- package/types/4sh-ui-kit-ui-card.d.ts +102 -0
- package/types/4sh-ui-kit-ui-checkbox.d.ts +54 -0
- package/types/4sh-ui-kit-ui-chip.d.ts +114 -0
- package/types/4sh-ui-kit-ui-context-menu.d.ts +105 -0
- package/types/4sh-ui-kit-ui-datepicker.d.ts +539 -0
- package/types/4sh-ui-kit-ui-drawer.d.ts +147 -0
- package/types/4sh-ui-kit-ui-empty-state.d.ts +93 -0
- package/types/4sh-ui-kit-ui-field.d.ts +53 -0
- package/types/4sh-ui-kit-ui-file-upload.d.ts +268 -0
- package/types/4sh-ui-kit-ui-helper.d.ts +46 -0
- package/types/4sh-ui-kit-ui-icon.d.ts +69 -0
- package/types/4sh-ui-kit-ui-image.d.ts +88 -0
- package/types/4sh-ui-kit-ui-input-group.d.ts +54 -0
- package/types/4sh-ui-kit-ui-input-mask.d.ts +63 -0
- package/types/4sh-ui-kit-ui-input-number.d.ts +96 -0
- package/types/4sh-ui-kit-ui-input-otp.d.ts +130 -0
- package/types/4sh-ui-kit-ui-input-tags.d.ts +350 -0
- package/types/4sh-ui-kit-ui-input.d.ts +78 -0
- package/types/4sh-ui-kit-ui-label.d.ts +36 -0
- package/types/4sh-ui-kit-ui-link.d.ts +72 -0
- package/types/4sh-ui-kit-ui-menu.d.ts +235 -0
- package/types/4sh-ui-kit-ui-modal.d.ts +241 -0
- package/types/4sh-ui-kit-ui-nudger.d.ts +79 -0
- package/types/4sh-ui-kit-ui-paginator.d.ts +150 -0
- package/types/4sh-ui-kit-ui-popover.d.ts +125 -0
- package/types/4sh-ui-kit-ui-progress-bar.d.ts +82 -0
- package/types/4sh-ui-kit-ui-radio.d.ts +44 -0
- package/types/4sh-ui-kit-ui-rating.d.ts +90 -0
- package/types/4sh-ui-kit-ui-read-only.d.ts +70 -0
- package/types/4sh-ui-kit-ui-segment-control.d.ts +184 -0
- package/types/4sh-ui-kit-ui-select.d.ts +392 -0
- package/types/4sh-ui-kit-ui-separator.d.ts +43 -0
- package/types/4sh-ui-kit-ui-sidebar.d.ts +358 -0
- package/types/4sh-ui-kit-ui-skeleton.d.ts +52 -0
- package/types/4sh-ui-kit-ui-slider.d.ts +127 -0
- package/types/4sh-ui-kit-ui-spinner.d.ts +67 -0
- package/types/4sh-ui-kit-ui-stepper.d.ts +220 -0
- package/types/4sh-ui-kit-ui-table.d.ts +570 -0
- package/types/4sh-ui-kit-ui-tabs.d.ts +225 -0
- package/types/4sh-ui-kit-ui-tag.d.ts +46 -0
- package/types/4sh-ui-kit-ui-textarea.d.ts +61 -0
- package/types/4sh-ui-kit-ui-toast.d.ts +247 -0
- package/types/4sh-ui-kit-ui-toggle.d.ts +67 -0
- package/types/4sh-ui-kit-ui-tooltip.d.ts +167 -0
- package/types/4sh-ui-kit.d.ts +4 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { model, input, booleanAttribute, numberAttribute, contentChild, output, viewChild, inject, PLATFORM_ID, signal, computed, DestroyRef, effect, untracked, isDevMode, Component } from '@angular/core';
|
|
3
|
+
import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
5
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
6
|
+
import { UiMotion } from '@4sh/ui-kit/motion';
|
|
7
|
+
import { UiIcon } from '@4sh/ui-kit/ui-icon';
|
|
8
|
+
|
|
9
|
+
/** Base stacking level — mirrors `$modal-z-index` in the SCSS. */
|
|
10
|
+
const MODAL_BASE_Z_INDEX = 1100;
|
|
11
|
+
/** Process-wide sequence so `autoZIndex` layers a later dialog above earlier ones. */
|
|
12
|
+
let zIndexSeq = 0;
|
|
13
|
+
/** Process-wide unique id source (aria wiring + responsive style scoping). */
|
|
14
|
+
let nextUid = 0;
|
|
15
|
+
// --- Body scroll lock (ref-counted, shared across nested dialogs) -------
|
|
16
|
+
let scrollLockCount = 0;
|
|
17
|
+
let savedOverflow = '';
|
|
18
|
+
let savedPaddingRight = '';
|
|
19
|
+
/** Freeze background scroll, compensating the scrollbar gutter to avoid a shift. */
|
|
20
|
+
function lockBodyScroll(doc) {
|
|
21
|
+
if (scrollLockCount === 0) {
|
|
22
|
+
const body = doc.body;
|
|
23
|
+
const gap = (doc.defaultView?.innerWidth ?? 0) - doc.documentElement.clientWidth;
|
|
24
|
+
savedOverflow = body.style.overflow;
|
|
25
|
+
savedPaddingRight = body.style.paddingRight;
|
|
26
|
+
body.style.overflow = 'hidden';
|
|
27
|
+
if (gap > 0)
|
|
28
|
+
body.style.paddingRight = `${gap}px`;
|
|
29
|
+
}
|
|
30
|
+
scrollLockCount++;
|
|
31
|
+
}
|
|
32
|
+
/** Release one scroll lock; restore the body when the last dialog closes. */
|
|
33
|
+
function unlockBodyScroll(doc) {
|
|
34
|
+
scrollLockCount = Math.max(0, scrollLockCount - 1);
|
|
35
|
+
if (scrollLockCount === 0) {
|
|
36
|
+
doc.body.style.overflow = savedOverflow;
|
|
37
|
+
doc.body.style.paddingRight = savedPaddingRight;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* ui-modal — headless dialog / modal window.
|
|
42
|
+
*
|
|
43
|
+
* A token-styled floating surface rendered over a viewport mask, driven by the
|
|
44
|
+
* two-way `visible` model. Enter/leave run through the shared motion system
|
|
45
|
+
* (mask fade + dialog `zoom` by default). Built for accessibility: focus trap
|
|
46
|
+
* with focus restore (`@angular/cdk/a11y`), `aria-modal`, background scroll
|
|
47
|
+
* lock, `Escape` to close, and an optional click-outside dismiss.
|
|
48
|
+
*
|
|
49
|
+
* Composes header / content / footer regions: a plain `header` string (or the
|
|
50
|
+
* `#header` template), the default `<ng-content>` for the body, and a `#footer`
|
|
51
|
+
* template for actions. Supports `draggable`, `maximizable`, nine `position`s,
|
|
52
|
+
* modal / non-modal, and per-breakpoint widths (`breakpoints`).
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```html
|
|
56
|
+
* <ui-button label="Ouvrir" (buttonClick)="open.set(true)" />
|
|
57
|
+
* <ui-modal [(visible)]="open" header="Titre" [dialogStyle]="{ width: '32rem' }">
|
|
58
|
+
* <p>Contenu…</p>
|
|
59
|
+
* <ng-template #footer>
|
|
60
|
+
* <ui-button label="Fermer" level="low" (buttonClick)="open.set(false)" />
|
|
61
|
+
* </ng-template>
|
|
62
|
+
* </ui-modal>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
class UiModal {
|
|
66
|
+
constructor() {
|
|
67
|
+
/** Open state (two-way). Toggling it drives the enter/leave animation. */
|
|
68
|
+
this.visible = model(false, /* @ts-ignore */
|
|
69
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
70
|
+
/** Simple header text (ignored when a `#header` template is projected). */
|
|
71
|
+
this.header = input(/* @ts-ignore */
|
|
72
|
+
...(ngDevMode ? [undefined, { debugName: "header" }] : /* istanbul ignore next */ []));
|
|
73
|
+
/** ARIA role of the dialog surface. */
|
|
74
|
+
this.role = input('dialog', /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []));
|
|
76
|
+
/** Accessible name when there is no visible header to reference. */
|
|
77
|
+
this.ariaLabel = input(/* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
79
|
+
/** Id of an external element naming the dialog (overrides the header title). */
|
|
80
|
+
this.ariaLabelledBy = input(/* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [undefined, { debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/** Show the mask (dim + capture) and block background scroll. */
|
|
83
|
+
this.modal = input(true, { ...(ngDevMode ? { debugName: "modal" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
84
|
+
/** Close when the mask (outside the dialog) is clicked — modal only. */
|
|
85
|
+
this.dismissableMask = input(false, { ...(ngDevMode ? { debugName: "dismissableMask" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
86
|
+
/** Show the close (×) button and allow `Escape` to close. */
|
|
87
|
+
this.closable = input(true, { ...(ngDevMode ? { debugName: "closable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
88
|
+
/** Close the dialog when `Escape` is pressed. */
|
|
89
|
+
this.closeOnEscape = input(true, { ...(ngDevMode ? { debugName: "closeOnEscape" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
90
|
+
/** Block background scroll even for a non-modal dialog. */
|
|
91
|
+
this.blockScroll = input(false, { ...(ngDevMode ? { debugName: "blockScroll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
92
|
+
/** Render the header region (title + actions). */
|
|
93
|
+
this.showHeader = input(true, { ...(ngDevMode ? { debugName: "showHeader" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
94
|
+
/** Allow dragging the dialog by its header. */
|
|
95
|
+
this.draggable = input(false, { ...(ngDevMode ? { debugName: "draggable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
96
|
+
/** Keep the dialog fully inside the viewport while dragging. */
|
|
97
|
+
this.keepInViewport = input(true, { ...(ngDevMode ? { debugName: "keepInViewport" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
98
|
+
/** Minimum left offset kept while dragging (px). */
|
|
99
|
+
this.minX = input(0, { ...(ngDevMode ? { debugName: "minX" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
100
|
+
/** Minimum top offset kept while dragging (px). */
|
|
101
|
+
this.minY = input(0, { ...(ngDevMode ? { debugName: "minY" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
102
|
+
/** Show the maximize / restore toggle in the header. */
|
|
103
|
+
this.maximizable = input(false, { ...(ngDevMode ? { debugName: "maximizable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
104
|
+
/** Allow resizing the dialog from its bottom-right corner (pointer only). */
|
|
105
|
+
this.resizable = input(false, { ...(ngDevMode ? { debugName: "resizable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
106
|
+
/** Minimum dialog width while resizing (px). */
|
|
107
|
+
this.minWidth = input(150, { ...(ngDevMode ? { debugName: "minWidth" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
108
|
+
/** Minimum dialog height while resizing (px). */
|
|
109
|
+
this.minHeight = input(100, { ...(ngDevMode ? { debugName: "minHeight" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
110
|
+
/** Anchor position inside the viewport mask. */
|
|
111
|
+
this.position = input('center', /* @ts-ignore */
|
|
112
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
113
|
+
/**
|
|
114
|
+
* Scope the dialog to the nearest positioned ancestor (`position: absolute`)
|
|
115
|
+
* instead of the viewport (`position: fixed`), and skip the body scroll lock.
|
|
116
|
+
* Useful to embed a dialog inside a bounded container (docs previews, panels).
|
|
117
|
+
*/
|
|
118
|
+
this.contained = input(false, { ...(ngDevMode ? { debugName: "contained" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
119
|
+
/** Move focus into the dialog when it opens (auto-captured, restored on close). */
|
|
120
|
+
this.focusOnShow = input(true, { ...(ngDevMode ? { debugName: "focusOnShow" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
121
|
+
/** Trap Tab focus inside the dialog while open. */
|
|
122
|
+
this.focusTrap = input(true, { ...(ngDevMode ? { debugName: "focusTrap" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
123
|
+
/** FontAwesome name of the close button icon. */
|
|
124
|
+
this.closeIcon = input('xmark', /* @ts-ignore */
|
|
125
|
+
...(ngDevMode ? [{ debugName: "closeIcon" }] : /* istanbul ignore next */ []));
|
|
126
|
+
/** FontAwesome name of the maximize icon. */
|
|
127
|
+
this.maximizeIcon = input('expand', /* @ts-ignore */
|
|
128
|
+
...(ngDevMode ? [{ debugName: "maximizeIcon" }] : /* istanbul ignore next */ []));
|
|
129
|
+
/** FontAwesome name of the restore (minimize) icon. */
|
|
130
|
+
this.minimizeIcon = input('compress', /* @ts-ignore */
|
|
131
|
+
...(ngDevMode ? [{ debugName: "minimizeIcon" }] : /* istanbul ignore next */ []));
|
|
132
|
+
/** Accessible name of the close button. */
|
|
133
|
+
this.closeAriaLabel = input('Fermer', /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "closeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
135
|
+
/** Accessible name of the maximize / restore button. */
|
|
136
|
+
this.maximizeAriaLabel = input('Agrandir', /* @ts-ignore */
|
|
137
|
+
...(ngDevMode ? [{ debugName: "maximizeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
138
|
+
/** Extra class(es) merged onto the dialog surface. */
|
|
139
|
+
this.styleClass = input(/* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [undefined, { debugName: "styleClass" }] : /* istanbul ignore next */ []));
|
|
141
|
+
/** Extra class(es) merged onto the mask. */
|
|
142
|
+
this.maskStyleClass = input(/* @ts-ignore */
|
|
143
|
+
...(ngDevMode ? [undefined, { debugName: "maskStyleClass" }] : /* istanbul ignore next */ []));
|
|
144
|
+
/** Inline styles applied to the dialog (e.g. `{ width: '32rem' }`). */
|
|
145
|
+
this.dialogStyle = input(/* @ts-ignore */
|
|
146
|
+
...(ngDevMode ? [undefined, { debugName: "dialogStyle" }] : /* istanbul ignore next */ []));
|
|
147
|
+
/** Per-breakpoint widths, keyed by a `max-width` (e.g. `{ '960px': '75vw' }`). */
|
|
148
|
+
this.breakpoints = input(/* @ts-ignore */
|
|
149
|
+
...(ngDevMode ? [undefined, { debugName: "breakpoints" }] : /* istanbul ignore next */ []));
|
|
150
|
+
/** Layer this dialog above earlier overlays automatically. */
|
|
151
|
+
this.autoZIndex = input(true, { ...(ngDevMode ? { debugName: "autoZIndex" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
152
|
+
/** Floor z-index (added to the auto value, or used as-is when `autoZIndex=false`). */
|
|
153
|
+
this.baseZIndex = input(0, { ...(ngDevMode ? { debugName: "baseZIndex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
154
|
+
/** Enter/leave preset for the dialog surface (mask always fades). */
|
|
155
|
+
this.motion = input('zoom', /* @ts-ignore */
|
|
156
|
+
...(ngDevMode ? [{ debugName: "motion" }] : /* istanbul ignore next */ []));
|
|
157
|
+
/** Disable the open/close animation for this dialog. */
|
|
158
|
+
this.motionDisabled = input(false, { ...(ngDevMode ? { debugName: "motionDisabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
159
|
+
/** Custom header template (replaces the `header` string). */
|
|
160
|
+
this.headerTemplate = contentChild('header', /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
|
|
162
|
+
/** Footer template (actions row). */
|
|
163
|
+
this.footerTemplate = contentChild('footer', /* @ts-ignore */
|
|
164
|
+
...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
|
|
165
|
+
/** Custom close-icon template (replaces `closeIcon`). */
|
|
166
|
+
this.closeIconTemplate = contentChild('closeicon', /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "closeIconTemplate" }] : /* istanbul ignore next */ []));
|
|
168
|
+
/** Emitted after the dialog becomes visible. */
|
|
169
|
+
this.shown = output();
|
|
170
|
+
/** Emitted after the dialog is hidden. */
|
|
171
|
+
this.hidden = output();
|
|
172
|
+
/** Emitted when the maximize state is toggled. */
|
|
173
|
+
this.maximizedChange = output();
|
|
174
|
+
/** Emitted when a drag gesture ends. */
|
|
175
|
+
this.dragEnd = output();
|
|
176
|
+
/** Emitted when a resize gesture ends. */
|
|
177
|
+
this.resizeEnd = output();
|
|
178
|
+
/** @ignore */
|
|
179
|
+
this.dialogRef = viewChild('dialog', /* @ts-ignore */
|
|
180
|
+
...(ngDevMode ? [{ debugName: "dialogRef" }] : /* istanbul ignore next */ []));
|
|
181
|
+
/** @ignore Scrim host (for imperative `maskStyleClass` — a bound `[class]` would
|
|
182
|
+
* fight the motion classes and break the leave animation). */
|
|
183
|
+
this.scrimRef = viewChild('scrim', /* @ts-ignore */
|
|
184
|
+
...(ngDevMode ? [{ debugName: "scrimRef" }] : /* istanbul ignore next */ []));
|
|
185
|
+
/** @ignore Classes currently applied to the scrim by `maskStyleClass`. */
|
|
186
|
+
this.appliedMaskClasses = [];
|
|
187
|
+
/** @ignore */
|
|
188
|
+
this.document = inject(DOCUMENT);
|
|
189
|
+
/** @ignore */
|
|
190
|
+
this.isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
191
|
+
/** @ignore Per-instance layering rank for `autoZIndex`. */
|
|
192
|
+
this.zSeq = ++zIndexSeq;
|
|
193
|
+
/** @ignore */
|
|
194
|
+
this.uid = `ui-modal-${nextUid++}`;
|
|
195
|
+
/** @ignore */
|
|
196
|
+
this.titleId = `${this.uid}-title`;
|
|
197
|
+
/** @ignore Maximized (fills the viewport). */
|
|
198
|
+
this.maximized = signal(false, /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "maximized" }] : /* istanbul ignore next */ []));
|
|
200
|
+
/** @ignore Cumulative drag offset applied via the independent `translate` property
|
|
201
|
+
* (does not clash with the `zoom` animation, which drives `transform`). */
|
|
202
|
+
this.dragOffset = signal(null, /* @ts-ignore */
|
|
203
|
+
...(ngDevMode ? [{ debugName: "dragOffset" }] : /* istanbul ignore next */ []));
|
|
204
|
+
/** @ignore Explicit dialog size while resizing (overrides `dialogStyle` width/height). */
|
|
205
|
+
this.resizeSize = signal(null, /* @ts-ignore */
|
|
206
|
+
...(ngDevMode ? [{ debugName: "resizeSize" }] : /* istanbul ignore next */ []));
|
|
207
|
+
/** @ignore This instance currently holds a body scroll lock. */
|
|
208
|
+
this.locked = false;
|
|
209
|
+
/** @ignore Runtime `<style>` element backing `breakpoints`. */
|
|
210
|
+
this.styleEl = null;
|
|
211
|
+
/** @ignore Effective stacking level. */
|
|
212
|
+
this.zIndex = computed(() => {
|
|
213
|
+
const base = this.baseZIndex();
|
|
214
|
+
if (this.autoZIndex())
|
|
215
|
+
return MODAL_BASE_Z_INDEX + base + this.zSeq;
|
|
216
|
+
return base > 0 ? base : MODAL_BASE_Z_INDEX;
|
|
217
|
+
}, /* @ts-ignore */
|
|
218
|
+
...(ngDevMode ? [{ debugName: "zIndex" }] : /* istanbul ignore next */ []));
|
|
219
|
+
// NOTE: the scrim and frame carry `animate.enter`/`animate.leave`. They MUST use a
|
|
220
|
+
// static `class` + per-class `[class.x]` toggles (like ui-toast) — a whole-string
|
|
221
|
+
// `[class]="expr()"` binding fights the motion classes Angular adds and restarts the
|
|
222
|
+
// animation every frame (leave never ends → node never removed). Position is applied
|
|
223
|
+
// via `[style]` for the same reason.
|
|
224
|
+
/** @ignore Cross-axis alignment of the dialog inside the frame. */
|
|
225
|
+
this.alignItems = computed(() => {
|
|
226
|
+
const p = this.position();
|
|
227
|
+
if (p.startsWith('top'))
|
|
228
|
+
return 'flex-start';
|
|
229
|
+
if (p.startsWith('bottom'))
|
|
230
|
+
return 'flex-end';
|
|
231
|
+
return 'center';
|
|
232
|
+
}, /* @ts-ignore */
|
|
233
|
+
...(ngDevMode ? [{ debugName: "alignItems" }] : /* istanbul ignore next */ []));
|
|
234
|
+
/** @ignore Main-axis alignment of the dialog inside the frame. */
|
|
235
|
+
this.justifyContent = computed(() => {
|
|
236
|
+
const p = this.position();
|
|
237
|
+
if (p.endsWith('left'))
|
|
238
|
+
return 'flex-start';
|
|
239
|
+
if (p.endsWith('right'))
|
|
240
|
+
return 'flex-end';
|
|
241
|
+
return 'center';
|
|
242
|
+
}, /* @ts-ignore */
|
|
243
|
+
...(ngDevMode ? [{ debugName: "justifyContent" }] : /* istanbul ignore next */ []));
|
|
244
|
+
/** @ignore */
|
|
245
|
+
this.dialogClasses = computed(() => {
|
|
246
|
+
const c = ['ui-modal'];
|
|
247
|
+
if (this.maximized())
|
|
248
|
+
c.push('_maximized');
|
|
249
|
+
if (this.contained())
|
|
250
|
+
c.push('_contained');
|
|
251
|
+
const extra = this.styleClass();
|
|
252
|
+
if (extra)
|
|
253
|
+
c.push(extra);
|
|
254
|
+
return c.join(' ');
|
|
255
|
+
}, /* @ts-ignore */
|
|
256
|
+
...(ngDevMode ? [{ debugName: "dialogClasses" }] : /* istanbul ignore next */ []));
|
|
257
|
+
/** @ignore Header is draggable when enabled and not maximized. */
|
|
258
|
+
this.headerDraggable = computed(() => this.draggable() && !this.maximized(), /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "headerDraggable" }] : /* istanbul ignore next */ []));
|
|
260
|
+
/** @ignore Drag offset serialised for the `translate` CSS property. */
|
|
261
|
+
this.dragTranslate = computed(() => {
|
|
262
|
+
if (this.maximized())
|
|
263
|
+
return null;
|
|
264
|
+
const o = this.dragOffset();
|
|
265
|
+
return o ? `${o.x}px ${o.y}px` : null;
|
|
266
|
+
}, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "dragTranslate" }] : /* istanbul ignore next */ []));
|
|
268
|
+
/** @ignore Inline styles for the dialog: `dialogStyle` plus the resize size
|
|
269
|
+
* (which wins), dropped entirely while maximized. */
|
|
270
|
+
this.resolvedDialogStyle = computed(() => {
|
|
271
|
+
if (this.maximized())
|
|
272
|
+
return null;
|
|
273
|
+
const base = { ...(this.dialogStyle() ?? {}) };
|
|
274
|
+
const size = this.resizeSize();
|
|
275
|
+
if (size) {
|
|
276
|
+
base['width'] = `${size.w}px`;
|
|
277
|
+
base['height'] = `${size.h}px`;
|
|
278
|
+
}
|
|
279
|
+
return Object.keys(base).length ? base : null;
|
|
280
|
+
}, /* @ts-ignore */
|
|
281
|
+
...(ngDevMode ? [{ debugName: "resolvedDialogStyle" }] : /* istanbul ignore next */ []));
|
|
282
|
+
/** @ignore The resize grip shows when resizable and not maximized. */
|
|
283
|
+
this.showResizeHandle = computed(() => this.resizable() && !this.maximized(), /* @ts-ignore */
|
|
284
|
+
...(ngDevMode ? [{ debugName: "showResizeHandle" }] : /* istanbul ignore next */ []));
|
|
285
|
+
/** @ignore Id of the element naming the dialog (header title, or an external id). */
|
|
286
|
+
this.labelledBy = computed(() => this.ariaLabelledBy() ?? (this.showHeader() && this.header() ? this.titleId : null), /* @ts-ignore */
|
|
287
|
+
...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
|
|
288
|
+
/** @ignore Fallback accessible name when nothing is referenced. */
|
|
289
|
+
this.resolvedAriaLabel = computed(() => (this.labelledBy() ? null : this.ariaLabel()), /* @ts-ignore */
|
|
290
|
+
...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
291
|
+
// --- Drag (header handle) -------------------------------------------
|
|
292
|
+
/** @ignore */
|
|
293
|
+
this.dragging = false;
|
|
294
|
+
/** @ignore */
|
|
295
|
+
this.lastX = 0;
|
|
296
|
+
/** @ignore */
|
|
297
|
+
this.lastY = 0;
|
|
298
|
+
/** @ignore */
|
|
299
|
+
this.moveHandler = (e) => this.onDrag(e);
|
|
300
|
+
/** @ignore */
|
|
301
|
+
this.upHandler = (e) => this.endDrag(e);
|
|
302
|
+
// --- Resize (bottom-right grip) -------------------------------------
|
|
303
|
+
/** @ignore */
|
|
304
|
+
this.resizing = false;
|
|
305
|
+
/** @ignore Pointer + size captured when the resize gesture starts. */
|
|
306
|
+
this.resizeStart = { x: 0, y: 0, w: 0, h: 0 };
|
|
307
|
+
/** @ignore */
|
|
308
|
+
this.resizeMoveHandler = (e) => this.onResize(e);
|
|
309
|
+
/** @ignore */
|
|
310
|
+
this.resizeUpHandler = (e) => this.endResize(e);
|
|
311
|
+
const destroyRef = inject(DestroyRef);
|
|
312
|
+
let wasVisible = false;
|
|
313
|
+
// Open/close side effects: scroll lock, lifecycle events, state reset.
|
|
314
|
+
effect(() => {
|
|
315
|
+
const v = this.visible();
|
|
316
|
+
untracked(() => {
|
|
317
|
+
if (v && !wasVisible) {
|
|
318
|
+
wasVisible = true;
|
|
319
|
+
// A contained dialog is embedded, not a real overlay → never lock the body.
|
|
320
|
+
if (this.isBrowser && !this.contained() && (this.modal() || this.blockScroll())) {
|
|
321
|
+
lockBodyScroll(this.document);
|
|
322
|
+
this.locked = true;
|
|
323
|
+
}
|
|
324
|
+
this.shown.emit();
|
|
325
|
+
}
|
|
326
|
+
else if (!v && wasVisible) {
|
|
327
|
+
wasVisible = false;
|
|
328
|
+
this.releaseLock();
|
|
329
|
+
this.maximized.set(false);
|
|
330
|
+
this.dragOffset.set(null);
|
|
331
|
+
this.resizeSize.set(null);
|
|
332
|
+
this.hidden.emit();
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
// Rebuild the responsive width stylesheet when `breakpoints` changes.
|
|
337
|
+
effect(() => {
|
|
338
|
+
const bps = this.breakpoints();
|
|
339
|
+
untracked(() => this.applyBreakpoints(bps));
|
|
340
|
+
});
|
|
341
|
+
// Apply `maskStyleClass` imperatively (see scrimRef note).
|
|
342
|
+
effect(() => {
|
|
343
|
+
const el = this.scrimRef()?.nativeElement;
|
|
344
|
+
const raw = this.maskStyleClass();
|
|
345
|
+
untracked(() => {
|
|
346
|
+
for (const c of this.appliedMaskClasses)
|
|
347
|
+
el?.classList.remove(c);
|
|
348
|
+
this.appliedMaskClasses = el && raw ? raw.split(/\s+/).filter(Boolean) : [];
|
|
349
|
+
for (const c of this.appliedMaskClasses)
|
|
350
|
+
el.classList.add(c);
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
// A11y safeguard: a dialog must have an accessible name.
|
|
354
|
+
if (isDevMode()) {
|
|
355
|
+
effect(() => {
|
|
356
|
+
if (this.visible() && !this.labelledBy() && !this.resolvedAriaLabel()) {
|
|
357
|
+
console.warn('[ui-modal] Dialog has no accessible name: provide `header`, `ariaLabel` or `ariaLabelledBy`.');
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
destroyRef.onDestroy(() => {
|
|
362
|
+
this.releaseLock();
|
|
363
|
+
this.removeStyleElement();
|
|
364
|
+
this.removeDragListeners();
|
|
365
|
+
this.removeResizeListeners();
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/** Close the dialog. */
|
|
369
|
+
close() {
|
|
370
|
+
this.visible.set(false);
|
|
371
|
+
}
|
|
372
|
+
/** Move focus onto the dialog surface. */
|
|
373
|
+
focus() {
|
|
374
|
+
this.dialogRef()?.nativeElement.focus();
|
|
375
|
+
}
|
|
376
|
+
/** @ignore Toggle maximized; lock scroll for a non-modal dialog that now fills the screen. */
|
|
377
|
+
toggleMaximize() {
|
|
378
|
+
const next = !this.maximized();
|
|
379
|
+
this.maximized.set(next);
|
|
380
|
+
if (next) {
|
|
381
|
+
this.dragOffset.set(null);
|
|
382
|
+
this.resizeSize.set(null);
|
|
383
|
+
}
|
|
384
|
+
if (this.isBrowser && !this.contained() && !this.modal() && !this.blockScroll()) {
|
|
385
|
+
if (next) {
|
|
386
|
+
lockBodyScroll(this.document);
|
|
387
|
+
this.locked = true;
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
this.releaseLock();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
this.maximizedChange.emit({ maximized: next });
|
|
394
|
+
}
|
|
395
|
+
/** @ignore Escape-to-close (bubbles from any focused control inside the dialog). */
|
|
396
|
+
onKeydown(event) {
|
|
397
|
+
if (event.key === 'Escape' && this.closeOnEscape() && this.closable()) {
|
|
398
|
+
event.stopPropagation();
|
|
399
|
+
this.close();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
/** @ignore Click-outside dismiss (mask target only, modal + dismissable). */
|
|
403
|
+
onMaskPointerdown(event) {
|
|
404
|
+
if (!this.modal() || !this.dismissableMask() || !this.closable())
|
|
405
|
+
return;
|
|
406
|
+
if (event.target === event.currentTarget)
|
|
407
|
+
this.close();
|
|
408
|
+
}
|
|
409
|
+
/** @ignore */
|
|
410
|
+
onHeaderPointerdown(event) {
|
|
411
|
+
if (!this.headerDraggable() || event.button !== 0)
|
|
412
|
+
return;
|
|
413
|
+
// Never start a drag from the header action buttons.
|
|
414
|
+
if (event.target.closest('button'))
|
|
415
|
+
return;
|
|
416
|
+
this.dragging = true;
|
|
417
|
+
this.lastX = event.clientX;
|
|
418
|
+
this.lastY = event.clientY;
|
|
419
|
+
this.document.addEventListener('pointermove', this.moveHandler);
|
|
420
|
+
this.document.addEventListener('pointerup', this.upHandler);
|
|
421
|
+
this.document.body.style.userSelect = 'none';
|
|
422
|
+
}
|
|
423
|
+
/** @ignore */
|
|
424
|
+
onDrag(event) {
|
|
425
|
+
if (!this.dragging)
|
|
426
|
+
return;
|
|
427
|
+
const dx = event.clientX - this.lastX;
|
|
428
|
+
const dy = event.clientY - this.lastY;
|
|
429
|
+
const cur = this.dragOffset() ?? { x: 0, y: 0 };
|
|
430
|
+
let nx = cur.x + dx;
|
|
431
|
+
let ny = cur.y + dy;
|
|
432
|
+
const el = this.dialogRef()?.nativeElement;
|
|
433
|
+
if (this.keepInViewport() && el) {
|
|
434
|
+
const rect = el.getBoundingClientRect();
|
|
435
|
+
const view = this.document.defaultView;
|
|
436
|
+
const vw = view?.innerWidth ?? rect.right;
|
|
437
|
+
const vh = view?.innerHeight ?? rect.bottom;
|
|
438
|
+
// Reject a delta that would push the dialog past a viewport edge.
|
|
439
|
+
if (rect.left + dx < this.minX() || rect.right + dx > vw)
|
|
440
|
+
nx = cur.x;
|
|
441
|
+
if (rect.top + dy < this.minY() || rect.bottom + dy > vh)
|
|
442
|
+
ny = cur.y;
|
|
443
|
+
}
|
|
444
|
+
this.lastX = event.clientX;
|
|
445
|
+
this.lastY = event.clientY;
|
|
446
|
+
this.dragOffset.set({ x: nx, y: ny });
|
|
447
|
+
}
|
|
448
|
+
/** @ignore */
|
|
449
|
+
endDrag(_event) {
|
|
450
|
+
if (!this.dragging)
|
|
451
|
+
return;
|
|
452
|
+
this.dragging = false;
|
|
453
|
+
this.removeDragListeners();
|
|
454
|
+
this.document.body.style.userSelect = '';
|
|
455
|
+
this.dragEnd.emit();
|
|
456
|
+
}
|
|
457
|
+
/** @ignore */
|
|
458
|
+
removeDragListeners() {
|
|
459
|
+
this.document.removeEventListener('pointermove', this.moveHandler);
|
|
460
|
+
this.document.removeEventListener('pointerup', this.upHandler);
|
|
461
|
+
}
|
|
462
|
+
/** @ignore Start a corner resize (seeds from the current rendered size). */
|
|
463
|
+
onResizeStart(event) {
|
|
464
|
+
if (!this.showResizeHandle() || event.button !== 0)
|
|
465
|
+
return;
|
|
466
|
+
// Keep the grip from bubbling to the frame (dismiss) / starting a drag.
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
event.stopPropagation();
|
|
469
|
+
const el = this.dialogRef()?.nativeElement;
|
|
470
|
+
if (!el)
|
|
471
|
+
return;
|
|
472
|
+
const rect = el.getBoundingClientRect();
|
|
473
|
+
this.resizing = true;
|
|
474
|
+
this.resizeStart = { x: event.clientX, y: event.clientY, w: rect.width, h: rect.height };
|
|
475
|
+
this.document.addEventListener('pointermove', this.resizeMoveHandler);
|
|
476
|
+
this.document.addEventListener('pointerup', this.resizeUpHandler);
|
|
477
|
+
this.document.body.style.userSelect = 'none';
|
|
478
|
+
}
|
|
479
|
+
/** @ignore */
|
|
480
|
+
onResize(event) {
|
|
481
|
+
if (!this.resizing)
|
|
482
|
+
return;
|
|
483
|
+
const view = this.document.defaultView;
|
|
484
|
+
// `|| MAX` (not `??`) so a degenerate 0 viewport never clamps the dialog to nothing.
|
|
485
|
+
const maxW = view?.innerWidth || Number.MAX_SAFE_INTEGER;
|
|
486
|
+
const maxH = view?.innerHeight || Number.MAX_SAFE_INTEGER;
|
|
487
|
+
const w = Math.min(maxW, Math.max(this.minWidth(), this.resizeStart.w + (event.clientX - this.resizeStart.x)));
|
|
488
|
+
const h = Math.min(maxH, Math.max(this.minHeight(), this.resizeStart.h + (event.clientY - this.resizeStart.y)));
|
|
489
|
+
this.resizeSize.set({ w, h });
|
|
490
|
+
}
|
|
491
|
+
/** @ignore */
|
|
492
|
+
endResize(_event) {
|
|
493
|
+
if (!this.resizing)
|
|
494
|
+
return;
|
|
495
|
+
this.resizing = false;
|
|
496
|
+
this.removeResizeListeners();
|
|
497
|
+
this.document.body.style.userSelect = '';
|
|
498
|
+
const size = this.resizeSize();
|
|
499
|
+
if (size)
|
|
500
|
+
this.resizeEnd.emit({ width: size.w, height: size.h });
|
|
501
|
+
}
|
|
502
|
+
/** @ignore */
|
|
503
|
+
removeResizeListeners() {
|
|
504
|
+
this.document.removeEventListener('pointermove', this.resizeMoveHandler);
|
|
505
|
+
this.document.removeEventListener('pointerup', this.resizeUpHandler);
|
|
506
|
+
}
|
|
507
|
+
// --- Internals -------------------------------------------------------
|
|
508
|
+
/** @ignore Release this instance's scroll lock, if held. */
|
|
509
|
+
releaseLock() {
|
|
510
|
+
if (this.locked) {
|
|
511
|
+
unlockBodyScroll(this.document);
|
|
512
|
+
this.locked = false;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
/** @ignore Build the responsive width rules (`max-width` media queries). */
|
|
516
|
+
applyBreakpoints(bps) {
|
|
517
|
+
if (!this.isBrowser)
|
|
518
|
+
return;
|
|
519
|
+
this.removeStyleElement();
|
|
520
|
+
if (!bps || Object.keys(bps).length === 0)
|
|
521
|
+
return;
|
|
522
|
+
const el = this.document.createElement('style');
|
|
523
|
+
let css = '';
|
|
524
|
+
for (const bp of Object.keys(bps)) {
|
|
525
|
+
css +=
|
|
526
|
+
`@media screen and (max-width: ${bp}) {` +
|
|
527
|
+
` [data-modal-uid="${this.uid}"]:not(._maximized) { width: ${bps[bp]} !important; } }\n`;
|
|
528
|
+
}
|
|
529
|
+
el.textContent = css;
|
|
530
|
+
this.document.head.appendChild(el);
|
|
531
|
+
this.styleEl = el;
|
|
532
|
+
}
|
|
533
|
+
/** @ignore */
|
|
534
|
+
removeStyleElement() {
|
|
535
|
+
this.styleEl?.remove();
|
|
536
|
+
this.styleEl = null;
|
|
537
|
+
}
|
|
538
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiModal, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
539
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.8", type: UiModal, isStandalone: true, selector: "ui-modal", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, role: { classPropertyName: "role", publicName: "role", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledBy: { classPropertyName: "ariaLabelledBy", publicName: "ariaLabelledBy", isSignal: true, isRequired: false, transformFunction: null }, modal: { classPropertyName: "modal", publicName: "modal", isSignal: true, isRequired: false, transformFunction: null }, dismissableMask: { classPropertyName: "dismissableMask", publicName: "dismissableMask", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: true, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: true, isRequired: false, transformFunction: null }, blockScroll: { classPropertyName: "blockScroll", publicName: "blockScroll", isSignal: true, isRequired: false, transformFunction: null }, showHeader: { classPropertyName: "showHeader", publicName: "showHeader", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, keepInViewport: { classPropertyName: "keepInViewport", publicName: "keepInViewport", isSignal: true, isRequired: false, transformFunction: null }, minX: { classPropertyName: "minX", publicName: "minX", isSignal: true, isRequired: false, transformFunction: null }, minY: { classPropertyName: "minY", publicName: "minY", isSignal: true, isRequired: false, transformFunction: null }, maximizable: { classPropertyName: "maximizable", publicName: "maximizable", isSignal: true, isRequired: false, transformFunction: null }, resizable: { classPropertyName: "resizable", publicName: "resizable", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, minHeight: { classPropertyName: "minHeight", publicName: "minHeight", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, contained: { classPropertyName: "contained", publicName: "contained", isSignal: true, isRequired: false, transformFunction: null }, focusOnShow: { classPropertyName: "focusOnShow", publicName: "focusOnShow", isSignal: true, isRequired: false, transformFunction: null }, focusTrap: { classPropertyName: "focusTrap", publicName: "focusTrap", isSignal: true, isRequired: false, transformFunction: null }, closeIcon: { classPropertyName: "closeIcon", publicName: "closeIcon", isSignal: true, isRequired: false, transformFunction: null }, maximizeIcon: { classPropertyName: "maximizeIcon", publicName: "maximizeIcon", isSignal: true, isRequired: false, transformFunction: null }, minimizeIcon: { classPropertyName: "minimizeIcon", publicName: "minimizeIcon", isSignal: true, isRequired: false, transformFunction: null }, closeAriaLabel: { classPropertyName: "closeAriaLabel", publicName: "closeAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, maximizeAriaLabel: { classPropertyName: "maximizeAriaLabel", publicName: "maximizeAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, styleClass: { classPropertyName: "styleClass", publicName: "styleClass", isSignal: true, isRequired: false, transformFunction: null }, maskStyleClass: { classPropertyName: "maskStyleClass", publicName: "maskStyleClass", isSignal: true, isRequired: false, transformFunction: null }, dialogStyle: { classPropertyName: "dialogStyle", publicName: "dialogStyle", isSignal: true, isRequired: false, transformFunction: null }, breakpoints: { classPropertyName: "breakpoints", publicName: "breakpoints", isSignal: true, isRequired: false, transformFunction: null }, autoZIndex: { classPropertyName: "autoZIndex", publicName: "autoZIndex", isSignal: true, isRequired: false, transformFunction: null }, baseZIndex: { classPropertyName: "baseZIndex", publicName: "baseZIndex", isSignal: true, isRequired: false, transformFunction: null }, motion: { classPropertyName: "motion", publicName: "motion", isSignal: true, isRequired: false, transformFunction: null }, motionDisabled: { classPropertyName: "motionDisabled", publicName: "motionDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange", shown: "shown", hidden: "hidden", maximizedChange: "maximizedChange", dragEnd: "dragEnd", resizeEnd: "resizeEnd" }, queries: [{ propertyName: "headerTemplate", first: true, predicate: ["header"], descendants: true, isSignal: true }, { propertyName: "footerTemplate", first: true, predicate: ["footer"], descendants: true, isSignal: true }, { propertyName: "closeIconTemplate", first: true, predicate: ["closeicon"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "dialogRef", first: true, predicate: ["dialog"], descendants: true, isSignal: true }, { propertyName: "scrimRef", first: true, predicate: ["scrim"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (visible()) {\n <!-- Scrim + frame are SIBLINGS (both direct @if children) so each animates its own\n leave independently \u2014 a nested animated element would deadlock the removal.\n The frame carries the dialog's zoom; the dialog itself has no leave binding. -->\n @if (modal()) {\n <div\n #scrim\n class=\"ui-modal-scrim\"\n [class._contained]=\"contained()\"\n [style.z-index]=\"zIndex()\"\n [uiMotion]=\"'fade'\"\n [motionDisabled]=\"motionDisabled()\"\n #scrimMotion=\"uiMotion\"\n [animate.enter]=\"scrimMotion.enter()\"\n [animate.leave]=\"scrimMotion.leave()\"\n ></div>\n }\n\n <!-- Dialog: Escape/Tab handled on the container, focus lives in the\n content (CDK focus-trap). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ui-modal-frame\"\n [class._modal]=\"modal()\"\n [class._contained]=\"contained()\"\n [style.align-items]=\"alignItems()\"\n [style.justify-content]=\"justifyContent()\"\n [style.z-index]=\"zIndex()\"\n [uiMotion]=\"motion()\"\n [motionDisabled]=\"motionDisabled()\"\n #frameMotion=\"uiMotion\"\n [animate.enter]=\"frameMotion.enter()\"\n [animate.leave]=\"frameMotion.leave()\"\n (pointerdown)=\"onMaskPointerdown($event)\"\n (keydown)=\"onKeydown($event)\"\n >\n <div\n #dialog\n [class]=\"dialogClasses()\"\n [attr.data-modal-uid]=\"uid\"\n [attr.role]=\"role()\"\n [attr.aria-modal]=\"modal() ? 'true' : null\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n tabindex=\"-1\"\n [style]=\"resolvedDialogStyle()\"\n [style.translate]=\"dragTranslate()\"\n [cdkTrapFocus]=\"focusTrap()\"\n [cdkTrapFocusAutoCapture]=\"focusOnShow()\"\n >\n @if (showHeader()) {\n <div\n class=\"ui-modal-header\"\n [class._draggable]=\"headerDraggable()\"\n (pointerdown)=\"onHeaderPointerdown($event)\"\n >\n <div [attr.id]=\"titleId\" class=\"ui-modal-title\">\n @if (headerTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ header() }}\n }\n </div>\n\n <div class=\"ui-modal-header-actions\">\n @if (maximizable()) {\n <button\n type=\"button\"\n class=\"ui-modal-action\"\n [attr.aria-label]=\"maximizeAriaLabel()\"\n [attr.aria-pressed]=\"maximized()\"\n (click)=\"toggleMaximize()\"\n >\n <ui-icon [name]=\"maximized() ? minimizeIcon() : maximizeIcon()\" size=\"sm\" />\n </button>\n }\n @if (closable()) {\n <button\n type=\"button\"\n class=\"ui-modal-action\"\n [attr.aria-label]=\"closeAriaLabel()\"\n (click)=\"close()\"\n >\n @if (closeIconTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n <ui-icon [name]=\"closeIcon()\" size=\"sm\" />\n }\n </button>\n }\n </div>\n </div>\n }\n\n <!-- Body: long content scrolls inside this region. -->\n <div class=\"ui-modal-content\">\n <ng-content />\n </div>\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-modal-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (showResizeHandle()) {\n <!-- Corner resize grip (pointer only, like a native textarea corner). -->\n <span\n class=\"ui-modal-resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event)\"\n ></span>\n }\n </div>\n </div>\n}\n", styles: [".ui-modal-scrim{position:fixed;inset:0;z-index:1100;pointer-events:none;background-color:var(--ui-modal-mask-background, var(--primitives-black-50))}.ui-modal-scrim._contained{position:absolute}.ui-modal-frame{position:fixed;inset:0;z-index:1100;display:flex;padding:var(--units-lg);pointer-events:none}.ui-modal-frame._modal{pointer-events:auto}.ui-modal-frame._contained{position:absolute}.ui-modal{pointer-events:auto;position:relative;box-sizing:border-box;display:flex;flex-direction:column;max-width:min(90vw,35rem);max-height:90vh;border:var(--stroke-sm) solid var(--global-border-subtle);border-radius:var(--radius-md);background-color:var(--global-background-default);color:var(--global-text-default);box-shadow:var(--shadow-default-lg);font-family:var(--fontfamily-base);outline:none}.ui-modal._contained{max-width:100%;max-height:100%}.ui-modal._maximized{width:100vw;height:100vh;max-width:100vw;max-height:100vh;border-radius:0}.ui-modal._maximized._contained{width:100%;height:100%;max-width:100%;max-height:100%}.ui-modal-header{flex:0 0 auto;display:flex;align-items:flex-start;gap:var(--units-sm);padding:var(--units-lg) var(--units-lg) var(--units-sm)}.ui-modal-header._draggable{cursor:move;-webkit-user-select:none;user-select:none}.ui-modal-title{flex:1 1 auto;min-width:0;font-family:var(--fontfamily-title);font-size:var(--size-typography-title-default);font-weight:var(--weight-bold);line-height:1.3;overflow-wrap:break-word}.ui-modal-header-actions{flex:0 0 auto;display:inline-flex;align-items:center;gap:var(--units-2xs)}.ui-modal-action{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;border-radius:var(--radius-xs);background:transparent;color:inherit;line-height:0;cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-modal-action:hover{background-color:var(--global-background-muted-hover);color:var(--global-text-muted-hover)}.ui-modal-action:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) var(--global-border-focus)}@media(prefers-reduced-motion:reduce){.ui-modal-action{transition-duration:.01ms}}:root[data-motion=off] .ui-modal-action{transition-duration:.01ms}.ui-modal-content{flex:1 1 auto;min-height:0;overflow-y:auto;padding:var(--units-lg);font-size:var(--size-typography-text-md);line-height:1.5}.ui-modal-header+.ui-modal-content{padding-top:0}.ui-modal-footer{flex:0 0 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--units-sm);padding:var(--units-md) var(--units-lg) var(--units-lg);border-top:var(--stroke-sm) solid var(--global-border-subtle)}.ui-modal-resize-handle{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;touch-action:none;color:var(--global-text-muted);background-image:repeating-linear-gradient(-45deg,currentColor 0 1px,transparent 1px 3px);-webkit-mask-image:linear-gradient(-45deg,transparent 0 45%,#000 55%);mask-image:linear-gradient(-45deg,transparent 0 45%,#000 55%);opacity:.5}.ui-modal-resize-handle:hover{opacity:.8}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: UiMotion, selector: "[uiMotion]", inputs: ["uiMotion", "motionDuration", "motionDelay", "motionEasing", "motionEnterEasing", "motionLeaveEasing", "motionDistance", "motionScale", "motionDisabled", "motionOnInsert"], exportAs: ["uiMotion"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }] }); }
|
|
540
|
+
}
|
|
541
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: UiModal, decorators: [{
|
|
542
|
+
type: Component,
|
|
543
|
+
args: [{ selector: 'ui-modal', imports: [NgTemplateOutlet, A11yModule, UiMotion, UiIcon], template: "@if (visible()) {\n <!-- Scrim + frame are SIBLINGS (both direct @if children) so each animates its own\n leave independently \u2014 a nested animated element would deadlock the removal.\n The frame carries the dialog's zoom; the dialog itself has no leave binding. -->\n @if (modal()) {\n <div\n #scrim\n class=\"ui-modal-scrim\"\n [class._contained]=\"contained()\"\n [style.z-index]=\"zIndex()\"\n [uiMotion]=\"'fade'\"\n [motionDisabled]=\"motionDisabled()\"\n #scrimMotion=\"uiMotion\"\n [animate.enter]=\"scrimMotion.enter()\"\n [animate.leave]=\"scrimMotion.leave()\"\n ></div>\n }\n\n <!-- Dialog: Escape/Tab handled on the container, focus lives in the\n content (CDK focus-trap). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ui-modal-frame\"\n [class._modal]=\"modal()\"\n [class._contained]=\"contained()\"\n [style.align-items]=\"alignItems()\"\n [style.justify-content]=\"justifyContent()\"\n [style.z-index]=\"zIndex()\"\n [uiMotion]=\"motion()\"\n [motionDisabled]=\"motionDisabled()\"\n #frameMotion=\"uiMotion\"\n [animate.enter]=\"frameMotion.enter()\"\n [animate.leave]=\"frameMotion.leave()\"\n (pointerdown)=\"onMaskPointerdown($event)\"\n (keydown)=\"onKeydown($event)\"\n >\n <div\n #dialog\n [class]=\"dialogClasses()\"\n [attr.data-modal-uid]=\"uid\"\n [attr.role]=\"role()\"\n [attr.aria-modal]=\"modal() ? 'true' : null\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-labelledby]=\"labelledBy()\"\n tabindex=\"-1\"\n [style]=\"resolvedDialogStyle()\"\n [style.translate]=\"dragTranslate()\"\n [cdkTrapFocus]=\"focusTrap()\"\n [cdkTrapFocusAutoCapture]=\"focusOnShow()\"\n >\n @if (showHeader()) {\n <div\n class=\"ui-modal-header\"\n [class._draggable]=\"headerDraggable()\"\n (pointerdown)=\"onHeaderPointerdown($event)\"\n >\n <div [attr.id]=\"titleId\" class=\"ui-modal-title\">\n @if (headerTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n {{ header() }}\n }\n </div>\n\n <div class=\"ui-modal-header-actions\">\n @if (maximizable()) {\n <button\n type=\"button\"\n class=\"ui-modal-action\"\n [attr.aria-label]=\"maximizeAriaLabel()\"\n [attr.aria-pressed]=\"maximized()\"\n (click)=\"toggleMaximize()\"\n >\n <ui-icon [name]=\"maximized() ? minimizeIcon() : maximizeIcon()\" size=\"sm\" />\n </button>\n }\n @if (closable()) {\n <button\n type=\"button\"\n class=\"ui-modal-action\"\n [attr.aria-label]=\"closeAriaLabel()\"\n (click)=\"close()\"\n >\n @if (closeIconTemplate(); as tpl) {\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n } @else {\n <ui-icon [name]=\"closeIcon()\" size=\"sm\" />\n }\n </button>\n }\n </div>\n </div>\n }\n\n <!-- Body: long content scrolls inside this region. -->\n <div class=\"ui-modal-content\">\n <ng-content />\n </div>\n\n @if (footerTemplate(); as tpl) {\n <div class=\"ui-modal-footer\">\n <ng-container [ngTemplateOutlet]=\"tpl\" />\n </div>\n }\n\n @if (showResizeHandle()) {\n <!-- Corner resize grip (pointer only, like a native textarea corner). -->\n <span\n class=\"ui-modal-resize-handle\"\n aria-hidden=\"true\"\n (pointerdown)=\"onResizeStart($event)\"\n ></span>\n }\n </div>\n </div>\n}\n", styles: [".ui-modal-scrim{position:fixed;inset:0;z-index:1100;pointer-events:none;background-color:var(--ui-modal-mask-background, var(--primitives-black-50))}.ui-modal-scrim._contained{position:absolute}.ui-modal-frame{position:fixed;inset:0;z-index:1100;display:flex;padding:var(--units-lg);pointer-events:none}.ui-modal-frame._modal{pointer-events:auto}.ui-modal-frame._contained{position:absolute}.ui-modal{pointer-events:auto;position:relative;box-sizing:border-box;display:flex;flex-direction:column;max-width:min(90vw,35rem);max-height:90vh;border:var(--stroke-sm) solid var(--global-border-subtle);border-radius:var(--radius-md);background-color:var(--global-background-default);color:var(--global-text-default);box-shadow:var(--shadow-default-lg);font-family:var(--fontfamily-base);outline:none}.ui-modal._contained{max-width:100%;max-height:100%}.ui-modal._maximized{width:100vw;height:100vh;max-width:100vw;max-height:100vh;border-radius:0}.ui-modal._maximized._contained{width:100%;height:100%;max-width:100%;max-height:100%}.ui-modal-header{flex:0 0 auto;display:flex;align-items:flex-start;gap:var(--units-sm);padding:var(--units-lg) var(--units-lg) var(--units-sm)}.ui-modal-header._draggable{cursor:move;-webkit-user-select:none;user-select:none}.ui-modal-title{flex:1 1 auto;min-width:0;font-family:var(--fontfamily-title);font-size:var(--size-typography-title-default);font-weight:var(--weight-bold);line-height:1.3;overflow-wrap:break-word}.ui-modal-header-actions{flex:0 0 auto;display:inline-flex;align-items:center;gap:var(--units-2xs)}.ui-modal-action{display:inline-flex;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0;border:none;border-radius:var(--radius-xs);background:transparent;color:inherit;line-height:0;cursor:pointer;transition:background-color var(--transition-default) var(--transition-easeinout),color var(--transition-default) var(--transition-easeinout)}.ui-modal-action:hover{background-color:var(--global-background-muted-hover);color:var(--global-text-muted-hover)}.ui-modal-action:focus-visible{outline:none;box-shadow:0 0 0 var(--units-2xs) var(--global-border-focus)}@media(prefers-reduced-motion:reduce){.ui-modal-action{transition-duration:.01ms}}:root[data-motion=off] .ui-modal-action{transition-duration:.01ms}.ui-modal-content{flex:1 1 auto;min-height:0;overflow-y:auto;padding:var(--units-lg);font-size:var(--size-typography-text-md);line-height:1.5}.ui-modal-header+.ui-modal-content{padding-top:0}.ui-modal-footer{flex:0 0 auto;display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--units-sm);padding:var(--units-md) var(--units-lg) var(--units-lg);border-top:var(--stroke-sm) solid var(--global-border-subtle)}.ui-modal-resize-handle{position:absolute;right:0;bottom:0;width:16px;height:16px;cursor:nwse-resize;touch-action:none;color:var(--global-text-muted);background-image:repeating-linear-gradient(-45deg,currentColor 0 1px,transparent 1px 3px);-webkit-mask-image:linear-gradient(-45deg,transparent 0 45%,#000 55%);mask-image:linear-gradient(-45deg,transparent 0 45%,#000 55%);opacity:.5}.ui-modal-resize-handle:hover{opacity:.8}\n"] }]
|
|
544
|
+
}], ctorParameters: () => [], propDecorators: { visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], role: [{ type: i0.Input, args: [{ isSignal: true, alias: "role", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledBy", required: false }] }], modal: [{ type: i0.Input, args: [{ isSignal: true, alias: "modal", required: false }] }], dismissableMask: [{ type: i0.Input, args: [{ isSignal: true, alias: "dismissableMask", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], closeOnEscape: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnEscape", required: false }] }], blockScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "blockScroll", required: false }] }], showHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "showHeader", required: false }] }], draggable: [{ type: i0.Input, args: [{ isSignal: true, alias: "draggable", required: false }] }], keepInViewport: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepInViewport", required: false }] }], minX: [{ type: i0.Input, args: [{ isSignal: true, alias: "minX", required: false }] }], minY: [{ type: i0.Input, args: [{ isSignal: true, alias: "minY", required: false }] }], maximizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizable", required: false }] }], resizable: [{ type: i0.Input, args: [{ isSignal: true, alias: "resizable", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], minHeight: [{ type: i0.Input, args: [{ isSignal: true, alias: "minHeight", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], contained: [{ type: i0.Input, args: [{ isSignal: true, alias: "contained", required: false }] }], focusOnShow: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusOnShow", required: false }] }], focusTrap: [{ type: i0.Input, args: [{ isSignal: true, alias: "focusTrap", required: false }] }], closeIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeIcon", required: false }] }], maximizeIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizeIcon", required: false }] }], minimizeIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "minimizeIcon", required: false }] }], closeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeAriaLabel", required: false }] }], maximizeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "maximizeAriaLabel", required: false }] }], styleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "styleClass", required: false }] }], maskStyleClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "maskStyleClass", required: false }] }], dialogStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "dialogStyle", required: false }] }], breakpoints: [{ type: i0.Input, args: [{ isSignal: true, alias: "breakpoints", required: false }] }], autoZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoZIndex", required: false }] }], baseZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseZIndex", required: false }] }], motion: [{ type: i0.Input, args: [{ isSignal: true, alias: "motion", required: false }] }], motionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "motionDisabled", required: false }] }], headerTemplate: [{ type: i0.ContentChild, args: ['header', { isSignal: true }] }], footerTemplate: [{ type: i0.ContentChild, args: ['footer', { isSignal: true }] }], closeIconTemplate: [{ type: i0.ContentChild, args: ['closeicon', { isSignal: true }] }], shown: [{ type: i0.Output, args: ["shown"] }], hidden: [{ type: i0.Output, args: ["hidden"] }], maximizedChange: [{ type: i0.Output, args: ["maximizedChange"] }], dragEnd: [{ type: i0.Output, args: ["dragEnd"] }], resizeEnd: [{ type: i0.Output, args: ["resizeEnd"] }], dialogRef: [{ type: i0.ViewChild, args: ['dialog', { isSignal: true }] }], scrimRef: [{ type: i0.ViewChild, args: ['scrim', { isSignal: true }] }] } });
|
|
545
|
+
|
|
546
|
+
/*
|
|
547
|
+
* Public API Surface of ui-kit/ui-modal
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* Generated bundle index. Do not edit.
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
export { UiModal };
|
|
555
|
+
//# sourceMappingURL=4sh-ui-kit-ui-modal.mjs.map
|