@seniorsistemas/angular-components 19.8.0 → 19.9.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/bignumber-input/lib/bignumber-input/bignumber-input.directive.d.ts +2 -1
- package/code-editor/lib/code-editor/core/facades/core-facade.d.ts +3 -1
- package/code-editor/lib/code-editor/infra/cores/codemirror-6/codemirror-6-core.d.ts +12 -2
- package/drawer/README.md +119 -0
- package/drawer/index.d.ts +5 -0
- package/{sidebar/lib/sidebar/sidebar.component.d.ts → drawer/lib/drawer/drawer.component.d.ts} +18 -15
- package/drawer/lib/drawer/drawer.module.d.ts +8 -0
- package/drawer/public-api.d.ts +2 -0
- package/esm2022/bignumber-input/lib/bignumber-input/bignumber-input.directive.mjs +6 -3
- package/esm2022/code-editor/lib/code-editor/core/facades/core-facade.mjs +7 -1
- package/esm2022/code-editor/lib/code-editor/infra/cores/codemirror-6/codemirror-6-core.mjs +47 -22
- package/esm2022/drawer/lib/drawer/drawer.component.mjs +192 -0
- package/esm2022/drawer/lib/drawer/drawer.module.mjs +17 -0
- package/esm2022/drawer/public-api.mjs +3 -0
- package/esm2022/drawer/seniorsistemas-angular-components-drawer.mjs +5 -0
- package/esm2022/dynamic-form/dynamic-form/form-field/fields/bignumber/bignumber-field.component.mjs +4 -5
- package/esm2022/lib/locale/fallback.mjs +3 -2
- package/esm2022/select/lib/select/select.component.mjs +11 -14
- package/esm2022/side-sheet/lib/side-sheet/models/side-sheet-config.mjs +2 -0
- package/esm2022/side-sheet/lib/side-sheet/models/side-sheet-size.mjs +2 -0
- package/esm2022/side-sheet/lib/side-sheet/services/side-sheet.service.mjs +82 -0
- package/esm2022/side-sheet/lib/side-sheet/side-sheet.component.mjs +171 -0
- package/esm2022/side-sheet/public-api.mjs +3 -0
- package/esm2022/side-sheet/seniorsistemas-angular-components-side-sheet.mjs +5 -0
- package/esm2022/sidebar/public-api.mjs +12 -3
- package/esm2022/switch/lib/switch/switch.component.mjs +5 -3
- package/esm2022/switch/lib/switch/switch.module.mjs +2 -2
- package/esm2022/tabs/lib/tab-item/tab-item.component.mjs +4 -3
- package/esm2022/tabs/lib/tabs/tabs.component.mjs +14 -10
- package/esm2022/tiered-menu/lib/tiered-menu/components/tiered-menu/tiered-menu.component.mjs +82 -75
- package/esm2022/tiered-menu/lib/tiered-menu/components/tiered-menu-item/tiered-menu-item.component.mjs +3 -3
- package/esm2022/tiered-menu/lib/tiered-menu/components/tiered-menu-nested/tiered-menu-nested.component.mjs +35 -18
- package/esm2022/tiered-menu/lib/tiered-menu/services/tiered-menu.event.service.mjs +2 -1
- package/esm2022/tiered-menu/lib/tiered-menu/tiered-menu.directive.mjs +89 -77
- package/esm2022/toast/lib/toast/toast.service.mjs +2 -2
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs +5 -2
- package/fesm2022/seniorsistemas-angular-components-bignumber-input.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs +52 -21
- package/fesm2022/seniorsistemas-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs +211 -0
- package/fesm2022/seniorsistemas-angular-components-drawer.mjs.map +1 -0
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs +3 -4
- package/fesm2022/seniorsistemas-angular-components-dynamic-form.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-select.mjs +10 -13
- package/fesm2022/seniorsistemas-angular-components-select.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-side-sheet.mjs +257 -0
- package/fesm2022/seniorsistemas-angular-components-side-sheet.mjs.map +1 -0
- package/fesm2022/seniorsistemas-angular-components-sidebar.mjs +10 -180
- package/fesm2022/seniorsistemas-angular-components-sidebar.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-switch.mjs +5 -3
- package/fesm2022/seniorsistemas-angular-components-switch.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tabs.mjs +16 -11
- package/fesm2022/seniorsistemas-angular-components-tabs.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs +201 -164
- package/fesm2022/seniorsistemas-angular-components-tiered-menu.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components-toast.mjs +1 -1
- package/fesm2022/seniorsistemas-angular-components-toast.mjs.map +1 -1
- package/fesm2022/seniorsistemas-angular-components.mjs +2 -1
- package/fesm2022/seniorsistemas-angular-components.mjs.map +1 -1
- package/package.json +19 -7
- package/select/lib/select/select.component.d.ts +2 -1
- package/side-sheet/README.md +184 -0
- package/side-sheet/index.d.ts +5 -0
- package/side-sheet/lib/side-sheet/models/side-sheet-config.d.ts +20 -0
- package/side-sheet/lib/side-sheet/models/side-sheet-size.d.ts +1 -0
- package/side-sheet/lib/side-sheet/services/side-sheet.service.d.ts +49 -0
- package/side-sheet/lib/side-sheet/side-sheet.component.d.ts +61 -0
- package/side-sheet/public-api.d.ts +4 -0
- package/sidebar/README.md +20 -93
- package/sidebar/public-api.d.ts +11 -2
- package/tabs/lib/tab-item/tab-item.component.d.ts +1 -0
- package/tabs/lib/tabs/tabs.component.d.ts +2 -1
- package/tiered-menu/lib/tiered-menu/components/tiered-menu/tiered-menu.component.d.ts +19 -7
- package/tiered-menu/lib/tiered-menu/components/tiered-menu-nested/tiered-menu-nested.component.d.ts +4 -3
- package/tiered-menu/lib/tiered-menu/services/tiered-menu.event.service.d.ts +1 -0
- package/tiered-menu/lib/tiered-menu/tiered-menu.directive.d.ts +6 -5
- package/esm2022/sidebar/lib/sidebar/sidebar.component.mjs +0 -169
- package/esm2022/sidebar/lib/sidebar/sidebar.module.mjs +0 -17
- package/sidebar/lib/sidebar/sidebar.module.d.ts +0 -8
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { trigger, transition, style, animate } from '@angular/animations';
|
|
3
|
+
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
import { signal, inject, isDevMode, Injectable, viewChild, computed, DestroyRef, effect, untracked, Component } from '@angular/core';
|
|
6
|
+
import { randomHash, disableScroll, enableScroll } from '@seniorsistemas/angular-components/utils';
|
|
7
|
+
import { Router, NavigationStart } from '@angular/router';
|
|
8
|
+
import { filter } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @description Controla remotamente a única instância de `s-side-sheet` da aplicação —
|
|
12
|
+
* declarada uma vez no shell do app (ex: em `app.component.html`, logo abaixo da topbar), sem
|
|
13
|
+
* nenhum input — a partir de qualquer componente de rota.
|
|
14
|
+
*
|
|
15
|
+
* O componente que solicita a abertura declara seu próprio `<ng-template>` e passa o
|
|
16
|
+
* `TemplateRef` correspondente; o `s-side-sheet` do shell projeta esse template internamente.
|
|
17
|
+
* Fecha automaticamente a cada navegação de rota — tanto por UX (não deixar conteúdo de uma
|
|
18
|
+
* página antiga empurrando uma página nova) quanto por segurança técnica (o `TemplateRef`
|
|
19
|
+
* pertence a um componente que a navegação pode destruir).
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* private readonly sideSheetService = inject(SideSheetService);
|
|
24
|
+
* private readonly panelBody = viewChild<TemplateRef<unknown>>('panelBody');
|
|
25
|
+
*
|
|
26
|
+
* protected selectOrder(order: Order): void {
|
|
27
|
+
* this.sideSheetService.open({ header: order.number, template: this.panelBody()! });
|
|
28
|
+
* }
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
class SideSheetService {
|
|
32
|
+
_header = signal('');
|
|
33
|
+
_template = signal(null);
|
|
34
|
+
_context = signal(undefined);
|
|
35
|
+
_size = signal('default');
|
|
36
|
+
_mountedInstanceCount = 0;
|
|
37
|
+
/** @description Visibilidade do painel. Controlada internamente pelo `s-side-sheet`. */
|
|
38
|
+
visible = signal(false);
|
|
39
|
+
header = this._header.asReadonly();
|
|
40
|
+
template = this._template.asReadonly();
|
|
41
|
+
context = this._context.asReadonly();
|
|
42
|
+
size = this._size.asReadonly();
|
|
43
|
+
constructor() {
|
|
44
|
+
const router = inject(Router, { optional: true });
|
|
45
|
+
router?.events.pipe(filter((event) => event instanceof NavigationStart)).subscribe(() => this.close());
|
|
46
|
+
}
|
|
47
|
+
/** @description Abre (ou atualiza, se já aberto) o painel com o cabeçalho e o template informados. */
|
|
48
|
+
open(config) {
|
|
49
|
+
if (this._mountedInstanceCount === 0 && isDevMode()) {
|
|
50
|
+
console.warn('[SideSheetService] open() foi chamado, mas nenhum <s-side-sheet> está montado ' +
|
|
51
|
+
'no shell do app. Declare um em app.component.html.');
|
|
52
|
+
}
|
|
53
|
+
this._header.set(config.header);
|
|
54
|
+
this._template.set(config.template);
|
|
55
|
+
this._context.set(config.context);
|
|
56
|
+
this._size.set(config.size ?? 'default');
|
|
57
|
+
this.visible.set(true);
|
|
58
|
+
}
|
|
59
|
+
/** @description Fecha o painel e limpa o cabeçalho, template, contexto e tamanho armazenados. */
|
|
60
|
+
close() {
|
|
61
|
+
this.visible.set(false);
|
|
62
|
+
this._header.set('');
|
|
63
|
+
this._template.set(null);
|
|
64
|
+
this._context.set(undefined);
|
|
65
|
+
this._size.set('default');
|
|
66
|
+
}
|
|
67
|
+
/** @internal Chamado por SideSheetComponent ao ser criado. */
|
|
68
|
+
_registerInstance() {
|
|
69
|
+
if (this._mountedInstanceCount > 0 && isDevMode()) {
|
|
70
|
+
throw new Error('[SideSheetComponent] Já existe uma instância montada nesta aplicação. ' +
|
|
71
|
+
'Declare <s-side-sheet> uma única vez, no ponto mais alto da árvore ' +
|
|
72
|
+
'(ex: app.component.html).');
|
|
73
|
+
}
|
|
74
|
+
this._mountedInstanceCount++;
|
|
75
|
+
}
|
|
76
|
+
/** @internal Chamado por SideSheetComponent ao ser destruído. */
|
|
77
|
+
_unregisterInstance() {
|
|
78
|
+
this._mountedInstanceCount = Math.max(0, this._mountedInstanceCount - 1);
|
|
79
|
+
}
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SideSheetService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
81
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SideSheetService, providedIn: 'root' });
|
|
82
|
+
}
|
|
83
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SideSheetService, decorators: [{
|
|
84
|
+
type: Injectable,
|
|
85
|
+
args: [{ providedIn: 'root' }]
|
|
86
|
+
}], ctorParameters: () => [] });
|
|
87
|
+
|
|
88
|
+
/** Mantida em sincronia com o breakpoint `[@media(min-width:1024px)]` usado no template e em `panelWidthClasses`. */
|
|
89
|
+
const OVERLAY_QUERY = '(min-width: 1024px)';
|
|
90
|
+
/**
|
|
91
|
+
* @description Painel que empurra o conteúdo adjacente para a esquerda, dividindo o espaço
|
|
92
|
+
* horizontal com ele — sem escurecer a tela e sem sobrepor o conteúdo, no modo desktop
|
|
93
|
+
* (>= 1024px). Abaixo de 1024px o painel passa a funcionar como um overlay em tela cheia,
|
|
94
|
+
* com fundo escurecido, igual a um Drawer.
|
|
95
|
+
*
|
|
96
|
+
* Fecha somente pelo botão de fechar (X) do cabeçalho — não há fechamento por tecla Escape
|
|
97
|
+
* ou clique fora, em nenhuma resolução. Essa é uma decisão de produto deliberada: o conteúdo
|
|
98
|
+
* por trás do painel permanece interativo (filtros, dropdowns, autocomplete) e um atalho
|
|
99
|
+
* global de Escape entraria em conflito com outros overlays já abertos sobre esse conteúdo.
|
|
100
|
+
*
|
|
101
|
+
* Sem inputs: é uma instância **única** por aplicação, declarada uma vez no shell do app (ex:
|
|
102
|
+
* `app.component.html`, logo abaixo da topbar) e controlada remotamente por
|
|
103
|
+
* `SideSheetService.open()`/`close()` a partir de qualquer componente de rota. Uma segunda
|
|
104
|
+
* instância montada simultaneamente lança um erro em modo de desenvolvimento. O conteúdo
|
|
105
|
+
* projetado dentro do `<s-side-sheet>` é o conteúdo principal da página (ex: o
|
|
106
|
+
* `router-outlet`), empurrado pelo painel quando ele abre.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```html
|
|
110
|
+
* <!-- app.component.html -->
|
|
111
|
+
* <s-side-sheet>
|
|
112
|
+
* <router-outlet />
|
|
113
|
+
* </s-side-sheet>
|
|
114
|
+
* ```
|
|
115
|
+
* ```typescript
|
|
116
|
+
* // pedidos.component.ts
|
|
117
|
+
* private readonly sideSheetService = inject(SideSheetService);
|
|
118
|
+
* private readonly panelBody = viewChild<TemplateRef<unknown>>('panelBody');
|
|
119
|
+
*
|
|
120
|
+
* protected selecionarPedido(pedido: Pedido): void {
|
|
121
|
+
* this.sideSheetService.open({ header: pedido.numero, template: this.panelBody()! });
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @category Overlay
|
|
126
|
+
*/
|
|
127
|
+
class SideSheetComponent {
|
|
128
|
+
sideSheetService = inject(SideSheetService);
|
|
129
|
+
/** @description Id único usado para associar o título ao painel via `aria-labelledby`. */
|
|
130
|
+
titleId = randomHash('side-sheet-title');
|
|
131
|
+
titleRef = viewChild('titleRef');
|
|
132
|
+
isDesktopViewport = signal(this._matchesDesktop());
|
|
133
|
+
/** @description `true` quando o painel funciona como overlay em tela cheia (< 1024px). */
|
|
134
|
+
isOverlayMode = computed(() => !this.isDesktopViewport());
|
|
135
|
+
animationMode = computed(() => this.isOverlayMode() ? 'overlay' : 'push');
|
|
136
|
+
/**
|
|
137
|
+
* @description Largura do painel no modo push, por breakpoint. `half` só passa a ser
|
|
138
|
+
* fluido a partir de 1366px — entre 1024–1365px herda os mesmos 400px do `default`
|
|
139
|
+
* (conversão de "Half" para "Default" descrita na especificação de produto).
|
|
140
|
+
*/
|
|
141
|
+
panelWidthClasses = computed(() => this.sideSheetService.size() === 'half'
|
|
142
|
+
? '[@media(min-width:1024px)]:w-[400px] [@media(min-width:1366px)]:w-[max(400px,50vw)]'
|
|
143
|
+
: '[@media(min-width:1024px)]:w-[400px] [@media(min-width:1920px)]:w-[480px] [@media(min-width:2560px)]:w-[560px] [@media(min-width:3440px)]:w-[640px]');
|
|
144
|
+
_elementToRefocus = null;
|
|
145
|
+
constructor() {
|
|
146
|
+
const destroyRef = inject(DestroyRef);
|
|
147
|
+
this.sideSheetService._registerInstance();
|
|
148
|
+
destroyRef.onDestroy(() => this.sideSheetService._unregisterInstance());
|
|
149
|
+
if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
|
|
150
|
+
const mediaQueryList = window.matchMedia(OVERLAY_QUERY);
|
|
151
|
+
const listener = (event) => this.isDesktopViewport.set(event.matches);
|
|
152
|
+
mediaQueryList.addEventListener('change', listener);
|
|
153
|
+
destroyRef.onDestroy(() => mediaQueryList.removeEventListener('change', listener));
|
|
154
|
+
}
|
|
155
|
+
effect(() => {
|
|
156
|
+
const shouldLockScroll = this.sideSheetService.visible() && this.isOverlayMode();
|
|
157
|
+
if (shouldLockScroll) {
|
|
158
|
+
disableScroll();
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
enableScroll();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
effect(() => {
|
|
165
|
+
if (this.sideSheetService.visible()) {
|
|
166
|
+
this._elementToRefocus = document.activeElement;
|
|
167
|
+
if (!untracked(this.isOverlayMode)) {
|
|
168
|
+
queueMicrotask(() => this.titleRef()?.nativeElement.focus());
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this._elementToRefocus?.focus();
|
|
173
|
+
this._elementToRefocus = null;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
destroyRef.onDestroy(() => enableScroll());
|
|
177
|
+
}
|
|
178
|
+
closeSideSheet() {
|
|
179
|
+
this.sideSheetService.close();
|
|
180
|
+
}
|
|
181
|
+
_matchesDesktop() {
|
|
182
|
+
return typeof window !== 'undefined' && typeof window.matchMedia === 'function'
|
|
183
|
+
? window.matchMedia(OVERLAY_QUERY).matches
|
|
184
|
+
: true;
|
|
185
|
+
}
|
|
186
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SideSheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
187
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: SideSheetComponent, isStandalone: true, selector: "s-side-sheet", host: { classAttribute: "block h-full w-full flex-1 min-h-0" }, viewQueries: [{ propertyName: "titleRef", first: true, predicate: ["titleRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"side-sheet relative flex h-full w-full\">\n <div class=\"side-sheet__content min-w-0 flex-1 overflow-auto\">\n <ng-content></ng-content>\n </div>\n\n @if (sideSheetService.visible()) {\n @if (isOverlayMode()) {\n <div class=\"side-sheet__backdrop absolute inset-0 z-20 bg-[rgba(0,0,0,0.5)]\" @backdropVisibility></div>\n }\n\n <aside\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"isOverlayMode()\"\n [@panelVisibility]=\"animationMode()\"\n class=\"side-sheet__panel z-30 flex flex-col gap-4 border-l border-grayscale-20 bg-grayscale-0 p-4 shadow-[0px_2px_4px_rgba(0,0,0,0.2),0px_1px_10px_rgba(0,0,0,0.12),0px_4px_5px_rgba(0,0,0,0.14)] absolute inset-0 w-full [@media(min-width:1024px)]:static [@media(min-width:1024px)]:inset-auto\"\n [class]=\"panelWidthClasses()\"\n [class.side-sheet__panel--half]=\"sideSheetService.size() === 'half'\"\n [attr.role]=\"isOverlayMode() ? 'dialog' : 'complementary'\"\n [attr.aria-modal]=\"isOverlayMode() ? true : null\"\n [attr.aria-labelledby]=\"titleId\"\n >\n <div class=\"side-sheet__header flex flex-col gap-3\">\n <div class=\"flex items-center gap-4\">\n <h2\n #titleRef\n [id]=\"titleId\"\n tabindex=\"-1\"\n class=\"min-w-0 flex-1 break-words font-open-sans text-base font-normal uppercase text-grayscale-90 outline-none\"\n >\n {{ sideSheetService.header() }}\n </h2>\n <button\n type=\"button\"\n class=\"flex shrink-0 cursor-pointer items-center justify-center rounded-medium border-none bg-transparent p-2 outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n aria-label=\"Fechar\"\n (click)=\"closeSideSheet()\"\n >\n <i class=\"fas fa-times text-xs\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <hr class=\"h-px w-full border-0 bg-grayscale-20\" />\n </div>\n\n <div class=\"side-sheet__body min-h-0 flex-1 overflow-auto\">\n <ng-container\n *ngTemplateOutlet=\"sideSheetService.template(); context: sideSheetService.context()\"\n ></ng-container>\n </div>\n </aside>\n }\n</div>\n", dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [
|
|
188
|
+
trigger('panelVisibility', [
|
|
189
|
+
transition('void => push', [
|
|
190
|
+
style({ width: 0 }),
|
|
191
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: '*' })),
|
|
192
|
+
]),
|
|
193
|
+
transition('push => void', [
|
|
194
|
+
style({ width: '*' }),
|
|
195
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: 0 })),
|
|
196
|
+
]),
|
|
197
|
+
transition('void => overlay', [
|
|
198
|
+
style({ transform: 'translateX(100%)' }),
|
|
199
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(0)' })),
|
|
200
|
+
]),
|
|
201
|
+
transition('overlay => void', [
|
|
202
|
+
style({ transform: 'translateX(0)' }),
|
|
203
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(100%)' })),
|
|
204
|
+
]),
|
|
205
|
+
// Resize cruzando o breakpoint com o painel já aberto: não existe um tween visualmente
|
|
206
|
+
// coerente entre width:400px/static (push) e width:100%/absolute (overlay) — aplica o
|
|
207
|
+
// estado final imediatamente, sem transição residual.
|
|
208
|
+
transition('push => overlay', []),
|
|
209
|
+
transition('overlay => push', []),
|
|
210
|
+
]),
|
|
211
|
+
trigger('backdropVisibility', [
|
|
212
|
+
transition(':enter', [style({ opacity: 0 }), animate('300ms ease', style({ opacity: 1 }))]),
|
|
213
|
+
transition(':leave', [style({ opacity: 1 }), animate('300ms ease', style({ opacity: 0 }))]),
|
|
214
|
+
]),
|
|
215
|
+
] });
|
|
216
|
+
}
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SideSheetComponent, decorators: [{
|
|
218
|
+
type: Component,
|
|
219
|
+
args: [{ selector: 's-side-sheet', standalone: true, host: {
|
|
220
|
+
class: 'block h-full w-full flex-1 min-h-0',
|
|
221
|
+
}, imports: [CdkTrapFocus, NgTemplateOutlet], animations: [
|
|
222
|
+
trigger('panelVisibility', [
|
|
223
|
+
transition('void => push', [
|
|
224
|
+
style({ width: 0 }),
|
|
225
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: '*' })),
|
|
226
|
+
]),
|
|
227
|
+
transition('push => void', [
|
|
228
|
+
style({ width: '*' }),
|
|
229
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: 0 })),
|
|
230
|
+
]),
|
|
231
|
+
transition('void => overlay', [
|
|
232
|
+
style({ transform: 'translateX(100%)' }),
|
|
233
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(0)' })),
|
|
234
|
+
]),
|
|
235
|
+
transition('overlay => void', [
|
|
236
|
+
style({ transform: 'translateX(0)' }),
|
|
237
|
+
animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(100%)' })),
|
|
238
|
+
]),
|
|
239
|
+
// Resize cruzando o breakpoint com o painel já aberto: não existe um tween visualmente
|
|
240
|
+
// coerente entre width:400px/static (push) e width:100%/absolute (overlay) — aplica o
|
|
241
|
+
// estado final imediatamente, sem transição residual.
|
|
242
|
+
transition('push => overlay', []),
|
|
243
|
+
transition('overlay => push', []),
|
|
244
|
+
]),
|
|
245
|
+
trigger('backdropVisibility', [
|
|
246
|
+
transition(':enter', [style({ opacity: 0 }), animate('300ms ease', style({ opacity: 1 }))]),
|
|
247
|
+
transition(':leave', [style({ opacity: 1 }), animate('300ms ease', style({ opacity: 0 }))]),
|
|
248
|
+
]),
|
|
249
|
+
], template: "<div class=\"side-sheet relative flex h-full w-full\">\n <div class=\"side-sheet__content min-w-0 flex-1 overflow-auto\">\n <ng-content></ng-content>\n </div>\n\n @if (sideSheetService.visible()) {\n @if (isOverlayMode()) {\n <div class=\"side-sheet__backdrop absolute inset-0 z-20 bg-[rgba(0,0,0,0.5)]\" @backdropVisibility></div>\n }\n\n <aside\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"isOverlayMode()\"\n [@panelVisibility]=\"animationMode()\"\n class=\"side-sheet__panel z-30 flex flex-col gap-4 border-l border-grayscale-20 bg-grayscale-0 p-4 shadow-[0px_2px_4px_rgba(0,0,0,0.2),0px_1px_10px_rgba(0,0,0,0.12),0px_4px_5px_rgba(0,0,0,0.14)] absolute inset-0 w-full [@media(min-width:1024px)]:static [@media(min-width:1024px)]:inset-auto\"\n [class]=\"panelWidthClasses()\"\n [class.side-sheet__panel--half]=\"sideSheetService.size() === 'half'\"\n [attr.role]=\"isOverlayMode() ? 'dialog' : 'complementary'\"\n [attr.aria-modal]=\"isOverlayMode() ? true : null\"\n [attr.aria-labelledby]=\"titleId\"\n >\n <div class=\"side-sheet__header flex flex-col gap-3\">\n <div class=\"flex items-center gap-4\">\n <h2\n #titleRef\n [id]=\"titleId\"\n tabindex=\"-1\"\n class=\"min-w-0 flex-1 break-words font-open-sans text-base font-normal uppercase text-grayscale-90 outline-none\"\n >\n {{ sideSheetService.header() }}\n </h2>\n <button\n type=\"button\"\n class=\"flex shrink-0 cursor-pointer items-center justify-center rounded-medium border-none bg-transparent p-2 outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n aria-label=\"Fechar\"\n (click)=\"closeSideSheet()\"\n >\n <i class=\"fas fa-times text-xs\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <hr class=\"h-px w-full border-0 bg-grayscale-20\" />\n </div>\n\n <div class=\"side-sheet__body min-h-0 flex-1 overflow-auto\">\n <ng-container\n *ngTemplateOutlet=\"sideSheetService.template(); context: sideSheetService.context()\"\n ></ng-container>\n </div>\n </aside>\n }\n</div>\n" }]
|
|
250
|
+
}], ctorParameters: () => [] });
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Generated bundle index. Do not edit.
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
export { SideSheetComponent, SideSheetService };
|
|
257
|
+
//# sourceMappingURL=seniorsistemas-angular-components-side-sheet.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seniorsistemas-angular-components-side-sheet.mjs","sources":["../../projects/angular-components/side-sheet/src/lib/side-sheet/services/side-sheet.service.ts","../../projects/angular-components/side-sheet/src/lib/side-sheet/side-sheet.component.ts","../../projects/angular-components/side-sheet/src/lib/side-sheet/side-sheet.component.html","../../projects/angular-components/side-sheet/src/seniorsistemas-angular-components-side-sheet.ts"],"sourcesContent":["import { Injectable, TemplateRef, inject, isDevMode, signal } from '@angular/core';\nimport { NavigationStart, Router } from '@angular/router';\n\nimport { filter } from 'rxjs';\n\nimport { SideSheetConfig } from '../models/side-sheet-config';\nimport { SideSheetSize } from '../models/side-sheet-size';\n\n/**\n * @description Controla remotamente a única instância de `s-side-sheet` da aplicação —\n * declarada uma vez no shell do app (ex: em `app.component.html`, logo abaixo da topbar), sem\n * nenhum input — a partir de qualquer componente de rota.\n *\n * O componente que solicita a abertura declara seu próprio `<ng-template>` e passa o\n * `TemplateRef` correspondente; o `s-side-sheet` do shell projeta esse template internamente.\n * Fecha automaticamente a cada navegação de rota — tanto por UX (não deixar conteúdo de uma\n * página antiga empurrando uma página nova) quanto por segurança técnica (o `TemplateRef`\n * pertence a um componente que a navegação pode destruir).\n *\n * @example\n * ```typescript\n * private readonly sideSheetService = inject(SideSheetService);\n * private readonly panelBody = viewChild<TemplateRef<unknown>>('panelBody');\n *\n * protected selectOrder(order: Order): void {\n * this.sideSheetService.open({ header: order.number, template: this.panelBody()! });\n * }\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class SideSheetService {\n private readonly _header = signal('');\n private readonly _template = signal<TemplateRef<unknown> | null>(null);\n private readonly _context = signal<unknown>(undefined);\n private readonly _size = signal<SideSheetSize>('default');\n private _mountedInstanceCount = 0;\n\n /** @description Visibilidade do painel. Controlada internamente pelo `s-side-sheet`. */\n public readonly visible = signal(false);\n public readonly header = this._header.asReadonly();\n public readonly template = this._template.asReadonly();\n public readonly context = this._context.asReadonly();\n public readonly size = this._size.asReadonly();\n\n constructor() {\n const router = inject(Router, { optional: true });\n router?.events.pipe(filter((event) => event instanceof NavigationStart)).subscribe(() => this.close());\n }\n\n /** @description Abre (ou atualiza, se já aberto) o painel com o cabeçalho e o template informados. */\n public open<T>(config: SideSheetConfig<T>): void {\n if (this._mountedInstanceCount === 0 && isDevMode()) {\n console.warn(\n '[SideSheetService] open() foi chamado, mas nenhum <s-side-sheet> está montado ' +\n 'no shell do app. Declare um em app.component.html.',\n );\n }\n\n this._header.set(config.header);\n this._template.set(config.template as TemplateRef<unknown>);\n this._context.set(config.context);\n this._size.set(config.size ?? 'default');\n this.visible.set(true);\n }\n\n /** @description Fecha o painel e limpa o cabeçalho, template, contexto e tamanho armazenados. */\n public close(): void {\n this.visible.set(false);\n this._header.set('');\n this._template.set(null);\n this._context.set(undefined);\n this._size.set('default');\n }\n\n /** @internal Chamado por SideSheetComponent ao ser criado. */\n public _registerInstance(): void {\n if (this._mountedInstanceCount > 0 && isDevMode()) {\n throw new Error(\n '[SideSheetComponent] Já existe uma instância montada nesta aplicação. ' +\n 'Declare <s-side-sheet> uma única vez, no ponto mais alto da árvore ' +\n '(ex: app.component.html).',\n );\n }\n this._mountedInstanceCount++;\n }\n\n /** @internal Chamado por SideSheetComponent ao ser destruído. */\n public _unregisterInstance(): void {\n this._mountedInstanceCount = Math.max(0, this._mountedInstanceCount - 1);\n }\n}\n","import { NgTemplateOutlet } from '@angular/common';\nimport { animate, style, transition, trigger } from '@angular/animations';\nimport { CdkTrapFocus } from '@angular/cdk/a11y';\nimport { Component, DestroyRef, ElementRef, computed, effect, inject, signal, untracked, viewChild } from '@angular/core';\nimport { disableScroll, enableScroll, randomHash } from '@seniorsistemas/angular-components/utils';\n\nimport { SideSheetService } from './services/side-sheet.service';\n\n/** Mantida em sincronia com o breakpoint `[@media(min-width:1024px)]` usado no template e em `panelWidthClasses`. */\nconst OVERLAY_QUERY = '(min-width: 1024px)';\n\n/**\n * @description Painel que empurra o conteúdo adjacente para a esquerda, dividindo o espaço\n * horizontal com ele — sem escurecer a tela e sem sobrepor o conteúdo, no modo desktop\n * (>= 1024px). Abaixo de 1024px o painel passa a funcionar como um overlay em tela cheia,\n * com fundo escurecido, igual a um Drawer.\n *\n * Fecha somente pelo botão de fechar (X) do cabeçalho — não há fechamento por tecla Escape\n * ou clique fora, em nenhuma resolução. Essa é uma decisão de produto deliberada: o conteúdo\n * por trás do painel permanece interativo (filtros, dropdowns, autocomplete) e um atalho\n * global de Escape entraria em conflito com outros overlays já abertos sobre esse conteúdo.\n *\n * Sem inputs: é uma instância **única** por aplicação, declarada uma vez no shell do app (ex:\n * `app.component.html`, logo abaixo da topbar) e controlada remotamente por\n * `SideSheetService.open()`/`close()` a partir de qualquer componente de rota. Uma segunda\n * instância montada simultaneamente lança um erro em modo de desenvolvimento. O conteúdo\n * projetado dentro do `<s-side-sheet>` é o conteúdo principal da página (ex: o\n * `router-outlet`), empurrado pelo painel quando ele abre.\n *\n * @example\n * ```html\n * <!-- app.component.html -->\n * <s-side-sheet>\n * <router-outlet />\n * </s-side-sheet>\n * ```\n * ```typescript\n * // pedidos.component.ts\n * private readonly sideSheetService = inject(SideSheetService);\n * private readonly panelBody = viewChild<TemplateRef<unknown>>('panelBody');\n *\n * protected selecionarPedido(pedido: Pedido): void {\n * this.sideSheetService.open({ header: pedido.numero, template: this.panelBody()! });\n * }\n * ```\n *\n * @category Overlay\n */\n@Component({\n selector: 's-side-sheet',\n standalone: true,\n templateUrl: './side-sheet.component.html',\n host: {\n class: 'block h-full w-full flex-1 min-h-0',\n },\n imports: [CdkTrapFocus, NgTemplateOutlet],\n animations: [\n trigger('panelVisibility', [\n transition('void => push', [\n style({ width: 0 }),\n animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: '*' })),\n ]),\n transition('push => void', [\n style({ width: '*' }),\n animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ width: 0 })),\n ]),\n transition('void => overlay', [\n style({ transform: 'translateX(100%)' }),\n animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(0)' })),\n ]),\n transition('overlay => void', [\n style({ transform: 'translateX(0)' }),\n animate('300ms cubic-bezier(0.4, 0, 0.2, 1)', style({ transform: 'translateX(100%)' })),\n ]),\n // Resize cruzando o breakpoint com o painel já aberto: não existe um tween visualmente\n // coerente entre width:400px/static (push) e width:100%/absolute (overlay) — aplica o\n // estado final imediatamente, sem transição residual.\n transition('push => overlay', []),\n transition('overlay => push', []),\n ]),\n trigger('backdropVisibility', [\n transition(':enter', [style({ opacity: 0 }), animate('300ms ease', style({ opacity: 1 }))]),\n transition(':leave', [style({ opacity: 1 }), animate('300ms ease', style({ opacity: 0 }))]),\n ]),\n ],\n})\nexport class SideSheetComponent {\n protected readonly sideSheetService = inject(SideSheetService);\n\n /** @description Id único usado para associar o título ao painel via `aria-labelledby`. */\n protected readonly titleId = randomHash('side-sheet-title');\n\n private readonly titleRef = viewChild<ElementRef<HTMLHeadingElement>>('titleRef');\n private readonly isDesktopViewport = signal(this._matchesDesktop());\n\n /** @description `true` quando o painel funciona como overlay em tela cheia (< 1024px). */\n protected readonly isOverlayMode = computed(() => !this.isDesktopViewport());\n protected readonly animationMode = computed<'push' | 'overlay'>(() =>\n this.isOverlayMode() ? 'overlay' : 'push',\n );\n\n /**\n * @description Largura do painel no modo push, por breakpoint. `half` só passa a ser\n * fluido a partir de 1366px — entre 1024–1365px herda os mesmos 400px do `default`\n * (conversão de \"Half\" para \"Default\" descrita na especificação de produto).\n */\n protected readonly panelWidthClasses = computed(() =>\n this.sideSheetService.size() === 'half'\n ? '[@media(min-width:1024px)]:w-[400px] [@media(min-width:1366px)]:w-[max(400px,50vw)]'\n : '[@media(min-width:1024px)]:w-[400px] [@media(min-width:1920px)]:w-[480px] [@media(min-width:2560px)]:w-[560px] [@media(min-width:3440px)]:w-[640px]',\n );\n\n private _elementToRefocus: HTMLElement | null = null;\n\n constructor() {\n const destroyRef = inject(DestroyRef);\n\n this.sideSheetService._registerInstance();\n destroyRef.onDestroy(() => this.sideSheetService._unregisterInstance());\n\n if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {\n const mediaQueryList = window.matchMedia(OVERLAY_QUERY);\n const listener = (event: MediaQueryListEvent): void => this.isDesktopViewport.set(event.matches);\n mediaQueryList.addEventListener('change', listener);\n destroyRef.onDestroy(() => mediaQueryList.removeEventListener('change', listener));\n }\n\n effect(() => {\n const shouldLockScroll = this.sideSheetService.visible() && this.isOverlayMode();\n if (shouldLockScroll) {\n disableScroll();\n } else {\n enableScroll();\n }\n });\n\n effect(() => {\n if (this.sideSheetService.visible()) {\n this._elementToRefocus = document.activeElement as HTMLElement | null;\n if (!untracked(this.isOverlayMode)) {\n queueMicrotask(() => this.titleRef()?.nativeElement.focus());\n }\n } else {\n this._elementToRefocus?.focus();\n this._elementToRefocus = null;\n }\n });\n\n destroyRef.onDestroy(() => enableScroll());\n }\n\n protected closeSideSheet(): void {\n this.sideSheetService.close();\n }\n\n private _matchesDesktop(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia(OVERLAY_QUERY).matches\n : true;\n }\n}\n","<div class=\"side-sheet relative flex h-full w-full\">\n <div class=\"side-sheet__content min-w-0 flex-1 overflow-auto\">\n <ng-content></ng-content>\n </div>\n\n @if (sideSheetService.visible()) {\n @if (isOverlayMode()) {\n <div class=\"side-sheet__backdrop absolute inset-0 z-20 bg-[rgba(0,0,0,0.5)]\" @backdropVisibility></div>\n }\n\n <aside\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"isOverlayMode()\"\n [@panelVisibility]=\"animationMode()\"\n class=\"side-sheet__panel z-30 flex flex-col gap-4 border-l border-grayscale-20 bg-grayscale-0 p-4 shadow-[0px_2px_4px_rgba(0,0,0,0.2),0px_1px_10px_rgba(0,0,0,0.12),0px_4px_5px_rgba(0,0,0,0.14)] absolute inset-0 w-full [@media(min-width:1024px)]:static [@media(min-width:1024px)]:inset-auto\"\n [class]=\"panelWidthClasses()\"\n [class.side-sheet__panel--half]=\"sideSheetService.size() === 'half'\"\n [attr.role]=\"isOverlayMode() ? 'dialog' : 'complementary'\"\n [attr.aria-modal]=\"isOverlayMode() ? true : null\"\n [attr.aria-labelledby]=\"titleId\"\n >\n <div class=\"side-sheet__header flex flex-col gap-3\">\n <div class=\"flex items-center gap-4\">\n <h2\n #titleRef\n [id]=\"titleId\"\n tabindex=\"-1\"\n class=\"min-w-0 flex-1 break-words font-open-sans text-base font-normal uppercase text-grayscale-90 outline-none\"\n >\n {{ sideSheetService.header() }}\n </h2>\n <button\n type=\"button\"\n class=\"flex shrink-0 cursor-pointer items-center justify-center rounded-medium border-none bg-transparent p-2 outline-none focus-visible:ring-2 focus-visible:ring-primary\"\n aria-label=\"Fechar\"\n (click)=\"closeSideSheet()\"\n >\n <i class=\"fas fa-times text-xs\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <hr class=\"h-px w-full border-0 bg-grayscale-20\" />\n </div>\n\n <div class=\"side-sheet__body min-h-0 flex-1 overflow-auto\">\n <ng-container\n *ngTemplateOutlet=\"sideSheetService.template(); context: sideSheetService.context()\"\n ></ng-container>\n </div>\n </aside>\n }\n</div>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;AAoBG;MAEU,gBAAgB,CAAA;AACR,IAAA,OAAO,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACrB,IAAA,SAAS,GAAG,MAAM,CAA8B,IAAI,CAAC,CAAC;AACtD,IAAA,QAAQ,GAAG,MAAM,CAAU,SAAS,CAAC,CAAC;AACtC,IAAA,KAAK,GAAG,MAAM,CAAgB,SAAS,CAAC,CAAC;IAClD,qBAAqB,GAAG,CAAC,CAAC;;AAGlB,IAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACxB,IAAA,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;AACnC,IAAA,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;AACvC,IAAA,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;AACrC,IAAA,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;AAE/C,IAAA,WAAA,GAAA;AACI,QAAA,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AAClD,QAAA,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,YAAY,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;KAC1G;;AAGM,IAAA,IAAI,CAAI,MAA0B,EAAA;QACrC,IAAI,IAAI,CAA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E,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;4BAC3F,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;yBAC9F,CAAC;AACL,qBAAA,EAAA,QAAA,EAAA,kjFAAA,EAAA,CAAA;;;AEpFL;;AAEG;;;;"}
|
|
@@ -1,189 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
|
3
|
-
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
-
import * as i0 from '@angular/core';
|
|
5
|
-
import { model, contentChild, effect, Component, ContentChildren, Input, NgModule } from '@angular/core';
|
|
6
|
-
import { FooterComponent } from '@seniorsistemas/angular-components/structure';
|
|
7
|
-
import { TemplateDirective, TemplateModule } from '@seniorsistemas/angular-components/template';
|
|
8
|
-
import { disableScroll, enableScroll } from '@seniorsistemas/angular-components/utils';
|
|
1
|
+
import { DrawerComponent as DrawerComponent$1, DrawerModule as DrawerModule$1 } from '@seniorsistemas/angular-components/drawer';
|
|
9
2
|
|
|
10
3
|
/**
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* via `sTemplate`, bloqueio de scroll automático e confirmação de fechamento.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```html
|
|
17
|
-
* <s-sidebar [(visible)]="sidebarOpen" header="Filtros" [closable]="true">
|
|
18
|
-
* <ng-template sTemplate="body">Conteúdo</ng-template>
|
|
19
|
-
* </s-sidebar>
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @category Overlay
|
|
4
|
+
* @deprecated Use DrawerComponent from '@seniorsistemas/angular-components/drawer'.
|
|
5
|
+
* O pacote sidebar será removido na versão 20.0.0.
|
|
23
6
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
visible = model(false);
|
|
32
|
-
/**
|
|
33
|
-
* @description Quando `true`, exibe o botão de fechar (X) no cabeçalho da sidebar.
|
|
34
|
-
*
|
|
35
|
-
* @default true
|
|
36
|
-
*/
|
|
37
|
-
closable = true;
|
|
38
|
-
/**
|
|
39
|
-
* @description Quando `true`, clicar no backdrop (área escurecida fora da sidebar) fecha o painel.
|
|
40
|
-
*
|
|
41
|
-
* @default true
|
|
42
|
-
*/
|
|
43
|
-
dismissible = true;
|
|
44
|
-
/**
|
|
45
|
-
* @description Quando `true`, pressionar a tecla Escape fecha a sidebar.
|
|
46
|
-
*
|
|
47
|
-
* @default true
|
|
48
|
-
*/
|
|
49
|
-
closeOnEscape = true;
|
|
50
|
-
/**
|
|
51
|
-
* @description Texto exibido no cabeçalho padrão da sidebar.
|
|
52
|
-
* Pode ser substituído por um template customizado via `sTemplate="header"`.
|
|
53
|
-
*/
|
|
54
|
-
header;
|
|
55
|
-
/**
|
|
56
|
-
* @description Quando `true`, aumenta a largura da sidebar para acomodar mais conteúdo.
|
|
57
|
-
*
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
largeSized = false;
|
|
61
|
-
/**
|
|
62
|
-
* @description Quando `true`, mantém o conteúdo da sidebar no DOM mesmo quando oculta,
|
|
63
|
-
* preservando o estado interno dos componentes filhos.
|
|
64
|
-
*
|
|
65
|
-
* @default false
|
|
66
|
-
*/
|
|
67
|
-
cache = false;
|
|
68
|
-
/**
|
|
69
|
-
* @description Função de confirmação chamada antes de fechar a sidebar.
|
|
70
|
-
* Quando retornar `false`, o fechamento é bloqueado. Útil para validar formulários não salvos.
|
|
71
|
-
*/
|
|
72
|
-
set registerConfirmClose(fn) {
|
|
73
|
-
this._confirmClose = fn;
|
|
74
|
-
}
|
|
75
|
-
headerTemplate = null;
|
|
76
|
-
bodyTemplate = null;
|
|
77
|
-
footerTemplate = null;
|
|
78
|
-
footerComponent = contentChild(FooterComponent);
|
|
79
|
-
_confirmClose = () => true;
|
|
80
|
-
visibleEffect = effect(() => {
|
|
81
|
-
const visible = this.visible();
|
|
82
|
-
if (visible) {
|
|
83
|
-
disableScroll();
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
enableScroll();
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
ngAfterContentInit() {
|
|
90
|
-
this._getTemplates();
|
|
91
|
-
}
|
|
92
|
-
ngOnDestroy() {
|
|
93
|
-
this.visibleEffect.destroy();
|
|
94
|
-
}
|
|
95
|
-
closeSidebar() {
|
|
96
|
-
if (this._confirmClose()) {
|
|
97
|
-
this.visible.set(false);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
handleEscape() {
|
|
101
|
-
if (this.closeOnEscape) {
|
|
102
|
-
this.closeSidebar();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
_getCustomTemplate(type) {
|
|
106
|
-
return this.templates?.find((template) => template.type === type)?.template ?? null;
|
|
107
|
-
}
|
|
108
|
-
getHeaderTemplate() {
|
|
109
|
-
return this._getCustomTemplate('header') ?? null;
|
|
110
|
-
}
|
|
111
|
-
getBodyTemplate() {
|
|
112
|
-
return this._getCustomTemplate('body') ?? null;
|
|
113
|
-
}
|
|
114
|
-
getFooterTemplate() {
|
|
115
|
-
return this._getCustomTemplate('footer') ?? null;
|
|
116
|
-
}
|
|
117
|
-
_getTemplates() {
|
|
118
|
-
this.headerTemplate = this.getHeaderTemplate();
|
|
119
|
-
this.bodyTemplate = this.getBodyTemplate();
|
|
120
|
-
this.footerTemplate = this.getFooterTemplate();
|
|
121
|
-
}
|
|
122
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SidebarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
123
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: SidebarComponent, isStandalone: true, selector: "s-sidebar", inputs: { visible: { classPropertyName: "visible", publicName: "visible", isSignal: true, isRequired: false, transformFunction: null }, closable: { classPropertyName: "closable", publicName: "closable", isSignal: false, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: false, isRequired: false, transformFunction: null }, closeOnEscape: { classPropertyName: "closeOnEscape", publicName: "closeOnEscape", isSignal: false, isRequired: false, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: false, isRequired: false, transformFunction: null }, largeSized: { classPropertyName: "largeSized", publicName: "largeSized", isSignal: false, isRequired: false, transformFunction: null }, cache: { classPropertyName: "cache", publicName: "cache", isSignal: false, isRequired: false, transformFunction: null }, registerConfirmClose: { classPropertyName: "registerConfirmClose", publicName: "registerConfirmClose", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { visible: "visibleChange" }, host: { listeners: { "document:keydown.escape": "handleEscape()" } }, queries: [{ propertyName: "footerComponent", first: true, predicate: FooterComponent, descendants: true, isSignal: true }, { propertyName: "templates", predicate: TemplateDirective }], ngImport: i0, template: "@if (visible()) {\n <div\n class=\"backdrop\"\n (click)=\"dismissible && closeSidebar()\"\n ></div>\n}\n\n@if (cache || visible()) {\n <div\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"visible()\"\n [@visibilityChanged]\n class=\"sidebar\"\n [class.sidebar--open]=\"visible()\"\n [class.sidebar--large-size]=\"largeSized\"\n >\n <div class=\"sidebar__header\">\n @if (headerTemplate) {\n <ng-template *ngTemplateOutlet=\"headerTemplate\"></ng-template>\n } @else {\n <span class=\"sidebar__header__title\">{{ header }}</span>\n }\n @if (closable) {\n <button\n class=\"sidebar__header__close fa-solid fa-xmark\"\n (click)=\"closeSidebar()\"\n ></button>\n }\n </div>\n <div class=\"sidebar__body\">\n @if (bodyTemplate) {\n <ng-template [ngTemplateOutlet]=\"bodyTemplate\"></ng-template>\n } @else {\n <ng-content select=\":not(s-footer)\"></ng-content>\n }\n </div>\n @if (footerTemplate || footerComponent()) {\n <div class=\"sidebar__footer\">\n @if (footerTemplate) {\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"></ng-template>\n } @else {\n <ng-content select=\"s-footer\"></ng-content>\n }\n </div>\n }\n </div>\n}\n\n", styles: [".backdrop{background-color:#00000080;height:100%;left:0;position:fixed;top:0;transition:opacity .3s;width:100%;z-index:998}.sidebar{background-color:#fff;box-shadow:0 1px 5px #00000040;display:flex;flex-direction:column;height:100%;right:-100%;padding:1rem;position:fixed;top:0;transition:right .3s;width:100%;z-index:999}.sidebar__header{border-bottom:1px solid #dedce5;display:flex;justify-content:space-between;padding-bottom:.75rem}.sidebar__header__title{color:#212533;font-family:Inter,sans-serif;font-size:1rem;text-transform:uppercase;-webkit-user-select:none;user-select:none}.sidebar__header__close{background-color:transparent;border:none;color:#212533;cursor:pointer;font-size:1rem;padding:.5rem}.sidebar__body{flex-grow:1;overflow:auto;padding:1rem .5rem}.sidebar__footer{border-top:1px solid #dedce5;padding-top:.75rem}.sidebar--open{right:0}@media (min-width: 768px){.sidebar{width:75%}}@media (min-width: 992px){.sidebar{width:50%}}\n"], dependencies: [{ kind: "directive", type: CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], animations: [
|
|
124
|
-
trigger('visibilityChanged', [
|
|
125
|
-
transition(':enter', [
|
|
126
|
-
style({ transform: 'translateX(100%)' }),
|
|
127
|
-
animate('300ms', style({ transform: 'translateX(0)' })),
|
|
128
|
-
]),
|
|
129
|
-
transition(':leave', [
|
|
130
|
-
style({ transform: 'translateX(0)' }),
|
|
131
|
-
animate('300ms', style({ transform: 'translateX(100%)' })),
|
|
132
|
-
]),
|
|
133
|
-
]),
|
|
134
|
-
] });
|
|
135
|
-
}
|
|
136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SidebarComponent, decorators: [{
|
|
137
|
-
type: Component,
|
|
138
|
-
args: [{ selector: 's-sidebar', host: {
|
|
139
|
-
'(document:keydown.escape)': 'handleEscape()',
|
|
140
|
-
}, animations: [
|
|
141
|
-
trigger('visibilityChanged', [
|
|
142
|
-
transition(':enter', [
|
|
143
|
-
style({ transform: 'translateX(100%)' }),
|
|
144
|
-
animate('300ms', style({ transform: 'translateX(0)' })),
|
|
145
|
-
]),
|
|
146
|
-
transition(':leave', [
|
|
147
|
-
style({ transform: 'translateX(0)' }),
|
|
148
|
-
animate('300ms', style({ transform: 'translateX(100%)' })),
|
|
149
|
-
]),
|
|
150
|
-
]),
|
|
151
|
-
], standalone: true, imports: [CdkTrapFocus, NgTemplateOutlet], template: "@if (visible()) {\n <div\n class=\"backdrop\"\n (click)=\"dismissible && closeSidebar()\"\n ></div>\n}\n\n@if (cache || visible()) {\n <div\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"visible()\"\n [@visibilityChanged]\n class=\"sidebar\"\n [class.sidebar--open]=\"visible()\"\n [class.sidebar--large-size]=\"largeSized\"\n >\n <div class=\"sidebar__header\">\n @if (headerTemplate) {\n <ng-template *ngTemplateOutlet=\"headerTemplate\"></ng-template>\n } @else {\n <span class=\"sidebar__header__title\">{{ header }}</span>\n }\n @if (closable) {\n <button\n class=\"sidebar__header__close fa-solid fa-xmark\"\n (click)=\"closeSidebar()\"\n ></button>\n }\n </div>\n <div class=\"sidebar__body\">\n @if (bodyTemplate) {\n <ng-template [ngTemplateOutlet]=\"bodyTemplate\"></ng-template>\n } @else {\n <ng-content select=\":not(s-footer)\"></ng-content>\n }\n </div>\n @if (footerTemplate || footerComponent()) {\n <div class=\"sidebar__footer\">\n @if (footerTemplate) {\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"></ng-template>\n } @else {\n <ng-content select=\"s-footer\"></ng-content>\n }\n </div>\n }\n </div>\n}\n\n", styles: [".backdrop{background-color:#00000080;height:100%;left:0;position:fixed;top:0;transition:opacity .3s;width:100%;z-index:998}.sidebar{background-color:#fff;box-shadow:0 1px 5px #00000040;display:flex;flex-direction:column;height:100%;right:-100%;padding:1rem;position:fixed;top:0;transition:right .3s;width:100%;z-index:999}.sidebar__header{border-bottom:1px solid #dedce5;display:flex;justify-content:space-between;padding-bottom:.75rem}.sidebar__header__title{color:#212533;font-family:Inter,sans-serif;font-size:1rem;text-transform:uppercase;-webkit-user-select:none;user-select:none}.sidebar__header__close{background-color:transparent;border:none;color:#212533;cursor:pointer;font-size:1rem;padding:.5rem}.sidebar__body{flex-grow:1;overflow:auto;padding:1rem .5rem}.sidebar__footer{border-top:1px solid #dedce5;padding-top:.75rem}.sidebar--open{right:0}@media (min-width: 768px){.sidebar{width:75%}}@media (min-width: 992px){.sidebar{width:50%}}\n"] }]
|
|
152
|
-
}], propDecorators: { templates: [{
|
|
153
|
-
type: ContentChildren,
|
|
154
|
-
args: [TemplateDirective]
|
|
155
|
-
}], closable: [{
|
|
156
|
-
type: Input
|
|
157
|
-
}], dismissible: [{
|
|
158
|
-
type: Input
|
|
159
|
-
}], closeOnEscape: [{
|
|
160
|
-
type: Input
|
|
161
|
-
}], header: [{
|
|
162
|
-
type: Input
|
|
163
|
-
}], largeSized: [{
|
|
164
|
-
type: Input
|
|
165
|
-
}], cache: [{
|
|
166
|
-
type: Input
|
|
167
|
-
}], registerConfirmClose: [{
|
|
168
|
-
type: Input
|
|
169
|
-
}] } });
|
|
170
|
-
|
|
171
|
-
class SidebarModule {
|
|
172
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SidebarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
173
|
-
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: SidebarModule, imports: [SidebarComponent], exports: [SidebarComponent, TemplateModule] });
|
|
174
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SidebarModule, imports: [TemplateModule] });
|
|
175
|
-
}
|
|
176
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SidebarModule, decorators: [{
|
|
177
|
-
type: NgModule,
|
|
178
|
-
args: [{
|
|
179
|
-
imports: [SidebarComponent],
|
|
180
|
-
exports: [SidebarComponent, TemplateModule],
|
|
181
|
-
}]
|
|
182
|
-
}] });
|
|
7
|
+
const DrawerComponent = DrawerComponent$1;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use DrawerModule from '@seniorsistemas/angular-components/drawer'.
|
|
10
|
+
* O pacote sidebar será removido na versão 20.0.0.
|
|
11
|
+
*/
|
|
12
|
+
const DrawerModule = DrawerModule$1;
|
|
183
13
|
|
|
184
14
|
/**
|
|
185
15
|
* Generated bundle index. Do not edit.
|
|
186
16
|
*/
|
|
187
17
|
|
|
188
|
-
export {
|
|
18
|
+
export { DrawerComponent, DrawerModule };
|
|
189
19
|
//# sourceMappingURL=seniorsistemas-angular-components-sidebar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seniorsistemas-angular-components-sidebar.mjs","sources":["../../projects/angular-components/sidebar/src/lib/sidebar/sidebar.component.ts","../../projects/angular-components/sidebar/src/lib/sidebar/sidebar.component.html","../../projects/angular-components/sidebar/src/lib/sidebar/sidebar.module.ts","../../projects/angular-components/sidebar/src/seniorsistemas-angular-components-sidebar.ts"],"sourcesContent":["import { animate, style, transition, trigger } from '@angular/animations';\r\nimport { CdkTrapFocus } from '@angular/cdk/a11y';\r\nimport { NgTemplateOutlet } from '@angular/common';\r\nimport {\r\n AfterContentInit,\r\n Component,\r\n contentChild,\r\n ContentChildren,\r\n effect,\r\n Input,\r\n model,\r\n OnDestroy,\r\n QueryList,\r\n TemplateRef,\r\n} from '@angular/core';\r\nimport { FooterComponent } from '@seniorsistemas/angular-components/structure';\r\nimport { TemplateDirective } from '@seniorsistemas/angular-components/template';\r\nimport { disableScroll, enableScroll } from '@seniorsistemas/angular-components/utils';\r\n\r\n/**\r\n * @description Componente de painel lateral deslizante (sidebar) que aparece sobre o conteúdo\r\n * vindo do lado direito da tela. Suporta templates customizados para cabeçalho, corpo e rodapé\r\n * via `sTemplate`, bloqueio de scroll automático e confirmação de fechamento.\r\n *\r\n * @example\r\n * ```html\r\n * <s-sidebar [(visible)]=\"sidebarOpen\" header=\"Filtros\" [closable]=\"true\">\r\n * <ng-template sTemplate=\"body\">Conteúdo</ng-template>\r\n * </s-sidebar>\r\n * ```\r\n *\r\n * @category Overlay\r\n */\r\n@Component({\r\n selector: 's-sidebar',\r\n templateUrl: './sidebar.component.html',\r\n styleUrls: ['./sidebar.component.scss'],\r\n host: {\r\n '(document:keydown.escape)': 'handleEscape()',\r\n },\r\n animations: [\r\n trigger('visibilityChanged', [\r\n transition(':enter', [\r\n style({ transform: 'translateX(100%)' }),\r\n animate('300ms', style({ transform: 'translateX(0)' })),\r\n ]),\r\n transition(':leave', [\r\n style({ transform: 'translateX(0)' }),\r\n animate('300ms', style({ transform: 'translateX(100%)' })),\r\n ]),\r\n ]),\r\n ],\r\n standalone: true,\r\n imports: [CdkTrapFocus, NgTemplateOutlet],\r\n})\r\nexport class SidebarComponent implements AfterContentInit, OnDestroy {\r\n @ContentChildren(TemplateDirective)\r\n public templates: QueryList<TemplateDirective> | null = null;\r\n\r\n /**\r\n * @description Controla a visibilidade da sidebar. Suporta two-way binding via `[(visible)]`.\r\n *\r\n * @default false\r\n */\r\n public visible = model<boolean>(false);\r\n\r\n /**\r\n * @description Quando `true`, exibe o botão de fechar (X) no cabeçalho da sidebar.\r\n *\r\n * @default true\r\n */\r\n @Input()\r\n public closable = true;\r\n\r\n /**\r\n * @description Quando `true`, clicar no backdrop (área escurecida fora da sidebar) fecha o painel.\r\n *\r\n * @default true\r\n */\r\n @Input()\r\n public dismissible = true;\r\n\r\n /**\r\n * @description Quando `true`, pressionar a tecla Escape fecha a sidebar.\r\n *\r\n * @default true\r\n */\r\n @Input()\r\n public closeOnEscape = true;\r\n\r\n /**\r\n * @description Texto exibido no cabeçalho padrão da sidebar.\r\n * Pode ser substituído por um template customizado via `sTemplate=\"header\"`.\r\n */\r\n @Input()\r\n public header?: string;\r\n\r\n /**\r\n * @description Quando `true`, aumenta a largura da sidebar para acomodar mais conteúdo.\r\n *\r\n * @default false\r\n */\r\n @Input()\r\n public largeSized = false;\r\n\r\n /**\r\n * @description Quando `true`, mantém o conteúdo da sidebar no DOM mesmo quando oculta,\r\n * preservando o estado interno dos componentes filhos.\r\n *\r\n * @default false\r\n */\r\n @Input()\r\n public cache = false;\r\n\r\n /**\r\n * @description Função de confirmação chamada antes de fechar a sidebar.\r\n * Quando retornar `false`, o fechamento é bloqueado. Útil para validar formulários não salvos.\r\n */\r\n @Input()\r\n public set registerConfirmClose(fn: () => boolean) {\r\n this._confirmClose = fn;\r\n }\r\n\r\n public headerTemplate: TemplateRef<unknown> | null = null;\r\n public bodyTemplate: TemplateRef<unknown> | null = null;\r\n public footerTemplate: TemplateRef<unknown> | null = null;\r\n\r\n protected readonly footerComponent = contentChild(FooterComponent);\r\n\r\n private _confirmClose = () => true;\r\n\r\n private readonly visibleEffect = effect(() => {\r\n const visible = this.visible();\r\n if (visible) {\r\n disableScroll();\r\n } else {\r\n enableScroll();\r\n }\r\n });\r\n\r\n public ngAfterContentInit(): void {\r\n this._getTemplates();\r\n }\r\n\r\n public ngOnDestroy(): void {\r\n this.visibleEffect.destroy();\r\n }\r\n\r\n public closeSidebar(): void {\r\n if (this._confirmClose()) {\r\n this.visible.set(false);\r\n }\r\n }\r\n\r\n public handleEscape(): void {\r\n if (this.closeOnEscape) {\r\n this.closeSidebar();\r\n }\r\n }\r\n\r\n private _getCustomTemplate(type: string): TemplateRef<any> | null {\r\n return this.templates?.find((template: TemplateDirective) => template.type === type)?.template ?? null;\r\n }\r\n\r\n private getHeaderTemplate(): TemplateRef<unknown> | null {\r\n return this._getCustomTemplate('header') ?? null;\r\n }\r\n\r\n private getBodyTemplate(): TemplateRef<unknown> | null {\r\n return this._getCustomTemplate('body') ?? null;\r\n }\r\n\r\n private getFooterTemplate(): TemplateRef<unknown> | null {\r\n return this._getCustomTemplate('footer') ?? null;\r\n }\r\n\r\n private _getTemplates(): void {\r\n this.headerTemplate = this.getHeaderTemplate();\r\n this.bodyTemplate = this.getBodyTemplate();\r\n this.footerTemplate = this.getFooterTemplate();\r\n }\r\n}\r\n","@if (visible()) {\n <div\n class=\"backdrop\"\n (click)=\"dismissible && closeSidebar()\"\n ></div>\n}\n\n@if (cache || visible()) {\n <div\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"visible()\"\n [@visibilityChanged]\n class=\"sidebar\"\n [class.sidebar--open]=\"visible()\"\n [class.sidebar--large-size]=\"largeSized\"\n >\n <div class=\"sidebar__header\">\n @if (headerTemplate) {\n <ng-template *ngTemplateOutlet=\"headerTemplate\"></ng-template>\n } @else {\n <span class=\"sidebar__header__title\">{{ header }}</span>\n }\n @if (closable) {\n <button\n class=\"sidebar__header__close fa-solid fa-xmark\"\n (click)=\"closeSidebar()\"\n ></button>\n }\n </div>\n <div class=\"sidebar__body\">\n @if (bodyTemplate) {\n <ng-template [ngTemplateOutlet]=\"bodyTemplate\"></ng-template>\n } @else {\n <ng-content select=\":not(s-footer)\"></ng-content>\n }\n </div>\n @if (footerTemplate || footerComponent()) {\n <div class=\"sidebar__footer\">\n @if (footerTemplate) {\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"></ng-template>\n } @else {\n <ng-content select=\"s-footer\"></ng-content>\n }\n </div>\n }\n </div>\n}\n\n","import { NgModule } from '@angular/core';\r\n\r\nimport { SidebarComponent } from './sidebar.component';\r\nimport { TemplateModule } from '@seniorsistemas/angular-components/template';\r\n\r\n@NgModule({\r\n imports: [SidebarComponent],\r\n exports: [SidebarComponent, TemplateModule],\r\n})\r\nexport class SidebarModule {}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AAmBA;;;;;;;;;;;;;AAaG;MAuBU,gBAAgB,CAAA;IAElB,SAAS,GAAwC,IAAI,CAAC;AAE7D;;;;AAIG;AACI,IAAA,OAAO,GAAG,KAAK,CAAU,KAAK,CAAC,CAAC;AAEvC;;;;AAIG;IAEI,QAAQ,GAAG,IAAI,CAAC;AAEvB;;;;AAIG;IAEI,WAAW,GAAG,IAAI,CAAC;AAE1B;;;;AAIG;IAEI,aAAa,GAAG,IAAI,CAAC;AAE5B;;;AAGG;AAEI,IAAA,MAAM,CAAU;AAEvB;;;;AAIG;IAEI,UAAU,GAAG,KAAK,CAAC;AAE1B;;;;;AAKG;IAEI,KAAK,GAAG,KAAK,CAAC;AAErB;;;AAGG;IACH,IACW,oBAAoB,CAAC,EAAiB,EAAA;AAC7C,QAAA,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;KAC3B;IAEM,cAAc,GAAgC,IAAI,CAAC;IACnD,YAAY,GAAgC,IAAI,CAAC;IACjD,cAAc,GAAgC,IAAI,CAAC;AAEvC,IAAA,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAE3D,IAAA,aAAa,GAAG,MAAM,IAAI,CAAC;AAElB,IAAA,aAAa,GAAG,MAAM,CAAC,MAAK;AACzC,QAAA,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,OAAO,EAAE;AACT,YAAA,aAAa,EAAE,CAAC;SACnB;aAAM;AACH,YAAA,YAAY,EAAE,CAAC;SAClB;AACL,KAAC,CAAC,CAAC;IAEI,kBAAkB,GAAA;QACrB,IAAI,CAAC,aAAa,EAAE,CAA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AAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,EAHZ,OAAA,EAAA,CAAA,gBAAgB,CAChB,EAAA,OAAA,EAAA,CAAA,gBAAgB,EAAE,cAAc,CAAA,EAAA,CAAA,CAAA;AAEjC,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,aAAa,YAFM,cAAc,CAAA,EAAA,CAAA,CAAA;;4FAEjC,aAAa,EAAA,UAAA,EAAA,CAAA;kBAJzB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,gBAAgB,CAAC;AAC3B,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC;AAC9C,iBAAA,CAAA;;;ACRD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"seniorsistemas-angular-components-sidebar.mjs","sources":["../../projects/angular-components/sidebar/src/public-api.ts","../../projects/angular-components/sidebar/src/seniorsistemas-angular-components-sidebar.ts"],"sourcesContent":["import {\n DrawerComponent as DrawerComponentOriginal,\n DrawerModule as DrawerModuleOriginal,\n} from '@seniorsistemas/angular-components/drawer';\n\n/**\n * @deprecated Use DrawerComponent from '@seniorsistemas/angular-components/drawer'.\n * O pacote sidebar será removido na versão 20.0.0.\n */\nexport const DrawerComponent = DrawerComponentOriginal;\n\n/**\n * @deprecated Use DrawerModule from '@seniorsistemas/angular-components/drawer'.\n * O pacote sidebar será removido na versão 20.0.0.\n */\nexport const DrawerModule = DrawerModuleOriginal;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["DrawerComponentOriginal","DrawerModuleOriginal"],"mappings":";;AAKA;;;AAGG;AACI,MAAM,eAAe,GAAGA,kBAAwB;AAEvD;;;AAGG;AACI,MAAM,YAAY,GAAGC;;ACf5B;;AAEG;;;;"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { EventEmitter, forwardRef, Component, Input, Output, ViewChild, HostListener, NgModule } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import * as i1 from '@ngx-translate/core';
|
|
5
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* @description Componente de chave tipo switch (liga/desliga) que implementa
|
|
@@ -80,7 +82,7 @@ class SwitchComponent {
|
|
|
80
82
|
useExisting: forwardRef(() => SwitchComponent),
|
|
81
83
|
multi: true,
|
|
82
84
|
},
|
|
83
|
-
], viewQueries: [{ propertyName: "switchRef", first: true, predicate: ["switch"], descendants: true, static: true }], ngImport: i0, template: "<div\n #switch\n class=\"inline-flex items-center\"\n [class.opacity-50]=\"disabled\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"inline-block h-6 m-0 relative w-10\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n class=\"h-0 opacity-0 w-0\"\n [attr.aria-checked]=\"value\"\n [
|
|
85
|
+
], viewQueries: [{ propertyName: "switchRef", first: true, predicate: ["switch"], descendants: true, static: true }], ngImport: i0, template: "<div\n #switch\n class=\"inline-flex items-center\"\n role=\"group\"\n [attr.aria-label]=\"label || ('platform.angular_components.switch_toggle' | translate)\"\n [class.opacity-50]=\"disabled\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"inline-block h-6 m-0 relative w-10\">\n <span class=\"sr-only\">{{ label || ('platform.angular_components.switch_toggle' | translate) }}</span>\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n class=\"h-0 opacity-0 w-0\"\n [attr.aria-checked]=\"value\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly || null\"\n (change)=\"toggleCheck()\"\n />\n <span\n class=\"slider bg-grayscale-40 rounded-[15px] inset-0 absolute cursor-pointer transition-all duration-[400ms]\"\n aria-hidden=\"true\"\n ></span>\n </label>\n @if (showStatusLabel) {\n <span class=\"text-grayscale-90 font-open-sans text-sm font-normal leading-[150%] ml-3\">{{ value ? trueLabel : falseLabel }}</span>\n }\n</div>\n\n", styles: [".slider:before{background-color:#fff;border-radius:50%;bottom:4px;content:\"\";height:16px;left:4px;position:absolute;transition:.4s;width:16px}input:checked+.slider{background-color:#428bca}input:checked+.slider:before{transform:translate(16px)}input:focus-visible+.slider{box-shadow:0 0 0 2px #000;outline:2px solid #000;outline-offset:1px}.switch--focus .slider{box-shadow:0 0 0 2px #428bca80}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }] });
|
|
84
86
|
}
|
|
85
87
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchComponent, decorators: [{
|
|
86
88
|
type: Component,
|
|
@@ -90,7 +92,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
90
92
|
useExisting: forwardRef(() => SwitchComponent),
|
|
91
93
|
multi: true,
|
|
92
94
|
},
|
|
93
|
-
], standalone: true, imports: [], template: "<div\n #switch\n class=\"inline-flex items-center\"\n [class.opacity-50]=\"disabled\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"inline-block h-6 m-0 relative w-10\">\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n class=\"h-0 opacity-0 w-0\"\n [attr.aria-checked]=\"value\"\n [
|
|
95
|
+
], standalone: true, imports: [TranslateModule], template: "<div\n #switch\n class=\"inline-flex items-center\"\n role=\"group\"\n [attr.aria-label]=\"label || ('platform.angular_components.switch_toggle' | translate)\"\n [class.opacity-50]=\"disabled\"\n [attr.aria-disabled]=\"disabled || null\"\n>\n <label class=\"inline-block h-6 m-0 relative w-10\">\n <span class=\"sr-only\">{{ label || ('platform.angular_components.switch_toggle' | translate) }}</span>\n <input\n #input\n [id]=\"inputId\"\n [name]=\"inputName\"\n type=\"checkbox\"\n role=\"switch\"\n class=\"h-0 opacity-0 w-0\"\n [attr.aria-checked]=\"value\"\n [checked]=\"value\"\n [disabled]=\"disabled\"\n [attr.aria-readonly]=\"readonly || null\"\n (change)=\"toggleCheck()\"\n />\n <span\n class=\"slider bg-grayscale-40 rounded-[15px] inset-0 absolute cursor-pointer transition-all duration-[400ms]\"\n aria-hidden=\"true\"\n ></span>\n </label>\n @if (showStatusLabel) {\n <span class=\"text-grayscale-90 font-open-sans text-sm font-normal leading-[150%] ml-3\">{{ value ? trueLabel : falseLabel }}</span>\n }\n</div>\n\n", styles: [".slider:before{background-color:#fff;border-radius:50%;bottom:4px;content:\"\";height:16px;left:4px;position:absolute;transition:.4s;width:16px}input:checked+.slider{background-color:#428bca}input:checked+.slider:before{transform:translate(16px)}input:focus-visible+.slider{box-shadow:0 0 0 2px #000;outline:2px solid #000;outline-offset:1px}.switch--focus .slider{box-shadow:0 0 0 2px #428bca80}\n"] }]
|
|
94
96
|
}], propDecorators: { readonly: [{
|
|
95
97
|
type: Input
|
|
96
98
|
}], trueLabel: [{
|
|
@@ -125,7 +127,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
125
127
|
class SwitchModule {
|
|
126
128
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
127
129
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, imports: [SwitchComponent], exports: [SwitchComponent] });
|
|
128
|
-
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule });
|
|
130
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, imports: [SwitchComponent] });
|
|
129
131
|
}
|
|
130
132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: SwitchModule, decorators: [{
|
|
131
133
|
type: NgModule,
|