structra-ui 0.1.97 → 0.1.98

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.
@@ -1,6 +1,6 @@
1
1
  import '../structra-ui.css';
2
2
  import * as i0 from '@angular/core';
3
- import { booleanAttribute, HostBinding, Input, ChangeDetectionStrategy, Component, numberAttribute, ElementRef, ViewChild, inject, ChangeDetectorRef, Injector, DestroyRef, EventEmitter, Output, Directive, signal, computed, Injectable, HostListener, ViewChildren, forwardRef, ApplicationRef, afterNextRender, ContentChildren, NgZone, ViewContainerRef, TemplateRef, ContentChild } from '@angular/core';
3
+ import { booleanAttribute, HostBinding, Input, ChangeDetectionStrategy, Component, numberAttribute, ElementRef, ViewChild, inject, ChangeDetectorRef, Injector, DestroyRef, EventEmitter, Output, Directive, signal, computed, Injectable, Renderer2, HostListener, ViewChildren, forwardRef, ApplicationRef, afterNextRender, ContentChildren, NgZone, ViewContainerRef, TemplateRef, ContentChild } from '@angular/core';
4
4
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
5
  import * as i1 from '@angular/forms';
6
6
  import { Validators, FormGroupDirective, NgForm, NgControl, NG_VALUE_ACCESSOR, FormsModule, FormGroup, FormArray, FormControl } from '@angular/forms';
@@ -625,6 +625,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
625
625
  args: ['attr.data-control-id']
626
626
  }] } });
627
627
 
628
+ const STRUCTRA_THEME_IDS = [
629
+ 'blue',
630
+ 'green',
631
+ 'purple',
632
+ 'orange',
633
+ 'white',
634
+ 'gray',
635
+ 'sepia',
636
+ 'black',
637
+ ];
638
+
639
+ const APP_THEME_BASE_CLASS = 'app-library-theme';
640
+ function normalizeStructraTheme(theme) {
641
+ const candidate = String(theme);
642
+ if (STRUCTRA_THEME_IDS.includes(candidate)) {
643
+ return candidate;
644
+ }
645
+ return 'black';
646
+ }
647
+ function getThemeTokenClass(theme) {
648
+ return `theme-${normalizeStructraTheme(theme)}`;
649
+ }
650
+ function getThemeClassList(theme) {
651
+ return [APP_THEME_BASE_CLASS, getThemeTokenClass(theme)];
652
+ }
653
+ function getThemeClass(theme) {
654
+ return getThemeClassList(theme).join(' ');
655
+ }
656
+
628
657
  /** Identificadores de paleta suportados pela library (uso em `AppThemeService.setTheme`). */
629
658
  var AppTheme;
630
659
  (function (AppTheme) {
@@ -638,14 +667,7 @@ var AppTheme;
638
667
  AppTheme["Black"] = "black";
639
668
  })(AppTheme || (AppTheme = {}));
640
669
  const APP_THEME_IDS = [
641
- AppTheme.Blue,
642
- AppTheme.Green,
643
- AppTheme.Purple,
644
- AppTheme.Orange,
645
- AppTheme.White,
646
- AppTheme.Gray,
647
- AppTheme.Sepia,
648
- AppTheme.Black,
670
+ ...STRUCTRA_THEME_IDS,
649
671
  ];
650
672
  /**
651
673
  * Estado global do tema da library: **sempre** `.app-library-theme` + `theme-*` juntos.
@@ -659,12 +681,12 @@ class AppThemeService {
659
681
  /**
660
682
  * Classes separadas (ex.: CDK `panelClass` — uma string com espaço quebra `classList.add`).
661
683
  */
662
- this.themeClassList = computed(() => ['app-library-theme', `theme-${this.activeId()}`], ...(ngDevMode ? [{ debugName: "themeClassList" }] : /* istanbul ignore next */ []));
684
+ this.themeClassList = computed(() => getThemeClassList(this.activeId()), ...(ngDevMode ? [{ debugName: "themeClassList" }] : /* istanbul ignore next */ []));
663
685
  /**
664
686
  * As duas classes numa string — útil para `[class]`, `[ngClass]` com string, ou hosts HTML.
665
687
  * Ex.: `<div [ngClass]="libTheme.getTheme()">` aplica paleta completa no consumidor.
666
688
  */
