@ckui/core 0.1.0-next.2 → 0.1.0-next.3

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.
@@ -0,0 +1,342 @@
1
+ import { CK_DIALOG_DATA, CkDialogActions, CkDialogActions as CkDialogActions$1, CkDialogBody, CkDialogBody as CkDialogBody$1, CkDialogClose, CkDialogClose as CkDialogClose$1, CkDialogDescription, CkDialogDescription as CkDialogDescription$1, CkDialogInitialFocus, CkDialogInitialFocus as CkDialogInitialFocus$1, CkDialogRef, CkDialogTitle, CkDialogTitle as CkDialogTitle$1 } from "@ckui/core/dialog";
2
+ import { isPlatformBrowser } from "@angular/common";
3
+ import * as i0 from "@angular/core";
4
+ import { ChangeDetectionStrategy, Component, DestroyRef, Injectable, PLATFORM_ID, TemplateRef, ViewEncapsulation, afterRenderEffect, booleanAttribute, contentChild, inject, input, model, output, untracked } from "@angular/core";
5
+ import { CkMedia } from "@ckui/core/internal";
6
+ import { CkDialogOpener } from "@ckui/core/internal/dialog";
7
+ var CkDrawer = class CkDrawer {
8
+ opener = new CkDialogOpener();
9
+ media = inject(CkMedia);
10
+ open(content, config = {}) {
11
+ const requested = config.mode ?? "auto";
12
+ const mode = requested === "auto" ? this.media.sheet() ? "sheet" : "side" : requested;
13
+ return this.opener.open(content, {
14
+ kind: "CkDrawer",
15
+ mode,
16
+ side: config.side ?? "end",
17
+ data: config.data,
18
+ role: config.role ?? "dialog",
19
+ dismissible: config.dismissible ?? true,
20
+ closeButton: config.closeButton ?? true,
21
+ fullHeight: config.fullHeight ?? false,
22
+ injector: config.injector,
23
+ ariaLabel: config.ariaLabel,
24
+ panelClass: ["ck-drawer-panel", `ck-drawer-panel--${config.width ?? "md"}`]
25
+ });
26
+ }
27
+ closeAll() {
28
+ this.opener.closeAll();
29
+ }
30
+ static ɵfac = i0.ɵɵngDeclareFactory({
31
+ minVersion: "12.0.0",
32
+ version: "22.2.4",
33
+ ngImport: i0,
34
+ type: CkDrawer,
35
+ deps: [],
36
+ target: i0.ɵɵFactoryTarget.Injectable
37
+ });
38
+ static ɵprov = i0.ɵɵngDeclareInjectable({
39
+ minVersion: "12.0.0",
40
+ version: "22.2.4",
41
+ ngImport: i0,
42
+ type: CkDrawer,
43
+ providedIn: "root"
44
+ });
45
+ };
46
+ i0.ɵɵngDeclareClassMetadata({
47
+ minVersion: "12.0.0",
48
+ version: "22.2.4",
49
+ ngImport: i0,
50
+ type: CkDrawer,
51
+ decorators: [{
52
+ type: Injectable,
53
+ args: [{ providedIn: "root" }]
54
+ }]
55
+ });
56
+ var CkDrawerComponent = class CkDrawerComponent {
57
+ open = model(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
58
+ side = input("end", ...ngDevMode ? [{ debugName: "side" }] : /* istanbul ignore next */ []);
59
+ mode = input("auto", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
60
+ role = input("dialog", ...ngDevMode ? [{ debugName: "role" }] : /* istanbul ignore next */ []);
61
+ width = input("md", ...ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []);
62
+ dismissible = input(true, {
63
+ ...ngDevMode ? { debugName: "dismissible" } : /* istanbul ignore next */ {},
64
+ transform: booleanAttribute
65
+ });
66
+ closeButton = input(true, {
67
+ ...ngDevMode ? { debugName: "closeButton" } : /* istanbul ignore next */ {},
68
+ transform: booleanAttribute
69
+ });
70
+ fullHeight = input(false, {
71
+ ...ngDevMode ? { debugName: "fullHeight" } : /* istanbul ignore next */ {},
72
+ transform: booleanAttribute
73
+ });
74
+ ariaLabel = input(void 0, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
75
+ closed = output();
76
+ template = contentChild(TemplateRef, ...ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []);
77
+ drawer = inject(CkDrawer);
78
+ isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
79
+ ref = null;
80
+ destroyed = false;
81
+ constructor() {
82
+ inject(DestroyRef).onDestroy(() => {
83
+ this.destroyed = true;
84
+ this.ref?.close();
85
+ this.ref = null;
86
+ });
87
+ afterRenderEffect(() => {
88
+ const wanted = this.open();
89
+ if (!this.isBrowser) return;
90
+ untracked(() => this.sync(wanted));
91
+ });
92
+ }
93
+ sync(wanted) {
94
+ if (wanted && !this.ref) this.show();
95
+ else if (!wanted && this.ref) {
96
+ const ref = this.ref;
97
+ this.ref = null;
98
+ ref.close();
99
+ }
100
+ }
101
+ show() {
102
+ const template = this.template();
103
+ if (!template) {
104
+ if (typeof ngDevMode !== "undefined" && ngDevMode) console.warn("ck-drawer: put the content in an <ng-template> inside the element.");
105
+ this.open.set(false);
106
+ return;
107
+ }
108
+ const ref = this.drawer.open(template, {
109
+ side: this.side(),
110
+ mode: this.mode(),
111
+ role: this.role(),
112
+ width: this.width(),
113
+ dismissible: this.dismissible(),
114
+ closeButton: this.closeButton(),
115
+ fullHeight: this.fullHeight(),
116
+ ariaLabel: this.ariaLabel()
117
+ });
118
+ this.ref = ref;
119
+ ref.closing.then(() => {
120
+ if (!this.destroyed && this.ref === ref) {
121
+ this.ref = null;
122
+ this.open.set(false);
123
+ }
124
+ });
125
+ ref.closed.then((result) => {
126
+ if (!this.destroyed) this.closed.emit(result);
127
+ });
128
+ }
129
+ static ɵfac = i0.ɵɵngDeclareFactory({
130
+ minVersion: "12.0.0",
131
+ version: "22.2.4",
132
+ ngImport: i0,
133
+ type: CkDrawerComponent,
134
+ deps: [],
135
+ target: i0.ɵɵFactoryTarget.Component
136
+ });
137
+ static ɵcmp = i0.ɵɵngDeclareComponent({
138
+ minVersion: "17.2.0",
139
+ version: "22.2.4",
140
+ type: CkDrawerComponent,
141
+ isStandalone: true,
142
+ selector: "ck-drawer",
143
+ inputs: {
144
+ open: {
145
+ classPropertyName: "open",
146
+ publicName: "open",
147
+ isSignal: true,
148
+ isRequired: false,
149
+ transformFunction: null
150
+ },
151
+ side: {
152
+ classPropertyName: "side",
153
+ publicName: "side",
154
+ isSignal: true,
155
+ isRequired: false,
156
+ transformFunction: null
157
+ },
158
+ mode: {
159
+ classPropertyName: "mode",
160
+ publicName: "mode",
161
+ isSignal: true,
162
+ isRequired: false,
163
+ transformFunction: null
164
+ },
165
+ role: {
166
+ classPropertyName: "role",
167
+ publicName: "role",
168
+ isSignal: true,
169
+ isRequired: false,
170
+ transformFunction: null
171
+ },
172
+ width: {
173
+ classPropertyName: "width",
174
+ publicName: "width",
175
+ isSignal: true,
176
+ isRequired: false,
177
+ transformFunction: null
178
+ },
179
+ dismissible: {
180
+ classPropertyName: "dismissible",
181
+ publicName: "dismissible",
182
+ isSignal: true,
183
+ isRequired: false,
184
+ transformFunction: null
185
+ },
186
+ closeButton: {
187
+ classPropertyName: "closeButton",
188
+ publicName: "closeButton",
189
+ isSignal: true,
190
+ isRequired: false,
191
+ transformFunction: null
192
+ },
193
+ fullHeight: {
194
+ classPropertyName: "fullHeight",
195
+ publicName: "fullHeight",
196
+ isSignal: true,
197
+ isRequired: false,
198
+ transformFunction: null
199
+ },
200
+ ariaLabel: {
201
+ classPropertyName: "ariaLabel",
202
+ publicName: "ariaLabel",
203
+ isSignal: true,
204
+ isRequired: false,
205
+ transformFunction: null
206
+ }
207
+ },
208
+ outputs: {
209
+ open: "openChange",
210
+ closed: "closed"
211
+ },
212
+ host: { styleAttribute: "display: none" },
213
+ queries: [{
214
+ propertyName: "template",
215
+ first: true,
216
+ predicate: TemplateRef,
217
+ descendants: true,
218
+ isSignal: true
219
+ }],
220
+ ngImport: i0,
221
+ template: ``,
222
+ isInline: true,
223
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
224
+ encapsulation: i0.ViewEncapsulation.None
225
+ });
226
+ };
227
+ i0.ɵɵngDeclareClassMetadata({
228
+ minVersion: "12.0.0",
229
+ version: "22.2.4",
230
+ ngImport: i0,
231
+ type: CkDrawerComponent,
232
+ decorators: [{
233
+ type: Component,
234
+ args: [{
235
+ selector: "ck-drawer",
236
+ changeDetection: ChangeDetectionStrategy.OnPush,
237
+ encapsulation: ViewEncapsulation.None,
238
+ host: { style: "display: none" },
239
+ template: ``
240
+ }]
241
+ }],
242
+ ctorParameters: () => [],
243
+ propDecorators: {
244
+ open: [{
245
+ type: i0.Input,
246
+ args: [{
247
+ isSignal: true,
248
+ alias: "open",
249
+ required: false
250
+ }]
251
+ }, {
252
+ type: i0.Output,
253
+ args: ["openChange"]
254
+ }],
255
+ side: [{
256
+ type: i0.Input,
257
+ args: [{
258
+ isSignal: true,
259
+ alias: "side",
260
+ required: false
261
+ }]
262
+ }],
263
+ mode: [{
264
+ type: i0.Input,
265
+ args: [{
266
+ isSignal: true,
267
+ alias: "mode",
268
+ required: false
269
+ }]
270
+ }],
271
+ role: [{
272
+ type: i0.Input,
273
+ args: [{
274
+ isSignal: true,
275
+ alias: "role",
276
+ required: false
277
+ }]
278
+ }],
279
+ width: [{
280
+ type: i0.Input,
281
+ args: [{
282
+ isSignal: true,
283
+ alias: "width",
284
+ required: false
285
+ }]
286
+ }],
287
+ dismissible: [{
288
+ type: i0.Input,
289
+ args: [{
290
+ isSignal: true,
291
+ alias: "dismissible",
292
+ required: false
293
+ }]
294
+ }],
295
+ closeButton: [{
296
+ type: i0.Input,
297
+ args: [{
298
+ isSignal: true,
299
+ alias: "closeButton",
300
+ required: false
301
+ }]
302
+ }],
303
+ fullHeight: [{
304
+ type: i0.Input,
305
+ args: [{
306
+ isSignal: true,
307
+ alias: "fullHeight",
308
+ required: false
309
+ }]
310
+ }],
311
+ ariaLabel: [{
312
+ type: i0.Input,
313
+ args: [{
314
+ isSignal: true,
315
+ alias: "ariaLabel",
316
+ required: false
317
+ }]
318
+ }],
319
+ closed: [{
320
+ type: i0.Output,
321
+ args: ["closed"]
322
+ }],
323
+ template: [{
324
+ type: i0.ContentChild,
325
+ args: [i0.forwardRef(() => TemplateRef), { isSignal: true }]
326
+ }]
327
+ }
328
+ });
329
+ const CK_DRAWER_DATA = CK_DIALOG_DATA;
330
+ const CkDrawerRef = CkDialogRef;
331
+ const CK_DRAWER_IMPORTS = [
332
+ CkDrawerComponent,
333
+ CkDialogTitle$1,
334
+ CkDialogDescription$1,
335
+ CkDialogBody$1,
336
+ CkDialogActions$1,
337
+ CkDialogClose$1,
338
+ CkDialogInitialFocus$1
339
+ ];
340
+ export { CK_DRAWER_DATA, CK_DRAWER_IMPORTS, CkDialogActions, CkDialogBody, CkDialogClose, CkDialogDescription, CkDialogInitialFocus, CkDialogTitle, CkDrawer, CkDrawerComponent, CkDrawerRef };
341
+
342
+ //# sourceMappingURL=ckui-core-drawer.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ckui-core-drawer.mjs","names":["CkDialogTitle","CkDialogDescription","CkDialogBody","CkDialogActions","CkDialogClose","CkDialogInitialFocus"],"sources":["../../../../projects/core/drawer/drawer.service.ts","../../../../projects/core/drawer/drawer.component.ts","../../../../projects/core/drawer/drawer-ref.ts","../../../../projects/core/drawer/index.ts"],"sourcesContent":["import { ComponentType } from '@angular/cdk/portal';\nimport { Injectable, TemplateRef, inject } from '@angular/core';\nimport { CkMedia } from '@ckui/core/internal';\nimport { CkDialogOpener } from '@ckui/core/internal/dialog';\nimport { CkDrawerConfig } from './config';\nimport { CkDrawerRef } from './drawer-ref';\n\n/**\n * Opens drawers: a full-height panel that slides in from the side, or a bottom sheet on a phone.\n * Takes a component or a template as content and returns a `CkDrawerRef` (the dialog's ref) that\n * closes it and delivers the result.\n */\n@Injectable({ providedIn: 'root' })\nexport class CkDrawer {\n private readonly opener = new CkDialogOpener();\n private readonly media = inject(CkMedia);\n\n /**\n * Opens a drawer. The content injects `CK_DRAWER_DATA` and `CkDrawerRef`; a component sees the\n * app's providers, plus those of `config.injector` when given. On the server nothing is shown and\n * `closed` resolves with `undefined` at once.\n */\n open<C, D = unknown, R = unknown>(\n content: ComponentType<C> | TemplateRef<unknown>,\n config: CkDrawerConfig<D> = {},\n ): CkDrawerRef<R> {\n const requested = config.mode ?? 'auto';\n const mode = requested === 'auto' ? (this.media.sheet() ? 'sheet' : 'side') : requested;\n return this.opener.open<C, D, R>(content, {\n kind: 'CkDrawer',\n mode,\n side: config.side ?? 'end',\n data: config.data,\n role: config.role ?? 'dialog',\n dismissible: config.dismissible ?? true,\n closeButton: config.closeButton ?? true,\n fullHeight: config.fullHeight ?? false,\n injector: config.injector,\n ariaLabel: config.ariaLabel,\n panelClass: ['ck-drawer-panel', `ck-drawer-panel--${config.width ?? 'md'}`],\n });\n }\n\n /** Closes every open drawer as if each one's `close()` had been called without a result. */\n closeAll(): void {\n this.opener.closeAll();\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n PLATFORM_ID,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n booleanAttribute,\n contentChild,\n inject,\n input,\n model,\n output,\n untracked,\n} from '@angular/core';\nimport { CkDialogRole } from '@ckui/core/dialog';\nimport { CkDrawerMode, CkDrawerSide, CkDrawerWidth } from './config';\nimport { CkDrawerRef } from './drawer-ref';\nimport { CkDrawer } from './drawer.service';\n\ndeclare const ngDevMode: unknown;\n\n/**\n * A drawer declared in a template. Its content is one `<ng-template>` that is only rendered while\n * `open` is true, so nothing in it exists while the drawer is closed. `[(open)]` follows the drawer:\n * Escape, the backdrop, the close button and `[ckDialogClose]` set it back to `false`.\n */\n@Component({\n selector: 'ck-drawer',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: { style: 'display: none' },\n template: ``,\n})\nexport class CkDrawerComponent {\n readonly open = model(false);\n readonly side = input<CkDrawerSide>('end');\n readonly mode = input<CkDrawerMode>('auto');\n readonly role = input<CkDialogRole>('dialog');\n readonly width = input<CkDrawerWidth>('md');\n readonly dismissible = input(true, { transform: booleanAttribute });\n readonly closeButton = input(true, { transform: booleanAttribute });\n readonly fullHeight = input(false, { transform: booleanAttribute });\n readonly ariaLabel = input<string | undefined>(undefined);\n /** Emits when the drawer has left the screen, with the result of `[ckDialogClose]`, else `undefined`. */\n readonly closed = output<unknown>();\n\n private readonly template = contentChild(TemplateRef);\n private readonly drawer = inject(CkDrawer);\n private readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));\n private ref: CkDrawerRef | null = null;\n private destroyed = false;\n\n constructor() {\n inject(DestroyRef).onDestroy(() => {\n this.destroyed = true;\n this.ref?.close();\n this.ref = null;\n });\n // After render: never on the server, and never while a template is being checked.\n afterRenderEffect(() => {\n const wanted = this.open();\n if (!this.isBrowser) {\n return;\n }\n untracked(() => this.sync(wanted));\n });\n }\n\n private sync(wanted: boolean): void {\n if (wanted && !this.ref) {\n this.show();\n } else if (!wanted && this.ref) {\n const ref = this.ref;\n this.ref = null;\n ref.close();\n }\n }\n\n private show(): void {\n const template = this.template();\n if (!template) {\n if (typeof ngDevMode !== 'undefined' && ngDevMode) {\n console.warn('ck-drawer: put the content in an <ng-template> inside the element.');\n }\n this.open.set(false);\n return;\n }\n const ref = this.drawer.open(template, {\n side: this.side(),\n mode: this.mode(),\n role: this.role(),\n width: this.width(),\n dismissible: this.dismissible(),\n closeButton: this.closeButton(),\n fullHeight: this.fullHeight(),\n ariaLabel: this.ariaLabel(),\n });\n this.ref = ref;\n // `open` follows the moment the close starts, so the opener can reopen during the leave animation.\n void ref.closing.then(() => {\n if (!this.destroyed && this.ref === ref) {\n this.ref = null;\n this.open.set(false);\n }\n });\n void ref.closed.then((result) => {\n if (!this.destroyed) {\n this.closed.emit(result);\n }\n });\n }\n}\n","import { CK_DIALOG_DATA, CkDialogRef } from '@ckui/core/dialog';\n\n/**\n * What a component opened with `CkDrawer` injects for its `data`. It is the dialog's data token,\n * so content written for a dialog works unchanged in a drawer.\n */\nexport const CK_DRAWER_DATA = CK_DIALOG_DATA;\n\n/**\n * The ref of an open drawer: `close(result?)`, `closed` and `closing`. It is the dialog's ref, so\n * `inject(CkDrawerRef)` works inside the drawer's content.\n */\nexport const CkDrawerRef = CkDialogRef;\nexport type CkDrawerRef<R = unknown> = CkDialogRef<R>;\n","import {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from '@ckui/core/dialog';\nimport { CkDrawerComponent } from './drawer.component';\n\nexport type { CkDrawerConfig, CkDrawerMode, CkDrawerSide, CkDrawerWidth } from './config';\nexport { CkDrawer } from './drawer.service';\nexport { CkDrawerComponent } from './drawer.component';\nexport {\n CkDialogActions,\n CkDialogBody,\n CkDialogClose,\n CkDialogDescription,\n CkDialogInitialFocus,\n CkDialogTitle,\n} from '@ckui/core/dialog';\n\nexport { CK_DRAWER_DATA, CkDrawerRef } from './drawer-ref';\n\n/**\n * Everything a template needs for a drawer: `imports: [CK_DRAWER_IMPORTS]`. The building blocks\n * are the dialog's: `ckDialogTitle`, `ckDialogDescription`, `ck-dialog-body`,\n * `ck-dialog-actions`, `ckDialogClose` and `ckDialogInitialFocus`.\n */\nexport const CK_DRAWER_IMPORTS = [\n CkDrawerComponent,\n CkDialogTitle,\n CkDialogDescription,\n CkDialogBody,\n CkDialogActions,\n CkDialogClose,\n CkDialogInitialFocus,\n] as const;\n"],"mappings":";;;;;;AAaA,IAAa,WAAb,MAAa,SAAQ;CACF,SAAS,IAAI,eAAc;CAC3B,QAAQ,OAAO,OAAO;CAOvC,KACE,SACA,SAA4B,CAAA,GAAE;EAE9B,MAAM,YAAY,OAAO,QAAQ;EACjC,MAAM,OAAO,cAAc,SAAU,KAAK,MAAM,MAAK,IAAK,UAAU,SAAU;EAC9E,OAAO,KAAK,OAAO,KAAc,SAAS;GACxC,MAAM;GACN;GACA,MAAM,OAAO,QAAQ;GACrB,MAAM,OAAO;GACb,MAAM,OAAO,QAAQ;GACrB,aAAa,OAAO,eAAe;GACnC,aAAa,OAAO,eAAe;GACnC,YAAY,OAAO,cAAc;GACjC,UAAU,OAAO;GACjB,WAAW,OAAO;GAClB,YAAY,CAAC,mBAAmB,oBAAoB,OAAO,SAAS,MAAM;EAC3E,CAAA;CACH;CAGA,WAA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A,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,WAAW,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AC3CtD,MAAa,iBAAiB;AAM9B,MAAa,cAAc;ACiB3B,MAAa,oBAAoB;CAC/B;CACAA;CACAC;CACAC;CACAC;CACAC;CACAC;AACQ"}
@@ -0,0 +1,296 @@
1
+ import * as i0 from "@angular/core";
2
+ import { ChangeDetectionStrategy, Component, DestroyRef, InjectionToken, Injector, TemplateRef, ViewContainerRef, ViewEncapsulation, computed, effect, inject, signal } from "@angular/core";
3
+ import { CdkPortalOutlet, ComponentPortal, TemplatePortal } from "@angular/cdk/portal";
4
+ import { CK_LABELS } from "@ckui/core";
5
+ import { CkButton } from "@ckui/core/button";
6
+ import { CkIcon } from "@ckui/core/internal";
7
+ import { InteractivityChecker } from "@angular/cdk/a11y";
8
+ import { CkOverlayHost } from "@ckui/core/internal/overlay";
9
+ var CkDialogIds = class {
10
+ entries = signal([], ...ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []);
11
+ current = computed(() => this.entries().at(-1)?.() ?? null, ...ngDevMode ? [{ debugName: "current" }] : /* istanbul ignore next */ []);
12
+ add(id) {
13
+ this.entries.update((entries) => [...entries, id]);
14
+ return () => this.entries.update((entries) => entries.filter((entry) => entry !== id));
15
+ }
16
+ };
17
+ var CkDialogContext = class {
18
+ titles = new CkDialogIds();
19
+ descriptions = new CkDialogIds();
20
+ titleId = this.titles.current;
21
+ descriptionId = this.descriptions.current;
22
+ mode = signal("modal", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
23
+ };
24
+ const CK_DIALOG_CONTEXT = new InjectionToken("CK_DIALOG_CONTEXT");
25
+ var CkDialogRef = class {
26
+ closed;
27
+ closing;
28
+ controls;
29
+ constructor(controls) {
30
+ this.controls = controls;
31
+ this.closed = controls.closed;
32
+ this.closing = controls.closing;
33
+ }
34
+ close(result) {
35
+ this.controls.close(result);
36
+ }
37
+ };
38
+ const CK_DIALOG_SETUP = new InjectionToken("CK_DIALOG_SETUP");
39
+ var CkDialogContainer = class CkDialogContainer {
40
+ context = inject(CK_DIALOG_CONTEXT);
41
+ setup = inject(CK_DIALOG_SETUP);
42
+ labels = inject(CK_LABELS);
43
+ ref = inject(CkDialogRef);
44
+ portal;
45
+ constructor() {
46
+ const injector = inject(Injector);
47
+ this.portal = this.setup.content instanceof TemplateRef ? new TemplatePortal(this.setup.content, inject(ViewContainerRef), void 0, injector) : new ComponentPortal(this.setup.content, null, injector);
48
+ }
49
+ onAttached(attached) {
50
+ if (attached && "location" in attached) attached.location.nativeElement.classList.add("ck-dialog__component");
51
+ }
52
+ static ɵfac = i0.ɵɵngDeclareFactory({
53
+ minVersion: "12.0.0",
54
+ version: "22.2.4",
55
+ ngImport: i0,
56
+ type: CkDialogContainer,
57
+ deps: [],
58
+ target: i0.ɵɵFactoryTarget.Component
59
+ });
60
+ static ɵcmp = i0.ɵɵngDeclareComponent({
61
+ minVersion: "17.0.0",
62
+ version: "22.2.4",
63
+ type: CkDialogContainer,
64
+ isStandalone: true,
65
+ selector: "ck-dialog-container",
66
+ host: {
67
+ properties: {
68
+ "class.ck-dialog--sheet": "context.mode() === \"sheet\"",
69
+ "class.ck-dialog--side": "context.mode() === \"side\"",
70
+ "class.ck-dialog--grab": "context.mode() === \"sheet\" && setup.dismissible",
71
+ "class.ck-dialog--has-close": "setup.closeButton",
72
+ "class.ck-dialog--no-title": "context.titleId() === null"
73
+ },
74
+ classAttribute: "ck-dialog"
75
+ },
76
+ ngImport: i0,
77
+ template: `
78
+ <div class="ck-dialog__content">
79
+ <ng-template [cdkPortalOutlet]="portal" (attached)="onAttached($event)" />
80
+ </div>
81
+ @if (setup.closeButton) {
82
+ <button
83
+ ckButton
84
+ type="button"
85
+ variant="ghost"
86
+ size="md"
87
+ iconOnly
88
+ class="ck-dialog__close"
89
+ [attr.aria-label]="labels().close"
90
+ (click)="ref.close()"
91
+ >
92
+ <ck-icon name="close" />
93
+ </button>
94
+ }
95
+ `,
96
+ isInline: true,
97
+ styles: ["@layer ckui{.ck-dialog-panel{box-sizing:border-box;inline-size:min(var(--ck-dialog-max-width, var(--_ck-dialog-width, 32rem)),100%);border-radius:var(--ck-dialog-radius, var(--ck-radius-xl));background:var(--ck-dialog-bg, var(--ck-color-surface-raised));color:var(--ck-color-fg);color-scheme:var(--ck-color-scheme);box-shadow:var(--ck-dialog-shadow, var(--ck-shadow-lg));font-family:var(--ck-font-sans);font-size:var(--ck-font-size-md);line-height:var(--ck-line-height-normal);outline:none}.ck-dialog-panel:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-dialog-panel--sm{--_ck-dialog-width: 24rem}.ck-dialog-panel--md{--_ck-dialog-width: 32rem}.ck-dialog-panel--lg{--_ck-dialog-width: 48rem}.ck-dialog-panel.ck-overlay--sheet{border-end-start-radius:0;border-end-end-radius:0}.ck-dialog-panel .ck-overlay-grab{border-start-start-radius:var(--ck-dialog-radius, var(--ck-radius-xl));border-start-end-radius:var(--ck-dialog-radius, var(--ck-radius-xl));background:var(--ck-dialog-bg, var(--ck-color-surface-raised))}.ck-dialog{--_ck-dialog-padding: var(--ck-dialog-padding, var(--ck-space-6));--_ck-dialog-padding-top: var(--_ck-dialog-padding);position:relative;display:flex;flex-direction:column;box-sizing:border-box;min-block-size:0;padding:var(--_ck-dialog-padding);padding-block-start:var(--_ck-dialog-padding-top)}.ck-dialog--sheet{--_ck-dialog-padding: var(--ck-dialog-padding, var(--ck-space-4));padding-block-end:calc(var(--_ck-dialog-padding) + env(safe-area-inset-bottom,0px))}.ck-dialog--grab{--_ck-dialog-padding-top: 0px}.ck-dialog__content,.ck-dialog__component{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--ck-space-4);min-block-size:0;min-inline-size:0}.ck-dialog--has-close.ck-dialog--no-title .ck-dialog__content{padding-block-start:var(--ck-control-height-md)}.ck-dialog>.ck-dialog__close{position:absolute;inset-block-start:var(--_ck-dialog-padding-top);inset-inline-end:var(--_ck-dialog-padding)}.ck-dialog__title{margin:0;font-size:var(--ck-font-size-xl);font-weight:var(--ck-font-weight-semibold);line-height:var(--ck-line-height-tight);overflow-wrap:break-word}.ck-dialog--has-close .ck-dialog__title{display:block;align-content:center;min-block-size:var(--ck-control-height-md);padding-inline-end:calc(var(--ck-control-height-md) + var(--ck-space-2))}.ck-dialog__description{margin:0;color:var(--ck-color-fg-muted);overflow-wrap:break-word}.ck-dialog-body{display:block;flex:1 1 auto;min-block-size:0;overflow-y:auto;overscroll-behavior:contain;margin:calc(-1 * var(--ck-space-2));padding:var(--ck-space-2)}.ck-dialog-body__inner{display:flow-root;overflow-wrap:break-word}.ck-dialog-body:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-dialog-actions{display:flex;flex:none;flex-wrap:wrap;justify-content:flex-end;margin-block-start:auto;gap:var(--ck-space-2)}.ck-dialog--sheet .ck-dialog-actions{flex-direction:column;flex-wrap:nowrap;align-items:stretch}}\n", "@layer ckui{.ck-drawer-panel{box-sizing:border-box;background:var(--ck-drawer-bg, var(--ck-color-surface-raised));color:var(--ck-color-fg);color-scheme:var(--ck-color-scheme);box-shadow:var(--ck-drawer-shadow, var(--ck-shadow-lg));font-family:var(--ck-font-sans);font-size:var(--ck-font-size-md);line-height:var(--ck-line-height-normal);outline:none}.ck-drawer-panel:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-drawer-panel--sm{--_ck-drawer-width: 20rem}.ck-drawer-panel--md{--_ck-drawer-width: 24rem}.ck-drawer-panel--lg{--_ck-drawer-width: 32rem}.ck-drawer-panel.ck-overlay--side{inline-size:min(var(--ck-drawer-width, var(--_ck-drawer-width, 24rem)),100%)}.ck-drawer-panel.ck-overlay--right{padding-right:env(safe-area-inset-right,0px)}.ck-drawer-panel.ck-overlay--left{padding-left:env(safe-area-inset-left,0px)}.ck-drawer-panel.ck-overlay--sheet{border-start-start-radius:var(--ck-radius-xl);border-start-end-radius:var(--ck-radius-xl)}.ck-drawer-panel .ck-overlay-grab{border-start-start-radius:var(--ck-radius-xl);border-start-end-radius:var(--ck-radius-xl);background:var(--ck-drawer-bg, var(--ck-color-surface-raised))}.ck-drawer-panel .ck-dialog{--_ck-dialog-padding: var(--ck-drawer-padding, var(--ck-space-6))}.ck-drawer-panel .ck-dialog--sheet{--_ck-dialog-padding: var(--ck-drawer-padding, var(--ck-space-4))}.ck-drawer-panel .ck-dialog--side{--_ck-dialog-padding-top: calc(var(--_ck-dialog-padding) + env(safe-area-inset-top, 0px));padding-block-end:calc(var(--_ck-dialog-padding) + env(safe-area-inset-bottom,0px))}}\n"],
98
+ dependencies: [
99
+ {
100
+ kind: "directive",
101
+ type: CdkPortalOutlet,
102
+ selector: "[cdkPortalOutlet]",
103
+ inputs: ["cdkPortalOutlet"],
104
+ outputs: ["attached"],
105
+ exportAs: ["cdkPortalOutlet"]
106
+ },
107
+ {
108
+ kind: "component",
109
+ type: CkButton,
110
+ selector: "button[ckButton], a[ckButton]",
111
+ inputs: [
112
+ "variant",
113
+ "size",
114
+ "iconOnly",
115
+ "loading",
116
+ "disabled"
117
+ ]
118
+ },
119
+ {
120
+ kind: "component",
121
+ type: CkIcon,
122
+ selector: "ck-icon",
123
+ inputs: ["name"]
124
+ }
125
+ ],
126
+ changeDetection: i0.ChangeDetectionStrategy.OnPush,
127
+ encapsulation: i0.ViewEncapsulation.None
128
+ });
129
+ };
130
+ i0.ɵɵngDeclareClassMetadata({
131
+ minVersion: "12.0.0",
132
+ version: "22.2.4",
133
+ ngImport: i0,
134
+ type: CkDialogContainer,
135
+ decorators: [{
136
+ type: Component,
137
+ args: [{
138
+ selector: "ck-dialog-container",
139
+ imports: [
140
+ CdkPortalOutlet,
141
+ CkButton,
142
+ CkIcon
143
+ ],
144
+ changeDetection: ChangeDetectionStrategy.OnPush,
145
+ encapsulation: ViewEncapsulation.None,
146
+ host: {
147
+ class: "ck-dialog",
148
+ "[class.ck-dialog--sheet]": "context.mode() === \"sheet\"",
149
+ "[class.ck-dialog--side]": "context.mode() === \"side\"",
150
+ "[class.ck-dialog--grab]": "context.mode() === \"sheet\" && setup.dismissible",
151
+ "[class.ck-dialog--has-close]": "setup.closeButton",
152
+ "[class.ck-dialog--no-title]": "context.titleId() === null"
153
+ },
154
+ template: `
155
+ <div class="ck-dialog__content">
156
+ <ng-template [cdkPortalOutlet]="portal" (attached)="onAttached($event)" />
157
+ </div>
158
+ @if (setup.closeButton) {
159
+ <button
160
+ ckButton
161
+ type="button"
162
+ variant="ghost"
163
+ size="md"
164
+ iconOnly
165
+ class="ck-dialog__close"
166
+ [attr.aria-label]="labels().close"
167
+ (click)="ref.close()"
168
+ >
169
+ <ck-icon name="close" />
170
+ </button>
171
+ }
172
+ `,
173
+ styles: ["@layer ckui{.ck-dialog-panel{box-sizing:border-box;inline-size:min(var(--ck-dialog-max-width, var(--_ck-dialog-width, 32rem)),100%);border-radius:var(--ck-dialog-radius, var(--ck-radius-xl));background:var(--ck-dialog-bg, var(--ck-color-surface-raised));color:var(--ck-color-fg);color-scheme:var(--ck-color-scheme);box-shadow:var(--ck-dialog-shadow, var(--ck-shadow-lg));font-family:var(--ck-font-sans);font-size:var(--ck-font-size-md);line-height:var(--ck-line-height-normal);outline:none}.ck-dialog-panel:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-dialog-panel--sm{--_ck-dialog-width: 24rem}.ck-dialog-panel--md{--_ck-dialog-width: 32rem}.ck-dialog-panel--lg{--_ck-dialog-width: 48rem}.ck-dialog-panel.ck-overlay--sheet{border-end-start-radius:0;border-end-end-radius:0}.ck-dialog-panel .ck-overlay-grab{border-start-start-radius:var(--ck-dialog-radius, var(--ck-radius-xl));border-start-end-radius:var(--ck-dialog-radius, var(--ck-radius-xl));background:var(--ck-dialog-bg, var(--ck-color-surface-raised))}.ck-dialog{--_ck-dialog-padding: var(--ck-dialog-padding, var(--ck-space-6));--_ck-dialog-padding-top: var(--_ck-dialog-padding);position:relative;display:flex;flex-direction:column;box-sizing:border-box;min-block-size:0;padding:var(--_ck-dialog-padding);padding-block-start:var(--_ck-dialog-padding-top)}.ck-dialog--sheet{--_ck-dialog-padding: var(--ck-dialog-padding, var(--ck-space-4));padding-block-end:calc(var(--_ck-dialog-padding) + env(safe-area-inset-bottom,0px))}.ck-dialog--grab{--_ck-dialog-padding-top: 0px}.ck-dialog__content,.ck-dialog__component{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--ck-space-4);min-block-size:0;min-inline-size:0}.ck-dialog--has-close.ck-dialog--no-title .ck-dialog__content{padding-block-start:var(--ck-control-height-md)}.ck-dialog>.ck-dialog__close{position:absolute;inset-block-start:var(--_ck-dialog-padding-top);inset-inline-end:var(--_ck-dialog-padding)}.ck-dialog__title{margin:0;font-size:var(--ck-font-size-xl);font-weight:var(--ck-font-weight-semibold);line-height:var(--ck-line-height-tight);overflow-wrap:break-word}.ck-dialog--has-close .ck-dialog__title{display:block;align-content:center;min-block-size:var(--ck-control-height-md);padding-inline-end:calc(var(--ck-control-height-md) + var(--ck-space-2))}.ck-dialog__description{margin:0;color:var(--ck-color-fg-muted);overflow-wrap:break-word}.ck-dialog-body{display:block;flex:1 1 auto;min-block-size:0;overflow-y:auto;overscroll-behavior:contain;margin:calc(-1 * var(--ck-space-2));padding:var(--ck-space-2)}.ck-dialog-body__inner{display:flow-root;overflow-wrap:break-word}.ck-dialog-body:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-dialog-actions{display:flex;flex:none;flex-wrap:wrap;justify-content:flex-end;margin-block-start:auto;gap:var(--ck-space-2)}.ck-dialog--sheet .ck-dialog-actions{flex-direction:column;flex-wrap:nowrap;align-items:stretch}}\n", "@layer ckui{.ck-drawer-panel{box-sizing:border-box;background:var(--ck-drawer-bg, var(--ck-color-surface-raised));color:var(--ck-color-fg);color-scheme:var(--ck-color-scheme);box-shadow:var(--ck-drawer-shadow, var(--ck-shadow-lg));font-family:var(--ck-font-sans);font-size:var(--ck-font-size-md);line-height:var(--ck-line-height-normal);outline:none}.ck-drawer-panel:focus-visible{outline:var(--ck-focus-ring);outline-offset:calc(-1 * var(--ck-focus-ring-width, 2px))}.ck-drawer-panel--sm{--_ck-drawer-width: 20rem}.ck-drawer-panel--md{--_ck-drawer-width: 24rem}.ck-drawer-panel--lg{--_ck-drawer-width: 32rem}.ck-drawer-panel.ck-overlay--side{inline-size:min(var(--ck-drawer-width, var(--_ck-drawer-width, 24rem)),100%)}.ck-drawer-panel.ck-overlay--right{padding-right:env(safe-area-inset-right,0px)}.ck-drawer-panel.ck-overlay--left{padding-left:env(safe-area-inset-left,0px)}.ck-drawer-panel.ck-overlay--sheet{border-start-start-radius:var(--ck-radius-xl);border-start-end-radius:var(--ck-radius-xl)}.ck-drawer-panel .ck-overlay-grab{border-start-start-radius:var(--ck-radius-xl);border-start-end-radius:var(--ck-radius-xl);background:var(--ck-drawer-bg, var(--ck-color-surface-raised))}.ck-drawer-panel .ck-dialog{--_ck-dialog-padding: var(--ck-drawer-padding, var(--ck-space-6))}.ck-drawer-panel .ck-dialog--sheet{--_ck-dialog-padding: var(--ck-drawer-padding, var(--ck-space-4))}.ck-drawer-panel .ck-dialog--side{--_ck-dialog-padding-top: calc(var(--_ck-dialog-padding) + env(safe-area-inset-top, 0px));padding-block-end:calc(var(--_ck-dialog-padding) + env(safe-area-inset-bottom,0px))}}\n"]
174
+ }]
175
+ }],
176
+ ctorParameters: () => []
177
+ });
178
+ const CK_DIALOG_DATA = new InjectionToken("CK_DIALOG_DATA");
179
+ const TABBABLE_CANDIDATES = "a[href], button, input, select, textarea, summary, [tabindex], [contenteditable], audio[controls], video[controls]";
180
+ var CkDialogOpener = class {
181
+ overlay = inject(CkOverlayHost);
182
+ checker = inject(InteractivityChecker);
183
+ injector = inject(Injector);
184
+ active = /* @__PURE__ */ new Set();
185
+ constructor() {
186
+ inject(DestroyRef).onDestroy(() => {
187
+ for (const dialog of [...this.active]) dialog.destroy();
188
+ this.active.clear();
189
+ });
190
+ }
191
+ open(content, options) {
192
+ const context = new CkDialogContext();
193
+ let resolveClosed = () => void 0;
194
+ const closed = new Promise((resolve) => resolveClosed = resolve);
195
+ let resolveClosing = () => void 0;
196
+ const closing = new Promise((resolve) => resolveClosing = resolve);
197
+ let handle = null;
198
+ let requested = false;
199
+ let result;
200
+ let settled = false;
201
+ let labelling = null;
202
+ const dialog = {
203
+ close: () => ref.close(),
204
+ destroy: () => settle()
205
+ };
206
+ const settle = () => {
207
+ if (settled) return;
208
+ settled = true;
209
+ resolveClosing();
210
+ labelling?.destroy();
211
+ this.active.delete(dialog);
212
+ resolveClosed(result);
213
+ };
214
+ const ref = new CkDialogRef({
215
+ closed,
216
+ closing,
217
+ close: (value) => {
218
+ if (requested) return;
219
+ requested = true;
220
+ result = value;
221
+ resolveClosing();
222
+ handle?.close();
223
+ }
224
+ });
225
+ this.active.add(dialog);
226
+ const dialogInjector = Injector.create({
227
+ parent: options.injector ?? this.injector,
228
+ providers: [
229
+ {
230
+ provide: CK_DIALOG_CONTEXT,
231
+ useValue: context
232
+ },
233
+ {
234
+ provide: CkDialogRef,
235
+ useValue: ref
236
+ },
237
+ {
238
+ provide: CK_DIALOG_DATA,
239
+ useValue: options.data
240
+ },
241
+ {
242
+ provide: CK_DIALOG_SETUP,
243
+ useValue: {
244
+ content,
245
+ closeButton: options.closeButton,
246
+ dismissible: options.dismissible
247
+ }
248
+ }
249
+ ]
250
+ });
251
+ try {
252
+ handle = this.overlay.open(CkDialogContainer, {
253
+ mode: options.mode,
254
+ side: options.side,
255
+ dismissible: options.dismissible,
256
+ fullHeight: options.fullHeight,
257
+ role: options.role,
258
+ ariaLabel: options.ariaLabel,
259
+ panelClass: options.panelClass,
260
+ onDismissRequest: () => ref.close(),
261
+ initialFocus: () => handle ? this.initialFocus(handle.panel) : null
262
+ }, dialogInjector);
263
+ } catch (error) {
264
+ settle();
265
+ throw error;
266
+ }
267
+ const opened = handle;
268
+ context.mode.set(opened.mode);
269
+ labelling = effect(() => {
270
+ this.setAttribute(opened.panel, "aria-labelledby", context.titleId());
271
+ this.setAttribute(opened.panel, "aria-describedby", context.descriptionId());
272
+ }, { injector: this.injector });
273
+ opened.closed.then(settle);
274
+ if (requested) opened.close();
275
+ if (typeof ngDevMode !== "undefined" && ngDevMode) opened.opened.then(() => {
276
+ if (!settled && context.titleId() === null && !options.ariaLabel) console.warn(`${options.kind}: the ${options.kind === "CkDrawer" ? "drawer" : "dialog"} has no accessible name. Add [ckDialogTitle] to a heading in its content or set \`ariaLabel\` in the config.`);
277
+ });
278
+ return ref;
279
+ }
280
+ closeAll() {
281
+ for (const dialog of [...this.active]) dialog.close();
282
+ }
283
+ setAttribute(element, name, value) {
284
+ if (value === null) element.removeAttribute(name);
285
+ else element.setAttribute(name, value);
286
+ }
287
+ initialFocus(panel) {
288
+ const marked = Array.from(panel.querySelectorAll("[data-ck-dialog-initial-focus]")).find((candidate) => this.checker.isFocusable(candidate));
289
+ if (marked) return marked;
290
+ const content = panel.querySelector(".ck-dialog__content");
291
+ return Array.from(content?.querySelectorAll(TABBABLE_CANDIDATES) ?? []).find((candidate) => !candidate.classList.contains("ck-dialog-body") && this.checker.isTabbable(candidate)) ?? panel;
292
+ }
293
+ };
294
+ export { CK_DIALOG_CONTEXT, CK_DIALOG_DATA, CkDialogContainer, CkDialogContext, CkDialogIds, CkDialogOpener, CkDialogRef };
295
+
296
+ //# sourceMappingURL=ckui-core-internal-dialog.mjs.map