@edsis/angular 22.0.44 → 22.0.45

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,601 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, makeEnvironmentProviders, inject, Injector, linkedSignal, computed, effect, afterNextRender, Service, input, output, Component, ElementRef, signal, DestroyRef, Directive } from '@angular/core';
3
+ import { DOCUMENT } from '@angular/common';
4
+ import { SheetComponent } from '@edsis/component/sheet';
5
+ import { NavigationService } from '@edsis/navigation/service';
6
+ import { LayoutService } from '@edsis/theme/layout/services';
7
+ import { ButtonComponent } from '@edsis/component/button';
8
+ import { IconComponent } from '@edsis/component/icon';
9
+ import { LayoutService as LayoutService$1, isUiLayoutStyle, isUiLayoutSurface, isUiLayoutWidth } from '@edsis/theme/layout';
10
+ import { PageComponent, PageContentComponent, PageFooterComponent, PageHeaderComponent } from '@edsis/theme/page';
11
+ import { ThemeModeService, ThemeSpaceService, ThemeRadiusService, ThemeStyleService, THEME_STYLES, THEME_MODES, THEME_SPACES, THEME_RADII, isThemeStyle, isThemeMode, isThemeSpace, isThemeRadius } from '@edsis/theme/styles';
12
+ import { ToggleGroupComponent, ToggleGroupItemDirective } from '@edsis/component/toggle-group';
13
+ import { TooltipDirective } from '@edsis/component/tooltip';
14
+
15
+ const APP_PREFERENCES_CONFIG = new InjectionToken('APP_PREFERENCES_CONFIG');
16
+ function provideAppPreferences(config = {}) {
17
+ return makeEnvironmentProviders([{ provide: APP_PREFERENCES_CONFIG, useValue: config }]);
18
+ }
19
+
20
+ const NAVIGATION_FOCUS_SELECTOR = '[data-navigation-id="main"] a[href]:not([aria-disabled="true"]), [data-navigation-id="main"] button:not(:disabled):not([aria-disabled="true"])';
21
+ const CONTENT_FOCUS_SELECTOR = '[data-block-shell-content][tabindex="-1"]';
22
+ class AppPreferencesPanelService {
23
+ document = inject(DOCUMENT, { optional: true });
24
+ injector = inject(Injector);
25
+ layout = inject(LayoutService);
26
+ openedState = linkedSignal({ ...(ngDevMode ? { debugName: "openedState" } : /* istanbul ignore next */ {}), source: this.layout.type,
27
+ computation: () => false });
28
+ origin = null;
29
+ previouslyOpened = false;
30
+ finalizationPending = false;
31
+ supported = computed(() => this.layout.type() === 'vertical', /* @ts-ignore */
32
+ ...(ngDevMode ? [{ debugName: "supported" }] : /* istanbul ignore next */ []));
33
+ opened = this.openedState.asReadonly();
34
+ constructor() {
35
+ effect(() => {
36
+ const opened = this.openedState();
37
+ if (this.previouslyOpened && !opened) {
38
+ this.finalizeClose();
39
+ }
40
+ this.previouslyOpened = opened;
41
+ });
42
+ }
43
+ open(trigger) {
44
+ if (!this.supported()) {
45
+ return false;
46
+ }
47
+ if (!this.openedState() && !this.origin) {
48
+ this.origin = trigger ?? this.activeElement();
49
+ }
50
+ this.openedState.set(true);
51
+ return true;
52
+ }
53
+ close() {
54
+ this.openedState.set(false);
55
+ }
56
+ toggle(trigger) {
57
+ if (this.openedState()) {
58
+ this.close();
59
+ return false;
60
+ }
61
+ return this.open(trigger);
62
+ }
63
+ finalizeClose() {
64
+ if (this.finalizationPending) {
65
+ return;
66
+ }
67
+ this.finalizationPending = true;
68
+ afterNextRender(() => {
69
+ this.finalizationPending = false;
70
+ this.restoreFocus();
71
+ this.origin = null;
72
+ }, { injector: this.injector });
73
+ }
74
+ restoreFocus() {
75
+ const document = this.document;
76
+ if (!document) {
77
+ return;
78
+ }
79
+ const candidates = [
80
+ this.origin,
81
+ ...Array.from(document.querySelectorAll(NAVIGATION_FOCUS_SELECTOR)),
82
+ document.querySelector(CONTENT_FOCUS_SELECTOR),
83
+ ];
84
+ for (const candidate of candidates) {
85
+ if (!this.canFocus(candidate)) {
86
+ continue;
87
+ }
88
+ candidate.focus({ preventScroll: true });
89
+ if (document.activeElement === candidate) {
90
+ return;
91
+ }
92
+ }
93
+ }
94
+ activeElement() {
95
+ const activeElement = this.document?.activeElement;
96
+ return activeElement instanceof HTMLElement ? activeElement : null;
97
+ }
98
+ canFocus(element) {
99
+ if (!element?.isConnected || element.matches(':disabled, [aria-disabled="true"]')) {
100
+ return false;
101
+ }
102
+ if (element.closest('[hidden], [inert], [aria-hidden="true"]')) {
103
+ return false;
104
+ }
105
+ const view = this.document?.defaultView;
106
+ return !view || element.getClientRects().length > 0;
107
+ }
108
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService, deps: [], target: i0.ɵɵFactoryTarget.Service });
109
+ static ɵprov = i0.ɵɵngDeclareService({ minVersion: "22.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService });
110
+ }
111
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesPanelService, decorators: [{
112
+ type: Service
113
+ }], ctorParameters: () => [] });
114
+
115
+ class AppPreferenceSettingGroupComponent {
116
+ title = input.required(/* @ts-ignore */
117
+ ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
118
+ description = input(null, /* @ts-ignore */
119
+ ...(ngDevMode ? [{ debugName: "description" }] : /* istanbul ignore next */ []));
120
+ activeLabel = input.required(/* @ts-ignore */
121
+ ...(ngDevMode ? [{ debugName: "activeLabel" }] : /* istanbul ignore next */ []));
122
+ options = input.required(/* @ts-ignore */
123
+ ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
124
+ selected = input.required(/* @ts-ignore */
125
+ ...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
126
+ headingId = input.required(/* @ts-ignore */
127
+ ...(ngDevMode ? [{ debugName: "headingId" }] : /* istanbul ignore next */ []));
128
+ optionSelected = output();
129
+ onValueChange(value) {
130
+ if (value !== null) {
131
+ this.optionSelected.emit(value);
132
+ }
133
+ }
134
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferenceSettingGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
135
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferenceSettingGroupComponent, isStandalone: true, selector: "app-preference-setting-group", inputs: { title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, activeLabel: { classPropertyName: "activeLabel", publicName: "activeLabel", isSignal: true, isRequired: true, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: true, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: true, transformFunction: null }, headingId: { classPropertyName: "headingId", publicName: "headingId", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { optionSelected: "optionSelected" }, ngImport: i0, template: `
136
+ <section class="border-b border-border/65 px-3 py-2.5 last:border-b-0">
137
+ <div class="flex items-start justify-between gap-3">
138
+ <div class="min-w-0">
139
+ <h3 [id]="headingId()" class="text-sm font-medium text-foreground">{{ title() }}</h3>
140
+ @if (description()) {
141
+ <p class="mt-1 text-xs leading-4 text-muted-foreground">{{ description() }}</p>
142
+ }
143
+ </div>
144
+
145
+ <span class="shrink-0 font-mono text-xs text-muted-foreground">{{ activeLabel() }}</span>
146
+ </div>
147
+
148
+ <ToggleGroup
149
+ type="single"
150
+ variant="segmented"
151
+ [value]="selected()"
152
+ [attr.aria-labelledby]="headingId()"
153
+ class="mt-2 grid w-full grid-flow-col auto-cols-fr gap-0"
154
+ (valueChange)="onValueChange($event)"
155
+ >
156
+ @for (option of options(); track option.value) {
157
+ <button
158
+ ToggleGroupItem
159
+ [value]="option.value"
160
+ [Tooltip]="option.label"
161
+ [attr.aria-label]="option.label"
162
+ [attr.title]="option.label"
163
+ class="min-h-8 min-w-0 px-1.5 py-1"
164
+ >
165
+ <Icon [name]="option.icon" [size]="16" />
166
+ </button>
167
+ }
168
+ </ToggleGroup>
169
+ </section>
170
+ `, isInline: true, dependencies: [{ kind: "component", type: IconComponent, selector: "Icon", inputs: ["name", "class", "size", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: ToggleGroupComponent, selector: "ToggleGroup", inputs: ["type", "value", "values", "orientation", "variant", "size", "spacing", "loop", "disabled", "dir", "class"], outputs: ["valueChange", "valuesChange"] }, { kind: "directive", type: ToggleGroupItemDirective, selector: "button[ToggleGroupItem]", inputs: ["value", "disabled", "class"] }, { kind: "directive", type: TooltipDirective, selector: "[Tooltip]", inputs: ["Tooltip", "TooltipPosition", "TooltipDisabled", "TooltipShowDelay", "TooltipHideDelay"], exportAs: ["Tooltip"] }] });
171
+ }
172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferenceSettingGroupComponent, decorators: [{
173
+ type: Component,
174
+ args: [{
175
+ selector: 'app-preference-setting-group',
176
+ imports: [IconComponent, ToggleGroupComponent, ToggleGroupItemDirective, TooltipDirective],
177
+ template: `
178
+ <section class="border-b border-border/65 px-3 py-2.5 last:border-b-0">
179
+ <div class="flex items-start justify-between gap-3">
180
+ <div class="min-w-0">
181
+ <h3 [id]="headingId()" class="text-sm font-medium text-foreground">{{ title() }}</h3>
182
+ @if (description()) {
183
+ <p class="mt-1 text-xs leading-4 text-muted-foreground">{{ description() }}</p>
184
+ }
185
+ </div>
186
+
187
+ <span class="shrink-0 font-mono text-xs text-muted-foreground">{{ activeLabel() }}</span>
188
+ </div>
189
+
190
+ <ToggleGroup
191
+ type="single"
192
+ variant="segmented"
193
+ [value]="selected()"
194
+ [attr.aria-labelledby]="headingId()"
195
+ class="mt-2 grid w-full grid-flow-col auto-cols-fr gap-0"
196
+ (valueChange)="onValueChange($event)"
197
+ >
198
+ @for (option of options(); track option.value) {
199
+ <button
200
+ ToggleGroupItem
201
+ [value]="option.value"
202
+ [Tooltip]="option.label"
203
+ [attr.aria-label]="option.label"
204
+ [attr.title]="option.label"
205
+ class="min-h-8 min-w-0 px-1.5 py-1"
206
+ >
207
+ <Icon [name]="option.icon" [size]="16" />
208
+ </button>
209
+ }
210
+ </ToggleGroup>
211
+ </section>
212
+ `,
213
+ }]
214
+ }], propDecorators: { title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], activeLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeLabel", required: true }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: true }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: true }] }], headingId: [{ type: i0.Input, args: [{ isSignal: true, alias: "headingId", required: true }] }], optionSelected: [{ type: i0.Output, args: ["optionSelected"] }] } });
215
+
216
+ const PRIMARY_NAVIGATION_ID$1 = 'main';
217
+ const VERTICAL_NAVIGATION_TYPES = ['sidebar', 'dockbar'];
218
+ const DOCKBAR_MODES = ['default', 'sticky', 'drawer'];
219
+ const THEME_STYLE_OPTIONS = {
220
+ dinamic: { label: 'Dinamis', icon: 'auto_awesome' },
221
+ rail: { label: 'Rail', icon: 'view_sidebar' },
222
+ ala: { label: 'Ala', icon: 'palette' },
223
+ aye: { label: 'Aye', icon: 'visibility' },
224
+ };
225
+ const THEME_MODE_OPTIONS = {
226
+ light: { label: 'Terang', icon: 'light_mode' },
227
+ dark: { label: 'Gelap', icon: 'dark_mode' },
228
+ system: { label: 'Sistem', icon: 'contrast' },
229
+ };
230
+ const THEME_SPACE_OPTIONS = {
231
+ normal: { label: 'Normal', icon: 'density_large' },
232
+ compact: { label: 'Ringkas', icon: 'density_small' },
233
+ };
234
+ const THEME_RADIUS_OPTIONS = {
235
+ none: { label: 'Tanpa radius', icon: 'crop_square' },
236
+ small: { label: 'Kecil', icon: 'rounded_corner' },
237
+ medium: { label: 'Sedang', icon: 'rounded_corner' },
238
+ large: { label: 'Besar', icon: 'rounded_corner' },
239
+ };
240
+ const LAYOUT_APPEARANCE_OPTIONS = {
241
+ base: { label: 'Dasar', icon: 'crop_square' },
242
+ 'border-rail': { label: 'Border rail', icon: 'border_outer' },
243
+ };
244
+ const LAYOUT_SURFACE_OPTIONS = {
245
+ flat: { label: 'Datar', icon: 'crop_16_9' },
246
+ grid: { label: 'Grid', icon: 'grid_4x4' },
247
+ };
248
+ const LAYOUT_WIDTH_OPTIONS = {
249
+ full: { label: 'Penuh', icon: 'width_full' },
250
+ wide: { label: 'Lebar', icon: 'width_wide' },
251
+ container: { label: 'Container', icon: 'width_normal' },
252
+ fluid: { label: 'Fluid', icon: 'fit_screen' },
253
+ };
254
+ const NAVIGATION_TYPE_OPTIONS = {
255
+ sidebar: { label: 'Sidebar', icon: 'left_panel_open' },
256
+ dockbar: { label: 'Dockbar', icon: 'dock_to_left' },
257
+ };
258
+ const DOCKBAR_MODE_OPTIONS = {
259
+ default: { label: 'Default', icon: 'vertical_align_center' },
260
+ sticky: { label: 'Melekat', icon: 'push_pin' },
261
+ drawer: { label: 'Drawer', icon: 'left_panel_open' },
262
+ };
263
+ function toOptions(values, options) {
264
+ return values.map((value) => ({
265
+ value,
266
+ label: options[value]?.label ?? value,
267
+ icon: options[value]?.icon ?? 'tune',
268
+ }));
269
+ }
270
+ class AppPreferencesSurfaceComponent {
271
+ config = inject(APP_PREFERENCES_CONFIG, { optional: true });
272
+ themeMode = inject(ThemeModeService);
273
+ themeSpace = inject(ThemeSpaceService);
274
+ themeRadius = inject(ThemeRadiusService);
275
+ themeStyle = inject(ThemeStyleService);
276
+ layout = inject(LayoutService$1);
277
+ navigation = inject(NavigationService);
278
+ host = inject((ElementRef));
279
+ closeRequested = output();
280
+ announcement = signal('', /* @ts-ignore */
281
+ ...(ngDevMode ? [{ debugName: "announcement" }] : /* istanbul ignore next */ []));
282
+ defaults = this.config?.defaults ?? null;
283
+ hasDefaults = computed(() => this.defaults !== null, /* @ts-ignore */
284
+ ...(ngDevMode ? [{ debugName: "hasDefaults" }] : /* istanbul ignore next */ []));
285
+ mode = this.themeMode.mode;
286
+ space = this.themeSpace.space;
287
+ radius = this.themeRadius.radius;
288
+ style = this.themeStyle.style;
289
+ appearance = this.layout.appearance;
290
+ surface = this.layout.surface;
291
+ width = this.layout.width;
292
+ navigationState = computed(() => this.navigation.state(PRIMARY_NAVIGATION_ID$1)() ?? {
293
+ id: PRIMARY_NAVIGATION_ID$1,
294
+ orientation: 'vertical',
295
+ type: 'sidebar',
296
+ position: 'left',
297
+ collapsed: false,
298
+ dockbarMode: 'default',
299
+ }, /* @ts-ignore */
300
+ ...(ngDevMode ? [{ debugName: "navigationState" }] : /* istanbul ignore next */ []));
301
+ styleOptions = toOptions(THEME_STYLES, THEME_STYLE_OPTIONS);
302
+ modeOptions = toOptions(THEME_MODES, THEME_MODE_OPTIONS);
303
+ spaceOptions = toOptions(THEME_SPACES, THEME_SPACE_OPTIONS);
304
+ radiusOptions = toOptions(THEME_RADII, THEME_RADIUS_OPTIONS);
305
+ appearanceOptions = toOptions(['base', 'border-rail'], LAYOUT_APPEARANCE_OPTIONS);
306
+ surfaceOptions = toOptions(['flat', 'grid'], LAYOUT_SURFACE_OPTIONS);
307
+ widthOptions = toOptions(['full', 'wide', 'container', 'fluid'], LAYOUT_WIDTH_OPTIONS);
308
+ navigationTypeOptions = toOptions(VERTICAL_NAVIGATION_TYPES, NAVIGATION_TYPE_OPTIONS);
309
+ navigationModeOptions = computed(() => this.navigationState().type === 'sidebar'
310
+ ? [
311
+ { value: 'expanded', label: 'Diperluas', icon: 'unfold_more' },
312
+ { value: 'collapsed', label: 'Dipadatkan', icon: 'compress' },
313
+ ]
314
+ : toOptions(DOCKBAR_MODES, DOCKBAR_MODE_OPTIONS), /* @ts-ignore */
315
+ ...(ngDevMode ? [{ debugName: "navigationModeOptions" }] : /* istanbul ignore next */ []));
316
+ navigationMode = computed(() => {
317
+ const state = this.navigationState();
318
+ return state.type === 'sidebar'
319
+ ? state.collapsed
320
+ ? 'collapsed'
321
+ : 'expanded'
322
+ : state.dockbarMode;
323
+ }, /* @ts-ignore */
324
+ ...(ngDevMode ? [{ debugName: "navigationMode" }] : /* istanbul ignore next */ []));
325
+ navigationModeLabel = computed(() => {
326
+ const state = this.navigationState();
327
+ return state.type === 'sidebar'
328
+ ? state.collapsed
329
+ ? 'Dipadatkan'
330
+ : 'Diperluas'
331
+ : DOCKBAR_MODE_OPTIONS[state.dockbarMode].label;
332
+ }, /* @ts-ignore */
333
+ ...(ngDevMode ? [{ debugName: "navigationModeLabel" }] : /* istanbul ignore next */ []));
334
+ constructor() {
335
+ const host = this.host.nativeElement;
336
+ afterNextRender(() => {
337
+ const closeButton = host.querySelector('[data-app-preferences-close]');
338
+ closeButton?.focus({ preventScroll: true });
339
+ });
340
+ }
341
+ selectStyle(value) {
342
+ if (isThemeStyle(value))
343
+ this.themeStyle.setStyle(value);
344
+ }
345
+ selectMode(value) {
346
+ if (isThemeMode(value))
347
+ this.themeMode.setMode(value);
348
+ }
349
+ selectSpace(value) {
350
+ if (isThemeSpace(value))
351
+ this.themeSpace.setSpace(value);
352
+ }
353
+ selectRadius(value) {
354
+ if (isThemeRadius(value))
355
+ this.themeRadius.setRadius(value);
356
+ }
357
+ selectAppearance(value) {
358
+ if (isUiLayoutStyle(value))
359
+ this.layout.setAppearance(value);
360
+ }
361
+ selectSurface(value) {
362
+ if (isUiLayoutSurface(value))
363
+ this.layout.setSurface(value);
364
+ }
365
+ selectWidth(value) {
366
+ if (isUiLayoutWidth(value))
367
+ this.layout.setWidth(value);
368
+ }
369
+ selectNavigationType(value) {
370
+ if (VERTICAL_NAVIGATION_TYPES.includes(value)) {
371
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { type: value });
372
+ }
373
+ }
374
+ selectNavigationMode(value) {
375
+ const state = this.navigationState();
376
+ if (state.type === 'sidebar' && (value === 'expanded' || value === 'collapsed')) {
377
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, { collapsed: value === 'collapsed' });
378
+ }
379
+ if (state.type === 'dockbar' && DOCKBAR_MODES.includes(value)) {
380
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, {
381
+ dockbarMode: value,
382
+ });
383
+ }
384
+ }
385
+ resetToDefaults() {
386
+ const defaults = this.defaults;
387
+ if (!defaults)
388
+ return;
389
+ let changed = false;
390
+ if (this.mode() !== defaults.theme.mode) {
391
+ this.themeMode.setMode(defaults.theme.mode);
392
+ changed = true;
393
+ }
394
+ if (this.space() !== defaults.theme.space) {
395
+ this.themeSpace.setSpace(defaults.theme.space);
396
+ changed = true;
397
+ }
398
+ if (this.radius() !== defaults.theme.radius) {
399
+ this.themeRadius.setRadius(defaults.theme.radius);
400
+ changed = true;
401
+ }
402
+ if (this.style() !== defaults.theme.style) {
403
+ this.themeStyle.setStyle(defaults.theme.style);
404
+ changed = true;
405
+ }
406
+ if (this.appearance() !== defaults.layout.appearance) {
407
+ this.layout.setAppearance(defaults.layout.appearance);
408
+ changed = true;
409
+ }
410
+ if (this.surface() !== defaults.layout.surface) {
411
+ this.layout.setSurface(defaults.layout.surface);
412
+ changed = true;
413
+ }
414
+ if (this.width() !== defaults.layout.width) {
415
+ this.layout.setWidth(defaults.layout.width);
416
+ changed = true;
417
+ }
418
+ const navigation = this.navigationState();
419
+ if (navigation.type !== defaults.navigation.type ||
420
+ navigation.collapsed !== defaults.navigation.collapsed ||
421
+ navigation.dockbarMode !== defaults.navigation.dockbarMode) {
422
+ this.navigation.update(PRIMARY_NAVIGATION_ID$1, defaults.navigation);
423
+ changed = true;
424
+ }
425
+ this.announce(changed ? 'Preferensi dikembalikan ke default.' : 'Preferensi sudah menggunakan default.');
426
+ }
427
+ announce(message) {
428
+ this.announcement.set('');
429
+ queueMicrotask(() => this.announcement.set(message));
430
+ }
431
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesSurfaceComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
432
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferencesSurfaceComponent, isStandalone: true, selector: "app-preferences-surface", outputs: { closeRequested: "closeRequested" }, host: { classAttribute: "block h-full min-h-0 w-full" }, ngImport: i0, template: "<Page variant=\"stacked\" height=\"fix\" scroll=\"content\" class=\"bg-background\">\n <PageHeader class=\"h-11 px-3 py-0\">\n <div class=\"flex h-full items-center justify-between gap-3\">\n <h2\n id=\"app-preferences-title\"\n class=\"min-w-0 truncate text-base font-semibold text-foreground\"\n >\n Preferensi aplikasi\n </h2>\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n size=\"icon\"\n class=\"h-11 w-11 shrink-0\"\n data-app-preferences-close\n aria-label=\"Tutup preferensi aplikasi\"\n (click)=\"closeRequested.emit()\"\n >\n <Icon name=\"close\" [size]=\"20\" />\n </button>\n </div>\n </PageHeader>\n\n <PageContent class=\"overscroll-contain bg-muted/20\">\n <div class=\"space-y-5 p-3\">\n <p class=\"text-xs leading-4 text-muted-foreground\">\n Sesuaikan tampilan dan navigasi aplikasi.\n </p>\n\n <section aria-labelledby=\"app-preferences-theme\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-theme\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Tema\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-style\"\n title=\"Gaya tema\"\n [activeLabel]=\"styleOptions.find((option) => option.value === style())?.label ?? style()\"\n [options]=\"styleOptions\"\n [selected]=\"style()\"\n (optionSelected)=\"selectStyle($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-mode\"\n title=\"Mode warna\"\n description=\"Sistem mengikuti preferensi perangkat.\"\n [activeLabel]=\"modeOptions.find((option) => option.value === mode())?.label ?? mode()\"\n [options]=\"modeOptions\"\n [selected]=\"mode()\"\n (optionSelected)=\"selectMode($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-space\"\n title=\"Kerapatan\"\n [activeLabel]=\"spaceOptions.find((option) => option.value === space())?.label ?? space()\"\n [options]=\"spaceOptions\"\n [selected]=\"space()\"\n (optionSelected)=\"selectSpace($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-radius\"\n title=\"Sudut\"\n [activeLabel]=\"\n radiusOptions.find((option) => option.value === radius())?.label ?? radius()\n \"\n [options]=\"radiusOptions\"\n [selected]=\"radius()\"\n (optionSelected)=\"selectRadius($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-layout\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-layout\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Layout\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-appearance\"\n title=\"Bingkai\"\n [activeLabel]=\"\n appearanceOptions.find((option) => option.value === appearance())?.label ?? appearance()\n \"\n [options]=\"appearanceOptions\"\n [selected]=\"appearance()\"\n (optionSelected)=\"selectAppearance($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-surface\"\n title=\"Latar\"\n [activeLabel]=\"\n surfaceOptions.find((option) => option.value === surface())?.label ?? surface()\n \"\n [options]=\"surfaceOptions\"\n [selected]=\"surface()\"\n (optionSelected)=\"selectSurface($event)\"\n />\n <section class=\"border-b border-border/65 px-3 py-3\">\n <div class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-medium text-foreground\">Tipe layout</h3>\n <p class=\"mt-1 text-xs leading-4 text-muted-foreground\">Didukung pada fase ini.</p>\n </div>\n <span class=\"font-mono text-xs text-muted-foreground\">Vertikal</span>\n </div>\n </section>\n <app-preference-setting-group\n headingId=\"app-preferences-width\"\n title=\"Lebar konten\"\n [activeLabel]=\"widthOptions.find((option) => option.value === width())?.label ?? width()\"\n [options]=\"widthOptions\"\n [selected]=\"width()\"\n (optionSelected)=\"selectWidth($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-navigation\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-navigation\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Navigasi\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-type\"\n title=\"Tipe navigation\"\n [activeLabel]=\"navigationState().type === 'sidebar' ? 'Sidebar' : 'Dockbar'\"\n [options]=\"navigationTypeOptions\"\n [selected]=\"navigationState().type\"\n (optionSelected)=\"selectNavigationType($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-mode\"\n title=\"Mode navigation\"\n [activeLabel]=\"navigationModeLabel()\"\n [options]=\"navigationModeOptions()\"\n [selected]=\"navigationMode()\"\n (optionSelected)=\"selectNavigationMode($event)\"\n />\n </section>\n </div>\n </PageContent>\n\n @if (hasDefaults()) {\n <PageFooter class=\"px-3 py-0\">\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n class=\"h-full w-full justify-start\"\n (click)=\"resetToDefaults()\"\n >\n <Icon name=\"restart_alt\" [size]=\"18\" />\n Kembalikan default\n </button>\n </PageFooter>\n }\n\n <p class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</p>\n</Page>\n", dependencies: [{ kind: "component", type: AppPreferenceSettingGroupComponent, selector: "app-preference-setting-group", inputs: ["title", "description", "activeLabel", "options", "selected", "headingId"], outputs: ["optionSelected"] }, { kind: "component", type: ButtonComponent, selector: "button[Button], a[Button]", inputs: ["variant", "size", "class"] }, { kind: "component", type: IconComponent, selector: "Icon", inputs: ["name", "class", "size", "fill", "weight", "grade", "opticalSize"] }, { kind: "component", type: PageComponent, selector: "Page", inputs: ["variant", "height", "scroll", "position", "sideMode", "sideOpen", "sideWidth", "class"], outputs: ["sideOpenChange"] }, { kind: "component", type: PageContentComponent, selector: "PageContent", inputs: ["class"] }, { kind: "component", type: PageFooterComponent, selector: "PageFooter", inputs: ["class"] }, { kind: "component", type: PageHeaderComponent, selector: "PageHeader", inputs: ["class"] }] });
433
+ }
434
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesSurfaceComponent, decorators: [{
435
+ type: Component,
436
+ args: [{ selector: 'app-preferences-surface', imports: [
437
+ AppPreferenceSettingGroupComponent,
438
+ ButtonComponent,
439
+ IconComponent,
440
+ PageComponent,
441
+ PageContentComponent,
442
+ PageFooterComponent,
443
+ PageHeaderComponent,
444
+ ], host: {
445
+ class: 'block h-full min-h-0 w-full',
446
+ }, template: "<Page variant=\"stacked\" height=\"fix\" scroll=\"content\" class=\"bg-background\">\n <PageHeader class=\"h-11 px-3 py-0\">\n <div class=\"flex h-full items-center justify-between gap-3\">\n <h2\n id=\"app-preferences-title\"\n class=\"min-w-0 truncate text-base font-semibold text-foreground\"\n >\n Preferensi aplikasi\n </h2>\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n size=\"icon\"\n class=\"h-11 w-11 shrink-0\"\n data-app-preferences-close\n aria-label=\"Tutup preferensi aplikasi\"\n (click)=\"closeRequested.emit()\"\n >\n <Icon name=\"close\" [size]=\"20\" />\n </button>\n </div>\n </PageHeader>\n\n <PageContent class=\"overscroll-contain bg-muted/20\">\n <div class=\"space-y-5 p-3\">\n <p class=\"text-xs leading-4 text-muted-foreground\">\n Sesuaikan tampilan dan navigasi aplikasi.\n </p>\n\n <section aria-labelledby=\"app-preferences-theme\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-theme\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Tema\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-style\"\n title=\"Gaya tema\"\n [activeLabel]=\"styleOptions.find((option) => option.value === style())?.label ?? style()\"\n [options]=\"styleOptions\"\n [selected]=\"style()\"\n (optionSelected)=\"selectStyle($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-mode\"\n title=\"Mode warna\"\n description=\"Sistem mengikuti preferensi perangkat.\"\n [activeLabel]=\"modeOptions.find((option) => option.value === mode())?.label ?? mode()\"\n [options]=\"modeOptions\"\n [selected]=\"mode()\"\n (optionSelected)=\"selectMode($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-space\"\n title=\"Kerapatan\"\n [activeLabel]=\"spaceOptions.find((option) => option.value === space())?.label ?? space()\"\n [options]=\"spaceOptions\"\n [selected]=\"space()\"\n (optionSelected)=\"selectSpace($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-radius\"\n title=\"Sudut\"\n [activeLabel]=\"\n radiusOptions.find((option) => option.value === radius())?.label ?? radius()\n \"\n [options]=\"radiusOptions\"\n [selected]=\"radius()\"\n (optionSelected)=\"selectRadius($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-layout\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-layout\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Layout\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-appearance\"\n title=\"Bingkai\"\n [activeLabel]=\"\n appearanceOptions.find((option) => option.value === appearance())?.label ?? appearance()\n \"\n [options]=\"appearanceOptions\"\n [selected]=\"appearance()\"\n (optionSelected)=\"selectAppearance($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-surface\"\n title=\"Latar\"\n [activeLabel]=\"\n surfaceOptions.find((option) => option.value === surface())?.label ?? surface()\n \"\n [options]=\"surfaceOptions\"\n [selected]=\"surface()\"\n (optionSelected)=\"selectSurface($event)\"\n />\n <section class=\"border-b border-border/65 px-3 py-3\">\n <div class=\"flex items-start justify-between gap-3\">\n <div>\n <h3 class=\"text-sm font-medium text-foreground\">Tipe layout</h3>\n <p class=\"mt-1 text-xs leading-4 text-muted-foreground\">Didukung pada fase ini.</p>\n </div>\n <span class=\"font-mono text-xs text-muted-foreground\">Vertikal</span>\n </div>\n </section>\n <app-preference-setting-group\n headingId=\"app-preferences-width\"\n title=\"Lebar konten\"\n [activeLabel]=\"widthOptions.find((option) => option.value === width())?.label ?? width()\"\n [options]=\"widthOptions\"\n [selected]=\"width()\"\n (optionSelected)=\"selectWidth($event)\"\n />\n </section>\n\n <section aria-labelledby=\"app-preferences-navigation\" class=\"space-y-2\">\n <h2\n id=\"app-preferences-navigation\"\n class=\"text-xs font-semibold tracking-wide text-muted-foreground\"\n >\n Navigasi\n </h2>\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-type\"\n title=\"Tipe navigation\"\n [activeLabel]=\"navigationState().type === 'sidebar' ? 'Sidebar' : 'Dockbar'\"\n [options]=\"navigationTypeOptions\"\n [selected]=\"navigationState().type\"\n (optionSelected)=\"selectNavigationType($event)\"\n />\n <app-preference-setting-group\n headingId=\"app-preferences-navigation-mode\"\n title=\"Mode navigation\"\n [activeLabel]=\"navigationModeLabel()\"\n [options]=\"navigationModeOptions()\"\n [selected]=\"navigationMode()\"\n (optionSelected)=\"selectNavigationMode($event)\"\n />\n </section>\n </div>\n </PageContent>\n\n @if (hasDefaults()) {\n <PageFooter class=\"px-3 py-0\">\n <button\n type=\"button\"\n Button\n variant=\"ghost\"\n class=\"h-full w-full justify-start\"\n (click)=\"resetToDefaults()\"\n >\n <Icon name=\"restart_alt\" [size]=\"18\" />\n Kembalikan default\n </button>\n </PageFooter>\n }\n\n <p class=\"sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ announcement() }}</p>\n</Page>\n" }]
447
+ }], ctorParameters: () => [], propDecorators: { closeRequested: [{ type: i0.Output, args: ["closeRequested"] }] } });
448
+
449
+ const PRIMARY_NAVIGATION_ID = 'main';
450
+ const NARROW_VIEWPORT_QUERY = '(max-width: 767.98px)';
451
+ class AppPreferencesComponent {
452
+ document = inject(DOCUMENT, { optional: true });
453
+ destroyRef = inject(DestroyRef);
454
+ navigation = inject(NavigationService);
455
+ preferences = inject(AppPreferencesPanelService);
456
+ narrowState = signal(this.mediaQuery()?.matches ?? false, /* @ts-ignore */
457
+ ...(ngDevMode ? [{ debugName: "narrowState" }] : /* istanbul ignore next */ []));
458
+ navigationState = computed(() => this.navigation.state(PRIMARY_NAVIGATION_ID)() ?? {
459
+ id: PRIMARY_NAVIGATION_ID,
460
+ orientation: 'vertical',
461
+ type: 'sidebar',
462
+ position: 'left',
463
+ collapsed: false,
464
+ dockbarMode: 'default',
465
+ }, /* @ts-ignore */
466
+ ...(ngDevMode ? [{ debugName: "navigationState" }] : /* istanbul ignore next */ []));
467
+ inline = computed(() => !this.narrowState() &&
468
+ this.navigationState().type === 'sidebar' &&
469
+ !this.navigationState().collapsed, /* @ts-ignore */
470
+ ...(ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []));
471
+ hostClass = computed(() => this.inline() ? 'block h-full w-76 border-r border-border' : 'relative block h-full w-16', /* @ts-ignore */
472
+ ...(ngDevMode ? [{ debugName: "hostClass" }] : /* istanbul ignore next */ []));
473
+ constructor() {
474
+ const mediaQuery = this.mediaQuery();
475
+ const onChange = (event) => this.narrowState.set(event.matches);
476
+ mediaQuery?.addEventListener('change', onChange);
477
+ effect((onCleanup) => {
478
+ if (!this.inline() || !this.preferences.opened()) {
479
+ return;
480
+ }
481
+ const onKeydown = (event) => {
482
+ if (event.key === 'Escape' && !event.defaultPrevented) {
483
+ this.preferences.close();
484
+ }
485
+ };
486
+ this.document?.addEventListener('keydown', onKeydown);
487
+ onCleanup(() => this.document?.removeEventListener('keydown', onKeydown));
488
+ });
489
+ this.destroyRef.onDestroy(() => {
490
+ mediaQuery?.removeEventListener('change', onChange);
491
+ if (this.preferences.opened())
492
+ this.preferences.close();
493
+ });
494
+ }
495
+ onSheetOpenChange(open) {
496
+ if (!open)
497
+ this.preferences.close();
498
+ }
499
+ mediaQuery() {
500
+ return this.document?.defaultView?.matchMedia?.(NARROW_VIEWPORT_QUERY) ?? null;
501
+ }
502
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
503
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AppPreferencesComponent, isStandalone: true, selector: "app-preferences", host: { properties: { "class": "hostClass()", "attr.role": "inline() ? \"region\" : null", "attr.aria-labelledby": "inline() ? \"app-preferences-title\" : null" } }, ngImport: i0, template: `
504
+ @if (inline()) {
505
+ <section
506
+ id="app-preferences-panel"
507
+ class="h-full min-h-0 w-full"
508
+ aria-labelledby="app-preferences-title"
509
+ >
510
+ <app-preferences-surface (closeRequested)="preferences.close()" />
511
+ </section>
512
+ } @else {
513
+ <Sheet
514
+ [open]="preferences.opened()"
515
+ side="left"
516
+ [showCloseButton]="false"
517
+ [restoreFocus]="false"
518
+ aria-labelledby="app-preferences-title"
519
+ class="!w-[min(19rem,calc(100dvw-2rem))] !max-w-none !gap-0 !p-0"
520
+ (openChange)="onSheetOpenChange($event)"
521
+ >
522
+ <app-preferences-surface
523
+ id="app-preferences-panel"
524
+ (closeRequested)="preferences.close()"
525
+ />
526
+ </Sheet>
527
+ }
528
+ `, isInline: true, dependencies: [{ kind: "component", type: AppPreferencesSurfaceComponent, selector: "app-preferences-surface", outputs: ["closeRequested"] }, { kind: "component", type: SheetComponent, selector: "Sheet, Drawer", inputs: ["open", "side", "variant", "closeOnEscape", "closeOnBackdropClick", "showCloseButton", "restoreFocus", "closeButtonLabel", "aria-labelledby", "aria-describedby", "class"], outputs: ["openChange", "openedChange"] }] });
529
+ }
530
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesComponent, decorators: [{
531
+ type: Component,
532
+ args: [{
533
+ selector: 'app-preferences',
534
+ imports: [AppPreferencesSurfaceComponent, SheetComponent],
535
+ host: {
536
+ '[class]': 'hostClass()',
537
+ '[attr.role]': 'inline() ? "region" : null',
538
+ '[attr.aria-labelledby]': 'inline() ? "app-preferences-title" : null',
539
+ },
540
+ template: `
541
+ @if (inline()) {
542
+ <section
543
+ id="app-preferences-panel"
544
+ class="h-full min-h-0 w-full"
545
+ aria-labelledby="app-preferences-title"
546
+ >
547
+ <app-preferences-surface (closeRequested)="preferences.close()" />
548
+ </section>
549
+ } @else {
550
+ <Sheet
551
+ [open]="preferences.opened()"
552
+ side="left"
553
+ [showCloseButton]="false"
554
+ [restoreFocus]="false"
555
+ aria-labelledby="app-preferences-title"
556
+ class="!w-[min(19rem,calc(100dvw-2rem))] !max-w-none !gap-0 !p-0"
557
+ (openChange)="onSheetOpenChange($event)"
558
+ >
559
+ <app-preferences-surface
560
+ id="app-preferences-panel"
561
+ (closeRequested)="preferences.close()"
562
+ />
563
+ </Sheet>
564
+ }
565
+ `,
566
+ }]
567
+ }], ctorParameters: () => [] });
568
+
569
+ class AppPreferencesTriggerDirective {
570
+ elementRef = inject((ElementRef));
571
+ preferences = inject(AppPreferencesPanelService);
572
+ isButton = computed(() => this.elementRef.nativeElement.localName === 'button', /* @ts-ignore */
573
+ ...(ngDevMode ? [{ debugName: "isButton" }] : /* istanbul ignore next */ []));
574
+ onClick(event) {
575
+ if (this.preferences.open(this.elementRef.nativeElement)) {
576
+ event.preventDefault();
577
+ }
578
+ }
579
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
580
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.6", type: AppPreferencesTriggerDirective, isStandalone: true, selector: "[appPreferencesTrigger]", host: { listeners: { "click": "onClick($event)" }, properties: { "attr.aria-expanded": "preferences.opened()", "attr.aria-controls": "preferences.opened() ? \"app-preferences-panel\" : null", "attr.aria-disabled": "isButton() && !preferences.supported() ? \"true\" : null", "attr.disabled": "isButton() && !preferences.supported() ? \"\" : null" } }, ngImport: i0 });
581
+ }
582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AppPreferencesTriggerDirective, decorators: [{
583
+ type: Directive,
584
+ args: [{
585
+ selector: '[appPreferencesTrigger]',
586
+ host: {
587
+ '[attr.aria-expanded]': 'preferences.opened()',
588
+ '[attr.aria-controls]': 'preferences.opened() ? "app-preferences-panel" : null',
589
+ '[attr.aria-disabled]': 'isButton() && !preferences.supported() ? "true" : null',
590
+ '[attr.disabled]': 'isButton() && !preferences.supported() ? "" : null',
591
+ '(click)': 'onClick($event)',
592
+ },
593
+ }]
594
+ }] });
595
+
596
+ /**
597
+ * Generated bundle index. Do not edit.
598
+ */
599
+
600
+ export { APP_PREFERENCES_CONFIG, AppPreferencesComponent, AppPreferencesPanelService, AppPreferencesTriggerDirective, provideAppPreferences };
601
+ //# sourceMappingURL=edsis-angular-block-themes.mjs.map