667
- this.getTheme = computed(() => this.themeClassList().join(' '), ...(ngDevMode ? [{ debugName: "getTheme" }] : /* istanbul ignore next */ []));
689
+ this.getTheme = computed(() => getThemeClass(this.activeId()), ...(ngDevMode ? [{ debugName: "getTheme" }] : /* istanbul ignore next */ []));
668
690
  /** Mapa para `[ngClass]` com chaves dinâmicas (painéis overlay). */
669
691
  this.themeClassMap = computed(() => {
670
692
  const [base, token] = this.themeClassList();
@@ -696,6 +718,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
696
718
  args: [{ providedIn: 'root' }]
697
719
  }] });
698
720
 
721
+ class ThemeDirective {
722
+ constructor() {
723
+ this.theme = 'black';
724
+ this.elementRef = inject((ElementRef));
725
+ this.renderer = inject(Renderer2);
726
+ this.themeTokenClasses = STRUCTRA_THEME_IDS.map((themeId) => `theme-${themeId}`);
727
+ }
728
+ ngOnChanges() {
729
+ const element = this.elementRef.nativeElement;
730
+ this.renderer.addClass(element, APP_THEME_BASE_CLASS);
731
+ for (const themeClass of this.themeTokenClasses) {
732
+ this.renderer.removeClass(element, themeClass);
733
+ }
734
+ this.renderer.addClass(element, getThemeTokenClass(this.theme));
735
+ }
736
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
737
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: ThemeDirective, isStandalone: true, selector: "[appTheme]", inputs: { theme: ["appTheme", "theme"] }, usesOnChanges: true, ngImport: i0 }); }
738
+ }
739
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: ThemeDirective, decorators: [{
740
+ type: Directive,
741
+ args: [{
742
+ selector: '[appTheme]',
743
+ standalone: true,
744
+ }]
745
+ }], propDecorators: { theme: [{
746
+ type: Input,
747
+ args: ['appTheme']
748
+ }] } });
749
+
699
750
  /** Posição por omissão do CDK (equivalente ao comportamento anterior sem `positions` explícitas). */
700
751
  const DEFAULT_CONNECTED_POSITIONS = [
701
752
  {
@@ -3447,8 +3498,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
3447
3498
  class CheckboxFieldComponent extends BooleanFieldDirective {
3448
3499
  constructor() {
3449
3500
  super(...arguments);
3450
- /** `true` (padrão): host ocupa 100%. Com `false`, usa largura intrínseca (útil em `app-form-row` com justify). */
3451
- this.fullWidth = true;
3501
+ /** `false` (padrão): host usa largura intrínseca. Com `true`, ocupa 100%. */
3502
+ this.fullWidth = false;
3452
3503
  }
3453
3504
  get fullWidthClass() {
3454
3505
  return this.fullWidth;
@@ -7415,7 +7466,7 @@ class FormSectionComponent {
7415
7466
  constructor() {
7416
7467
  this.subtitulo = '';
7417
7468
  this.dense = false;
7418
- this.divider = true;
7469
+ this.divider = false;
7419
7470
  }
7420
7471
  get hostClass() {
7421
7472
  const parts = ['form-section'];
@@ -10292,5 +10343,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
10292
10343
  * Generated bundle index. Do not edit.
10293
10344
  */
10294
10345
 
10295
- export { ADAPTIVE_DATA_VIEW_MOBILE_QUERY, APP_SIDEBAR_LABEL_REVEAL_LAG_MS, APP_SIDEBAR_LAYOUT_DURATION_MS, APP_SIDEBAR_NAV_REVEAL_TOTAL_MS, APP_THEME_IDS, ActionMenuComponent, AdaptiveDataViewComponent, AnchoredOverlayComponent, AppBreadcrumbComponent, AppDialogComponent, AppLibLightBlockScrollStrategy, AppShellComponent, AppShellSidebarTemplateDirective, AppShellSidebarToggleComponent, AppSidebarComponent, AppSidebarToolbarDirective, AppTheme, AppThemeService, AppTopbarComponent, AppUserMenuComponent, BR_ESTADOS_NOME_SIGLA, BaseFieldComponent, BaseFieldDirective, BooleanFieldDirective, ButtonComponent, ButtonRadius, ButtonSize, ButtonType, ButtonVariant, CardListComponent, CepFieldComponent, CheckboxFieldComponent, ConfirmDialogComponent, ConfirmDialogService, ContextMenuComponent, CpfCnpjFieldComponent, DashboardSectionComponent, DataCardComponent, DataGridComponent, DataListComponent, DataToolbarComponent, DateFieldComponent, DecimalFieldComponent, DetailsFieldComponent, DetailsViewComponent, DialogFooterDirective, DividerComponent, DrawerComponent, DrawerSide, DrawerSize, DropdownBaseComponent, DropdownMenuComponent, DropdownMultiOptionFieldBase, DropdownOptionFieldBase, DropdownSearchFieldComponent, EmptyStateComponent, FILE_PREVIEW_UNAVAILABLE_MESSAGE, FileUploadFieldComponent, FormActionsAlign, FormActionsComponent, FormColComponent, FormGroupComponent, FormGroupVariant, FormLayoutGap, FormRowAlign, FormRowComponent, FormRowJustify, FormSectionComponent, FormTabComponent, FormTabsComponent, ImagePreviewPanelComponent, InputMaskFieldComponent, IntegerFieldComponent, LAYOUT_STACK_SIDE_BY_SIDE, LAYOUT_STACK_STACKED, LayoutStackAlign, LayoutStackComponent, LayoutStackDirection, LayoutStackItemAlign, LibDialogSize, ListItemComponent, LoadingDialogComponent, LoadingDialogService, MaskedTextFieldBase, MenuDividerComponent, MenuDropdownPlacement, MenuGroupComponent, MenuListComponent, MultiselectFieldComponent, NgControlFieldDirective, OverlayPlacement, PDF_IFRAME_VIEWER_HASH, PasswordFieldComponent, PhoneFieldComponent, PopoverBodyTemplateDirective, PopoverComponent, PopoverFooterTemplateDirective, PopoverTriggerDirective, STRUCTRA_UI, SelectFieldComponent, SkeletonBlockComponent, SkeletonCardComponent, SkeletonFieldShellComponent, SkeletonListComponent, SkeletonTableComponent, SkeletonTextComponent, StatCardComponent, StatusBadgeComponent, SwitchFieldComponent, TableEmptyStateComponent, TableToolbarComponent, TextFieldComponent, TextareaFieldComponent, ToastHostComponent, ToastService, TooltipComponent, TooltipPanelTemplateDirective, ValidationSummaryComponent, anchoredOverlayPositions, appendPdfIframeViewerParams, applyPickedCalendarDate, buildDecimalBrDisplay, buildDecimalBrParseString, buildEmptyStateOverlayHtml, caretIndexFromIntegerDigitCount, caretIndexFromSemantic, cepMaskCompleteValidator, cpfCnpjMaskCompleteValidator, escapeHtml, extractDecimalBrParts, fileIsLikelyImage, fileMatchesAccept, fixedDigitsMaskCompleteValidator, formatAcceptForDisplay, formatDateTimePtBr, formatDecimalBr, formatFileSizeBytes, formatIntegerThousandsBr, formatMaskDigits, formatUiFieldDateValue, getFilePreviewKind, libDialogPanelClasses, mapEstadosToOptions, maskDigitCount, normalizeFormDateValue, parseDecimalBr, parseIntegerString, parseUiFieldDateValue, phoneBrMaskCompleteValidator, resolveControlAtPath, sanitizeDecimalBrInput, sanitizeIntegerDigits, sectionHasVisibleInvalid, semanticCaretAt, semanticIntegerDigitCountLeft, stripToDigits, subscribeMarkForCheckOnInvalidUiRefresh, subtreeHasVisibleInvalid };
10346
+ export { ADAPTIVE_DATA_VIEW_MOBILE_QUERY, APP_SIDEBAR_LABEL_REVEAL_LAG_MS, APP_SIDEBAR_LAYOUT_DURATION_MS, APP_SIDEBAR_NAV_REVEAL_TOTAL_MS, APP_THEME_BASE_CLASS, APP_THEME_IDS, ActionMenuComponent, AdaptiveDataViewComponent, AnchoredOverlayComponent, AppBreadcrumbComponent, AppDialogComponent, AppLibLightBlockScrollStrategy, AppShellComponent, AppShellSidebarTemplateDirective, AppShellSidebarToggleComponent, AppSidebarComponent, AppSidebarToolbarDirective, AppTheme, AppThemeService, AppTopbarComponent, AppUserMenuComponent, BR_ESTADOS_NOME_SIGLA, BaseFieldComponent, BaseFieldDirective, BooleanFieldDirective, ButtonComponent, ButtonRadius, ButtonSize, ButtonType, ButtonVariant, CardListComponent, CepFieldComponent, CheckboxFieldComponent, ConfirmDialogComponent, ConfirmDialogService, ContextMenuComponent, CpfCnpjFieldComponent, DashboardSectionComponent, DataCardComponent, DataGridComponent, DataListComponent, DataToolbarComponent, DateFieldComponent, DecimalFieldComponent, DetailsFieldComponent, DetailsViewComponent, DialogFooterDirective, DividerComponent, DrawerComponent, DrawerSide, DrawerSize, DropdownBaseComponent, DropdownMenuComponent, DropdownMultiOptionFieldBase, DropdownOptionFieldBase, DropdownSearchFieldComponent, EmptyStateComponent, FILE_PREVIEW_UNAVAILABLE_MESSAGE, FileUploadFieldComponent, FormActionsAlign, FormActionsComponent, FormColComponent, FormGroupComponent, FormGroupVariant, FormLayoutGap, FormRowAlign, FormRowComponent, FormRowJustify, FormSectionComponent, FormTabComponent, FormTabsComponent, ImagePreviewPanelComponent, InputMaskFieldComponent, IntegerFieldComponent, LAYOUT_STACK_SIDE_BY_SIDE, LAYOUT_STACK_STACKED, LayoutStackAlign, LayoutStackComponent, LayoutStackDirection, LayoutStackItemAlign, LibDialogSize, ListItemComponent, LoadingDialogComponent, LoadingDialogService, MaskedTextFieldBase, MenuDividerComponent, MenuDropdownPlacement, MenuGroupComponent, MenuListComponent, MultiselectFieldComponent, NgControlFieldDirective, OverlayPlacement, PDF_IFRAME_VIEWER_HASH, PasswordFieldComponent, PhoneFieldComponent, PopoverBodyTemplateDirective, PopoverComponent, PopoverFooterTemplateDirective, PopoverTriggerDirective, STRUCTRA_THEME_IDS, STRUCTRA_UI, SelectFieldComponent, SkeletonBlockComponent, SkeletonCardComponent, SkeletonFieldShellComponent, SkeletonListComponent, SkeletonTableComponent, SkeletonTextComponent, StatCardComponent, StatusBadgeComponent, SwitchFieldComponent, TableEmptyStateComponent, TableToolbarComponent, TextFieldComponent, TextareaFieldComponent, ThemeDirective, ToastHostComponent, ToastService, TooltipComponent, TooltipPanelTemplateDirective, ValidationSummaryComponent, anchoredOverlayPositions, appendPdfIframeViewerParams, applyPickedCalendarDate, buildDecimalBrDisplay, buildDecimalBrParseString, buildEmptyStateOverlayHtml, caretIndexFromIntegerDigitCount, caretIndexFromSemantic, cepMaskCompleteValidator, cpfCnpjMaskCompleteValidator, escapeHtml, extractDecimalBrParts, fileIsLikelyImage, fileMatchesAccept, fixedDigitsMaskCompleteValidator, formatAcceptForDisplay, formatDateTimePtBr, formatDecimalBr, formatFileSizeBytes, formatIntegerThousandsBr, formatMaskDigits, formatUiFieldDateValue, getFilePreviewKind, getThemeClass, getThemeClassList, getThemeTokenClass, libDialogPanelClasses, mapEstadosToOptions, maskDigitCount, normalizeFormDateValue, normalizeStructraTheme, parseDecimalBr, parseIntegerString, parseUiFieldDateValue, phoneBrMaskCompleteValidator, resolveControlAtPath, sanitizeDecimalBrInput, sanitizeIntegerDigits, sectionHasVisibleInvalid, semanticCaretAt, semanticIntegerDigitCountLeft, stripToDigits, subscribeMarkForCheckOnInvalidUiRefresh, subtreeHasVisibleInvalid };
10296
10347
  //# sourceMappingURL=structra-ui.mjs.map