@hug/ngx-search-container 21.0.2 → 22.0.0-alpha.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 22.0.0-alpha.2 (2026-04-01)
2
+
3
+ ### 🌱 Dependencies
4
+
5
+ - **@hug/ngx-core**: upgraded to `v22.0.0-alpha.2`
6
+
7
+ ## 22.0.0-alpha.1 (2026-03-13)
8
+
9
+ ### 🌱 Dependencies
10
+
11
+ - **@hug/ngx-core**: upgraded to `v22.0.0-alpha.1`
12
+
1
13
  ## 21.0.2 (2026-02-13)
2
14
 
3
15
  ### 🌱 Dependencies
package/README.md CHANGED
@@ -13,7 +13,7 @@ First of all you have to import the asset translation files like:
13
13
  "assets": [
14
14
  ...
15
15
  {
16
- "input": "node_modules/@hug/ngx-search-container/translations",
16
+ "input": "node_modules/@hug/ngx-search-container/m2/translations",
17
17
  "glob": "**/*",
18
18
  "output": "translations/ngx-search-container"
19
19
  }
@@ -0,0 +1,125 @@
1
+ import { NgTemplateOutlet, AsyncPipe } from '@angular/common';
2
+ import * as i0 from '@angular/core';
3
+ import { Injectable, inject, ElementRef, Directive, EventEmitter, NgZone, DestroyRef, Input, ContentChild, Output, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
4
+ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
+ import { NgControl } from '@angular/forms';
6
+ import { MatIcon } from '@angular/material/icon';
7
+ import { MatTooltip } from '@angular/material/tooltip';
8
+ import { NgxAbstractIntl, provideNgxIntl, NgxMediaService } from '@hug/ngx-core';
9
+ import { BehaviorSubject, switchMap, first, tap, distinctUntilChanged, shareReplay } from 'rxjs';
10
+
11
+ /**
12
+ * Data for internationalization
13
+ */
14
+ class NgxSearchContainerIntl extends NgxAbstractIntl {
15
+ clearSearch = '';
16
+ openSearch = '';
17
+ exitSearch = '';
18
+ addAttSearchInput = '';
19
+ addAttNgmodel = '';
20
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchContainerIntl, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
21
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchContainerIntl });
22
+ }
23
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchContainerIntl, decorators: [{
24
+ type: Injectable
25
+ }] });
26
+
27
+ /**
28
+ * Provide the component to the application level.
29
+ * @param options - The component's providing options.
30
+ * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).
31
+ * @param options.customIntl - A custom internationalization class to inject.
32
+ */
33
+ const provideNgxSearchContainer = (options) => provideNgxIntl(NgxSearchContainerIntl, options?.translationsPath ?? 'translations/ngx-search-container', options?.customIntl ?? NgxSearchContainerIntl);
34
+
35
+ class NgxSearchInputDirective {
36
+ ngControl = inject(NgControl);
37
+ elementRef = inject(ElementRef);
38
+ constructor() {
39
+ this.focus();
40
+ }
41
+ focus() {
42
+ this.elementRef.nativeElement.focus();
43
+ }
44
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
45
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.6", type: NgxSearchInputDirective, isStandalone: true, selector: "[ngx-search-input]", ngImport: i0 });
46
+ }
47
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchInputDirective, decorators: [{
48
+ type: Directive,
49
+ args: [{
50
+ selector: '[ngx-search-input]',
51
+ standalone: true
52
+ }]
53
+ }], ctorParameters: () => [] });
54
+ class NgxSearchContainerComponent {
55
+ cleared = new EventEmitter();
56
+ mobileSearch;
57
+ intl = inject(NgxSearchContainerIntl, { optional: true });
58
+ activeSearch$ = new BehaviorSubject(false);
59
+ searchInputValue$;
60
+ set searchInput(searchInput) {
61
+ if (!searchInput) {
62
+ throw new Error(this.intl?.addAttSearchInput ?? 'You need to add the attribute ngx-search-input to the NgxSearchContainerComponent');
63
+ }
64
+ if (!searchInput.ngControl) {
65
+ throw new Error(this.intl?.addAttNgmodel ?? 'You need to add the attribute ngModel to the NgxSearchContainerComponent');
66
+ }
67
+ this._searchInput = searchInput;
68
+ }
69
+ set right(value) {
70
+ this._right = value;
71
+ }
72
+ get right() {
73
+ return this._right;
74
+ }
75
+ mediaService = inject(NgxMediaService);
76
+ zone = inject(NgZone);
77
+ destroyRef = inject(DestroyRef);
78
+ _searchInput;
79
+ _right = null;
80
+ _resetWhenInactiveSearch = false;
81
+ constructor() {
82
+ this.activeSearch$.pipe(switchMap(activeSearch => this.zone.onStable.pipe(first(), tap(() => {
83
+ if (!activeSearch && this._resetWhenInactiveSearch) {
84
+ this.reset();
85
+ }
86
+ this._searchInput?.focus();
87
+ this._resetWhenInactiveSearch = true;
88
+ }))), takeUntilDestroyed(this.destroyRef)).subscribe();
89
+ }
90
+ ngAfterContentInit() {
91
+ this.searchInputValue$ = this._searchInput?.ngControl?.valueChanges?.pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: false })) ?? undefined;
92
+ }
93
+ reset() {
94
+ this._searchInput?.ngControl?.reset();
95
+ this.cleared.emit();
96
+ }
97
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
98
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: NgxSearchContainerComponent, isStandalone: true, selector: "ngx-search-container", inputs: { right: "right" }, outputs: { cleared: "cleared" }, queries: [{ propertyName: "mobileSearch", first: true, predicate: ["mobileSearch"], descendants: true }, { propertyName: "searchInput", first: true, predicate: NgxSearchInputDirective, descendants: true }], ngImport: i0, template: "@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n", styles: ["ngx-search-container{flex:1 1 auto;display:flex;padding-left:.5rem}ngx-search-container .ngx-search-container{width:100%}ngx-search-container .ngx-search-container.mobile{justify-self:flex-end}ngx-search-container .ngx-search-container:not(.mobile){min-width:35vw;max-width:800px}ngx-search-container .ngx-search-container{transition:.3s ease-in-out;border-radius:4px;height:40px;display:flex}ngx-search-container .ngx-search-container .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container .icon-clear{cursor:pointer}ngx-search-container .ngx-search-container input{width:100%;background:none;border:none;outline:none;font-size:1.2rem}ngx-search-container .ngx-search-container input:focus{outline:none}ngx-search-container .ngx-search-container-mobile{width:100%;display:flex;justify-content:flex-end;height:40px}ngx-search-container .ngx-search-container-mobile.active{display:flex;align-items:center;position:absolute;top:0;left:0;width:100vw;height:56px;z-index:10}ngx-search-container .ngx-search-container-mobile .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container-mobile .icon-close-search,ngx-search-container .ngx-search-container-mobile .icon-open-search{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
99
+ }
100
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: NgxSearchContainerComponent, decorators: [{
101
+ type: Component,
102
+ args: [{ selector: 'ngx-search-container', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
103
+ AsyncPipe,
104
+ NgTemplateOutlet,
105
+ MatIcon,
106
+ MatTooltip
107
+ ], template: "@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n", styles: ["ngx-search-container{flex:1 1 auto;display:flex;padding-left:.5rem}ngx-search-container .ngx-search-container{width:100%}ngx-search-container .ngx-search-container.mobile{justify-self:flex-end}ngx-search-container .ngx-search-container:not(.mobile){min-width:35vw;max-width:800px}ngx-search-container .ngx-search-container{transition:.3s ease-in-out;border-radius:4px;height:40px;display:flex}ngx-search-container .ngx-search-container .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container .icon-clear{cursor:pointer}ngx-search-container .ngx-search-container input{width:100%;background:none;border:none;outline:none;font-size:1.2rem}ngx-search-container .ngx-search-container input:focus{outline:none}ngx-search-container .ngx-search-container-mobile{width:100%;display:flex;justify-content:flex-end;height:40px}ngx-search-container .ngx-search-container-mobile.active{display:flex;align-items:center;position:absolute;top:0;left:0;width:100vw;height:56px;z-index:10}ngx-search-container .ngx-search-container-mobile .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container-mobile .icon-close-search,ngx-search-container .ngx-search-container-mobile .icon-open-search{cursor:pointer}\n"] }]
108
+ }], ctorParameters: () => [], propDecorators: { cleared: [{
109
+ type: Output
110
+ }], mobileSearch: [{
111
+ type: ContentChild,
112
+ args: ['mobileSearch']
113
+ }], searchInput: [{
114
+ type: ContentChild,
115
+ args: [NgxSearchInputDirective]
116
+ }], right: [{
117
+ type: Input
118
+ }] } });
119
+
120
+ /**
121
+ * Generated bundle index. Do not edit.
122
+ */
123
+
124
+ export { NgxSearchContainerComponent, NgxSearchContainerIntl, NgxSearchInputDirective, provideNgxSearchContainer };
125
+ //# sourceMappingURL=hug-ngx-search-container-m2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hug-ngx-search-container-m2.mjs","sources":["../../../projects/search-container/m2/providers/ngx-search-container-intl.ts","../../../projects/search-container/m2/providers/index.ts","../../../projects/search-container/m2/search-container.component.ts","../../../projects/search-container/m2/search-container.component.html","../../../projects/search-container/m2/hug-ngx-search-container-m2.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { NgxAbstractIntl } from '@hug/ngx-core';\n\n/**\n * Data for internationalization\n */\n@Injectable()\nexport class NgxSearchContainerIntl extends NgxAbstractIntl<NgxSearchContainerIntl> {\n\n public clearSearch = '';\n public openSearch = '';\n public exitSearch = '';\n public addAttSearchInput = '';\n public addAttNgmodel = '';\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { type NgxOptionsIntl, provideNgxIntl } from '@hug/ngx-core';\n\nimport { NgxSearchContainerIntl } from './ngx-search-container-intl';\n\nexport * from './ngx-search-container-intl';\n\n/**\n * Provide the component to the application level.\n * @param options - The component's providing options.\n * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).\n * @param options.customIntl - A custom internationalization class to inject.\n */\nexport const provideNgxSearchContainer = (options?: NgxOptionsIntl<NgxSearchContainerIntl>): EnvironmentProviders =>\n provideNgxIntl(\n NgxSearchContainerIntl,\n options?.translationsPath ?? 'translations/ngx-search-container',\n options?.customIntl ?? NgxSearchContainerIntl\n );\n","import { AsyncPipe, NgTemplateOutlet } from '@angular/common';\nimport { AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, DestroyRef, Directive, ElementRef, EventEmitter, inject, Input, NgZone, Output, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NgControl } from '@angular/forms';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { NgxMediaService } from '@hug/ngx-core';\nimport { BehaviorSubject, distinctUntilChanged, first, Observable, shareReplay, switchMap, tap } from 'rxjs';\n\nimport { NgxSearchContainerIntl } from './providers';\n\n@Directive({\n selector: '[ngx-search-input]',\n standalone: true\n})\nexport class NgxSearchInputDirective {\n public ngControl = inject(NgControl);\n\n protected elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n public constructor() {\n this.focus();\n }\n\n public focus(): void {\n this.elementRef.nativeElement.focus();\n }\n}\n\n@Component({\n selector: 'ngx-search-container',\n templateUrl: './search-container.component.html',\n styleUrls: ['./search-container.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AsyncPipe,\n NgTemplateOutlet,\n MatIcon,\n MatTooltip\n ]\n})\nexport class NgxSearchContainerComponent implements AfterContentInit {\n\n @Output()\n public readonly cleared = new EventEmitter<void>();\n\n @ContentChild('mobileSearch')\n public mobileSearch: TemplateRef<unknown> | undefined;\n\n protected readonly intl = inject(NgxSearchContainerIntl, { optional: true });\n\n protected readonly activeSearch$ = new BehaviorSubject(false);\n\n protected searchInputValue$: Observable<string> | undefined;\n\n @ContentChild(NgxSearchInputDirective)\n public set searchInput(searchInput: NgxSearchInputDirective) {\n if (!searchInput) {\n throw new Error(this.intl?.addAttSearchInput ?? 'You need to add the attribute ngx-search-input to the NgxSearchContainerComponent');\n }\n if (!searchInput.ngControl) {\n throw new Error(this.intl?.addAttNgmodel ?? 'You need to add the attribute ngModel to the NgxSearchContainerComponent');\n }\n this._searchInput = searchInput;\n }\n\n @Input()\n public set right(value: TemplateRef<unknown> | null) {\n this._right = value;\n }\n\n public get right(): TemplateRef<unknown> | null {\n return this._right;\n }\n\n protected readonly mediaService = inject(NgxMediaService);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n private _searchInput: NgxSearchInputDirective | undefined;\n\n private _right: TemplateRef<unknown> | null = null;\n\n private _resetWhenInactiveSearch = false;\n\n public constructor() {\n this.activeSearch$.pipe(\n switchMap(activeSearch => this.zone.onStable.pipe(\n first(),\n tap(() => {\n if (!activeSearch && this._resetWhenInactiveSearch) {\n this.reset();\n }\n this._searchInput?.focus();\n this._resetWhenInactiveSearch = true;\n })\n )),\n takeUntilDestroyed(this.destroyRef)\n ).subscribe();\n }\n\n public ngAfterContentInit(): void {\n this.searchInputValue$ = this._searchInput?.ngControl?.valueChanges?.pipe(\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: false })\n ) ?? undefined;\n }\n\n public reset(): void {\n this._searchInput?.ngControl?.reset();\n this.cleared.emit();\n }\n}\n","@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAGA;;AAEG;AAEG,MAAO,sBAAuB,SAAQ,eAAuC,CAAA;IAExE,WAAW,GAAG,EAAE;IAChB,UAAU,GAAG,EAAE;IACf,UAAU,GAAG,EAAE;IACf,iBAAiB,GAAG,EAA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EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACP,UAAU,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,oBAAA,EAAA,4BAAA,EAAA,oBAAA,EAAA,qBAAA,EAAA,qBAAA,EAAA,yBAAA,EAAA,YAAA,EAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAHV,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAMJ,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAbvC,SAAS;+BACI,sBAAsB,EAAA,aAAA,EAGjB,iBAAiB,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC;wBACL,SAAS;wBACT,gBAAgB;wBAChB,OAAO;wBACP;AACH,qBAAA,EAAA,QAAA,EAAA,21CAAA,EAAA,MAAA,EAAA,CAAA,4rCAAA,CAAA,EAAA;;sBAIA;;sBAGA,YAAY;uBAAC,cAAc;;sBAS3B,YAAY;uBAAC,uBAAuB;;sBAWpC;;;AEnEL;;AAEG;;;;"}
@@ -1,125 +1,8 @@
1
- import { NgTemplateOutlet, AsyncPipe } from '@angular/common';
2
- import * as i0 from '@angular/core';
3
- import { Injectable, inject, ElementRef, Directive, EventEmitter, NgZone, DestroyRef, Input, ContentChild, Output, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
4
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
5
- import { NgControl } from '@angular/forms';
6
- import { MatIcon } from '@angular/material/icon';
7
- import { MatTooltip } from '@angular/material/tooltip';
8
- import { NgxAbstractIntl, provideNgxIntl, NgxMediaService } from '@hug/ngx-core';
9
- import { BehaviorSubject, switchMap, first, tap, distinctUntilChanged, shareReplay } from 'rxjs';
10
-
11
- /**
12
- * Data for internationalization
13
- */
14
- class NgxSearchContainerIntl extends NgxAbstractIntl {
15
- clearSearch = '';
16
- openSearch = '';
17
- exitSearch = '';
18
- addAttSearchInput = '';
19
- addAttNgmodel = '';
20
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchContainerIntl, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
21
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchContainerIntl });
22
- }
23
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchContainerIntl, decorators: [{
24
- type: Injectable
25
- }] });
26
-
27
- /**
28
- * Provide the component to the application level.
29
- * @param options - The component's providing options.
30
- * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).
31
- * @param options.customIntl - A custom internationalization class to inject.
32
- */
33
- const provideNgxSearchContainer = (options) => provideNgxIntl(NgxSearchContainerIntl, options?.translationsPath ?? 'translations/ngx-search-container', options?.customIntl ?? NgxSearchContainerIntl);
34
-
35
- class NgxSearchInputDirective {
36
- ngControl = inject(NgControl);
37
- elementRef = inject(ElementRef);
38
- constructor() {
39
- this.focus();
40
- }
41
- focus() {
42
- this.elementRef.nativeElement.focus();
43
- }
44
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
45
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.1", type: NgxSearchInputDirective, isStandalone: true, selector: "[ngx-search-input]", ngImport: i0 });
46
- }
47
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchInputDirective, decorators: [{
48
- type: Directive,
49
- args: [{
50
- selector: '[ngx-search-input]',
51
- standalone: true
52
- }]
53
- }], ctorParameters: () => [] });
54
- class NgxSearchContainerComponent {
55
- cleared = new EventEmitter();
56
- mobileSearch;
57
- intl = inject(NgxSearchContainerIntl, { optional: true });
58
- activeSearch$ = new BehaviorSubject(false);
59
- searchInputValue$;
60
- set searchInput(searchInput) {
61
- if (!searchInput) {
62
- throw new Error(this.intl?.addAttSearchInput ?? 'You need to add the attribute ngx-search-input to the NgxSearchContainerComponent');
63
- }
64
- if (!searchInput.ngControl) {
65
- throw new Error(this.intl?.addAttNgmodel ?? 'You need to add the attribute ngModel to the NgxSearchContainerComponent');
66
- }
67
- this._searchInput = searchInput;
68
- }
69
- set right(value) {
70
- this._right = value;
71
- }
72
- get right() {
73
- return this._right;
74
- }
75
- mediaService = inject(NgxMediaService);
76
- zone = inject(NgZone);
77
- destroyRef = inject(DestroyRef);
78
- _searchInput;
79
- _right = null;
80
- _resetWhenInactiveSearch = false;
81
- constructor() {
82
- this.activeSearch$.pipe(switchMap(activeSearch => this.zone.onStable.pipe(first(), tap(() => {
83
- if (!activeSearch && this._resetWhenInactiveSearch) {
84
- this.reset();
85
- }
86
- this._searchInput?.focus();
87
- this._resetWhenInactiveSearch = true;
88
- }))), takeUntilDestroyed(this.destroyRef)).subscribe();
89
- }
90
- ngAfterContentInit() {
91
- this.searchInputValue$ = this._searchInput?.ngControl?.valueChanges?.pipe(distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: false })) ?? undefined;
92
- }
93
- reset() {
94
- this._searchInput?.ngControl?.reset();
95
- this.cleared.emit();
96
- }
97
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
98
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.1", type: NgxSearchContainerComponent, isStandalone: true, selector: "ngx-search-container", inputs: { right: "right" }, outputs: { cleared: "cleared" }, queries: [{ propertyName: "mobileSearch", first: true, predicate: ["mobileSearch"], descendants: true }, { propertyName: "searchInput", first: true, predicate: NgxSearchInputDirective, descendants: true }], ngImport: i0, template: "@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n", styles: ["ngx-search-container{flex:1 1 auto;display:flex;padding-left:.5rem}ngx-search-container .ngx-search-container{width:100%}ngx-search-container .ngx-search-container.mobile{justify-self:flex-end}ngx-search-container .ngx-search-container:not(.mobile){min-width:35vw;max-width:800px}ngx-search-container .ngx-search-container{transition:.3s ease-in-out;border-radius:4px;height:40px;display:flex}ngx-search-container .ngx-search-container .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container .icon-clear{cursor:pointer}ngx-search-container .ngx-search-container input{width:100%;background:none;border:none;outline:none;font-size:1.2rem}ngx-search-container .ngx-search-container input:focus{outline:none}ngx-search-container .ngx-search-container-mobile{width:100%;display:flex;justify-content:flex-end;height:40px}ngx-search-container .ngx-search-container-mobile.active{display:flex;align-items:center;position:absolute;top:0;left:0;width:100vw;height:56px;z-index:10}ngx-search-container .ngx-search-container-mobile .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container-mobile .icon-close-search,ngx-search-container .ngx-search-container-mobile .icon-open-search{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
99
- }
100
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.1", ngImport: i0, type: NgxSearchContainerComponent, decorators: [{
101
- type: Component,
102
- args: [{ selector: 'ngx-search-container', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
103
- AsyncPipe,
104
- NgTemplateOutlet,
105
- MatIcon,
106
- MatTooltip
107
- ], template: "@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n", styles: ["ngx-search-container{flex:1 1 auto;display:flex;padding-left:.5rem}ngx-search-container .ngx-search-container{width:100%}ngx-search-container .ngx-search-container.mobile{justify-self:flex-end}ngx-search-container .ngx-search-container:not(.mobile){min-width:35vw;max-width:800px}ngx-search-container .ngx-search-container{transition:.3s ease-in-out;border-radius:4px;height:40px;display:flex}ngx-search-container .ngx-search-container .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container .icon-clear{cursor:pointer}ngx-search-container .ngx-search-container input{width:100%;background:none;border:none;outline:none;font-size:1.2rem}ngx-search-container .ngx-search-container input:focus{outline:none}ngx-search-container .ngx-search-container-mobile{width:100%;display:flex;justify-content:flex-end;height:40px}ngx-search-container .ngx-search-container-mobile.active{display:flex;align-items:center;position:absolute;top:0;left:0;width:100vw;height:56px;z-index:10}ngx-search-container .ngx-search-container-mobile .mat-icon{padding:.5rem}ngx-search-container .ngx-search-container-mobile .icon-close-search,ngx-search-container .ngx-search-container-mobile .icon-open-search{cursor:pointer}\n"] }]
108
- }], ctorParameters: () => [], propDecorators: { cleared: [{
109
- type: Output
110
- }], mobileSearch: [{
111
- type: ContentChild,
112
- args: ['mobileSearch']
113
- }], searchInput: [{
114
- type: ContentChild,
115
- args: [NgxSearchInputDirective]
116
- }], right: [{
117
- type: Input
118
- }] } });
1
+ const m3 = 'M3';
119
2
 
120
3
  /**
121
4
  * Generated bundle index. Do not edit.
122
5
  */
123
6
 
124
- export { NgxSearchContainerComponent, NgxSearchContainerIntl, NgxSearchInputDirective, provideNgxSearchContainer };
7
+ export { m3 };
125
8
  //# sourceMappingURL=hug-ngx-search-container.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"hug-ngx-search-container.mjs","sources":["../../../projects/search-container/src/providers/ngx-search-container-intl.ts","../../../projects/search-container/src/providers/index.ts","../../../projects/search-container/src/search-container.component.ts","../../../projects/search-container/src/search-container.component.html","../../../projects/search-container/src/hug-ngx-search-container.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { NgxAbstractIntl } from '@hug/ngx-core';\n\n/**\n * Data for internationalization\n */\n@Injectable()\nexport class NgxSearchContainerIntl extends NgxAbstractIntl<NgxSearchContainerIntl> {\n\n public clearSearch = '';\n public openSearch = '';\n public exitSearch = '';\n public addAttSearchInput = '';\n public addAttNgmodel = '';\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport { type NgxOptionsIntl, provideNgxIntl } from '@hug/ngx-core';\n\nimport { NgxSearchContainerIntl } from './ngx-search-container-intl';\n\nexport * from './ngx-search-container-intl';\n\n/**\n * Provide the component to the application level.\n * @param options - The component's providing options.\n * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).\n * @param options.customIntl - A custom internationalization class to inject.\n */\nexport const provideNgxSearchContainer = (options?: NgxOptionsIntl<NgxSearchContainerIntl>): EnvironmentProviders =>\n provideNgxIntl(\n NgxSearchContainerIntl,\n options?.translationsPath ?? 'translations/ngx-search-container',\n options?.customIntl ?? NgxSearchContainerIntl\n );\n","import { AsyncPipe, NgTemplateOutlet } from '@angular/common';\nimport { AfterContentInit, ChangeDetectionStrategy, Component, ContentChild, DestroyRef, Directive, ElementRef, EventEmitter, inject, Input, NgZone, Output, TemplateRef, ViewEncapsulation } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { NgControl } from '@angular/forms';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { NgxMediaService } from '@hug/ngx-core';\nimport { BehaviorSubject, distinctUntilChanged, first, Observable, shareReplay, switchMap, tap } from 'rxjs';\n\nimport { NgxSearchContainerIntl } from './providers';\n\n@Directive({\n selector: '[ngx-search-input]',\n standalone: true\n})\nexport class NgxSearchInputDirective {\n public ngControl = inject(NgControl);\n\n protected elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n\n public constructor() {\n this.focus();\n }\n\n public focus(): void {\n this.elementRef.nativeElement.focus();\n }\n}\n\n@Component({\n selector: 'ngx-search-container',\n templateUrl: './search-container.component.html',\n styleUrls: ['./search-container.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n AsyncPipe,\n NgTemplateOutlet,\n MatIcon,\n MatTooltip\n ]\n})\nexport class NgxSearchContainerComponent implements AfterContentInit {\n\n @Output()\n public readonly cleared = new EventEmitter<void>();\n\n @ContentChild('mobileSearch')\n public mobileSearch: TemplateRef<unknown> | undefined;\n\n protected readonly intl = inject(NgxSearchContainerIntl, { optional: true });\n\n protected readonly activeSearch$ = new BehaviorSubject(false);\n\n protected searchInputValue$: Observable<string> | undefined;\n\n @ContentChild(NgxSearchInputDirective)\n public set searchInput(searchInput: NgxSearchInputDirective) {\n if (!searchInput) {\n throw new Error(this.intl?.addAttSearchInput ?? 'You need to add the attribute ngx-search-input to the NgxSearchContainerComponent');\n }\n if (!searchInput.ngControl) {\n throw new Error(this.intl?.addAttNgmodel ?? 'You need to add the attribute ngModel to the NgxSearchContainerComponent');\n }\n this._searchInput = searchInput;\n }\n\n @Input()\n public set right(value: TemplateRef<unknown> | null) {\n this._right = value;\n }\n\n public get right(): TemplateRef<unknown> | null {\n return this._right;\n }\n\n protected readonly mediaService = inject(NgxMediaService);\n private readonly zone = inject(NgZone);\n private readonly destroyRef = inject(DestroyRef);\n\n private _searchInput: NgxSearchInputDirective | undefined;\n\n private _right: TemplateRef<unknown> | null = null;\n\n private _resetWhenInactiveSearch = false;\n\n public constructor() {\n this.activeSearch$.pipe(\n switchMap(activeSearch => this.zone.onStable.pipe(\n first(),\n tap(() => {\n if (!activeSearch && this._resetWhenInactiveSearch) {\n this.reset();\n }\n this._searchInput?.focus();\n this._resetWhenInactiveSearch = true;\n })\n )),\n takeUntilDestroyed(this.destroyRef)\n ).subscribe();\n }\n\n public ngAfterContentInit(): void {\n this.searchInputValue$ = this._searchInput?.ngControl?.valueChanges?.pipe(\n distinctUntilChanged(),\n shareReplay({ bufferSize: 1, refCount: false })\n ) ?? undefined;\n }\n\n public reset(): void {\n this._searchInput?.ngControl?.reset();\n this.cleared.emit();\n }\n}\n","@if (mediaService.isHandset$ | async) {\n <div class=\"ngx-search-container-mobile mobile\" [class.active]=\"activeSearch$ | async\" #mobileSearch>\n @if (activeSearch$ | async) {\n <mat-icon\n class=\"icon-close-search\"\n [matTooltip]=\"intl?.exitSearch ?? 'Exit the search'\"\n (click)=\"activeSearch$.next(false)\">\n arrow_back\n </mat-icon>\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n } @else {\n <mat-icon\n class=\"icon-open-search\"\n [matTooltip]=\"intl?.openSearch ?? 'Open the search'\"\n (click)=\"activeSearch$.next(true)\">\n search\n </mat-icon>\n }\n </div>\n} @else {\n <ng-container *ngTemplateOutlet=\"searchContainerTpl\"></ng-container>\n}\n\n<ng-template #searchContainerTpl>\n <div class=\"ngx-search-container\">\n <mat-icon>search</mat-icon>\n <ng-content></ng-content>\n @if (searchInputValue$ | async) {\n <mat-icon class=\"icon-clear\" [matTooltip]=\"intl?.clearSearch ?? 'Clear the search'\" (click)=\"reset()\">\n close\n </mat-icon>\n }\n <ng-container *ngTemplateOutlet=\"right\"></ng-container>\n </div>\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAGA;;AAEG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AA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EAChB,OAAO,EAAA,QAAA,EAAA,UAAA,EAAA,MAAA,EAAA,CAAA,OAAA,EAAA,QAAA,EAAA,SAAA,EAAA,SAAA,EAAA,UAAA,CAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EACP,UAAU,EAAA,QAAA,EAAA,cAAA,EAAA,MAAA,EAAA,CAAA,oBAAA,EAAA,4BAAA,EAAA,oBAAA,EAAA,qBAAA,EAAA,qBAAA,EAAA,yBAAA,EAAA,YAAA,EAAA,iBAAA,CAAA,EAAA,QAAA,EAAA,CAAA,YAAA,CAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAHV,SAAS,EAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;2FAMJ,2BAA2B,EAAA,UAAA,EAAA,CAAA;kBAbvC,SAAS;+BACI,sBAAsB,EAAA,aAAA,EAGjB,iBAAiB,CAAC,IAAI,mBACpB,uBAAuB,CAAC,MAAM,EAAA,OAAA,EACtC;wBACL,SAAS;wBACT,gBAAgB;wBAChB,OAAO;wBACP;AACH,qBAAA,EAAA,QAAA,EAAA,21CAAA,EAAA,MAAA,EAAA,CAAA,4rCAAA,CAAA,EAAA;;sBAIA;;sBAGA,YAAY;uBAAC,cAAc;;sBAS3B,YAAY;uBAAC,uBAAuB;;sBAWpC;;;AEnEL;;AAEG;;;;"}
1
+ {"version":3,"file":"hug-ngx-search-container.mjs","sources":["../../../projects/search-container/src/index.ts","../../../projects/search-container/src/hug-ngx-search-container.ts"],"sourcesContent":["export const m3 = 'M3';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,MAAM,EAAE,GAAG;;ACAlB;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hug/ngx-search-container",
3
- "version": "21.0.2",
3
+ "version": "22.0.0-alpha.2",
4
4
  "description": "HUG Angular - search-container component",
5
5
  "homepage": "https://github.com/dsi-hug/ngx-components",
6
6
  "license": "GPL-3.0-only",
@@ -21,16 +21,20 @@
21
21
  ],
22
22
  "sideEffects": false,
23
23
  "exports": {
24
- ".": {
25
- "sass": "./_search-container-theme.scss",
26
- "types": "./types/hug-ngx-search-container.d.ts",
27
- "default": "./fesm2022/hug-ngx-search-container.mjs"
24
+ "./m2": {
25
+ "sass": "./m2/_search-container-theme.scss",
26
+ "types": "./types/hug-ngx-search-container-m2.d.ts",
27
+ "default": "./fesm2022/hug-ngx-search-container-m2.mjs"
28
28
  },
29
- "./translations/*": {
29
+ "./m2/translations/*": {
30
30
  "default": "./**/*.json"
31
31
  },
32
32
  "./package.json": {
33
33
  "default": "./package.json"
34
+ },
35
+ ".": {
36
+ "types": "./types/hug-ngx-search-container.d.ts",
37
+ "default": "./fesm2022/hug-ngx-search-container.mjs"
34
38
  }
35
39
  },
36
40
  "peerDependencies": {
@@ -38,7 +42,7 @@
38
42
  "@angular/core": ">=21 <22",
39
43
  "@angular/forms": ">=21 <22",
40
44
  "@angular/material": ">=21 <22",
41
- "@hug/ngx-core": "^21.2.0",
45
+ "@hug/ngx-core": "^22.0.0-alpha.2",
42
46
  "rxjs": "^7.8.2",
43
47
  "zone.js": "^0.16.0"
44
48
  },
@@ -46,7 +50,8 @@
46
50
  "tslib": "^2.8.1"
47
51
  },
48
52
  "publishConfig": {
49
- "access": "public"
53
+ "access": "public",
54
+ "tag": "alpha"
50
55
  },
51
56
  "module": "fesm2022/hug-ngx-search-container.mjs",
52
57
  "typings": "types/hug-ngx-search-container.d.ts"
@@ -0,0 +1,58 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EnvironmentProviders, AfterContentInit, EventEmitter, TemplateRef, ElementRef } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
4
+ import { NgxAbstractIntl, NgxOptionsIntl, NgxMediaService } from '@hug/ngx-core';
5
+ import { BehaviorSubject, Observable } from 'rxjs';
6
+
7
+ /**
8
+ * Data for internationalization
9
+ */
10
+ declare class NgxSearchContainerIntl extends NgxAbstractIntl<NgxSearchContainerIntl> {
11
+ clearSearch: string;
12
+ openSearch: string;
13
+ exitSearch: string;
14
+ addAttSearchInput: string;
15
+ addAttNgmodel: string;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchContainerIntl, never>;
17
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxSearchContainerIntl>;
18
+ }
19
+
20
+ /**
21
+ * Provide the component to the application level.
22
+ * @param options - The component's providing options.
23
+ * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).
24
+ * @param options.customIntl - A custom internationalization class to inject.
25
+ */
26
+ declare const provideNgxSearchContainer: (options?: NgxOptionsIntl<NgxSearchContainerIntl>) => EnvironmentProviders;
27
+
28
+ declare class NgxSearchInputDirective {
29
+ ngControl: NgControl;
30
+ protected elementRef: ElementRef<HTMLElement>;
31
+ constructor();
32
+ focus(): void;
33
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchInputDirective, never>;
34
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxSearchInputDirective, "[ngx-search-input]", never, {}, {}, never, never, true, never>;
35
+ }
36
+ declare class NgxSearchContainerComponent implements AfterContentInit {
37
+ readonly cleared: EventEmitter<void>;
38
+ mobileSearch: TemplateRef<unknown> | undefined;
39
+ protected readonly intl: NgxSearchContainerIntl | null;
40
+ protected readonly activeSearch$: BehaviorSubject<boolean>;
41
+ protected searchInputValue$: Observable<string> | undefined;
42
+ set searchInput(searchInput: NgxSearchInputDirective);
43
+ set right(value: TemplateRef<unknown> | null);
44
+ get right(): TemplateRef<unknown> | null;
45
+ protected readonly mediaService: NgxMediaService;
46
+ private readonly zone;
47
+ private readonly destroyRef;
48
+ private _searchInput;
49
+ private _right;
50
+ private _resetWhenInactiveSearch;
51
+ constructor();
52
+ ngAfterContentInit(): void;
53
+ reset(): void;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchContainerComponent, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxSearchContainerComponent, "ngx-search-container", never, { "right": { "alias": "right"; "required": false; }; }, { "cleared": "cleared"; }, ["mobileSearch", "searchInput"], ["*"], true, never>;
56
+ }
57
+
58
+ export { NgxSearchContainerComponent, NgxSearchContainerIntl, NgxSearchInputDirective, provideNgxSearchContainer };
@@ -1,58 +1,3 @@
1
- import * as i0 from '@angular/core';
2
- import { EnvironmentProviders, ElementRef, AfterContentInit, EventEmitter, TemplateRef } from '@angular/core';
3
- import { NgControl } from '@angular/forms';
4
- import { NgxAbstractIntl, NgxOptionsIntl, NgxMediaService } from '@hug/ngx-core';
5
- import { BehaviorSubject, Observable } from 'rxjs';
1
+ declare const m3 = "M3";
6
2
 
7
- /**
8
- * Data for internationalization
9
- */
10
- declare class NgxSearchContainerIntl extends NgxAbstractIntl<NgxSearchContainerIntl> {
11
- clearSearch: string;
12
- openSearch: string;
13
- exitSearch: string;
14
- addAttSearchInput: string;
15
- addAttNgmodel: string;
16
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchContainerIntl, never>;
17
- static ɵprov: i0.ɵɵInjectableDeclaration<NgxSearchContainerIntl>;
18
- }
19
-
20
- /**
21
- * Provide the component to the application level.
22
- * @param options - The component's providing options.
23
- * @param options.translationsPath - The path to the translations files (default: `translations/ngx-search-container`).
24
- * @param options.customIntl - A custom internationalization class to inject.
25
- */
26
- declare const provideNgxSearchContainer: (options?: NgxOptionsIntl<NgxSearchContainerIntl>) => EnvironmentProviders;
27
-
28
- declare class NgxSearchInputDirective {
29
- ngControl: NgControl;
30
- protected elementRef: ElementRef<HTMLElement>;
31
- constructor();
32
- focus(): void;
33
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchInputDirective, never>;
34
- static ɵdir: i0.ɵɵDirectiveDeclaration<NgxSearchInputDirective, "[ngx-search-input]", never, {}, {}, never, never, true, never>;
35
- }
36
- declare class NgxSearchContainerComponent implements AfterContentInit {
37
- readonly cleared: EventEmitter<void>;
38
- mobileSearch: TemplateRef<unknown> | undefined;
39
- protected readonly intl: NgxSearchContainerIntl | null;
40
- protected readonly activeSearch$: BehaviorSubject<boolean>;
41
- protected searchInputValue$: Observable<string> | undefined;
42
- set searchInput(searchInput: NgxSearchInputDirective);
43
- set right(value: TemplateRef<unknown> | null);
44
- get right(): TemplateRef<unknown> | null;
45
- protected readonly mediaService: NgxMediaService;
46
- private readonly zone;
47
- private readonly destroyRef;
48
- private _searchInput;
49
- private _right;
50
- private _resetWhenInactiveSearch;
51
- constructor();
52
- ngAfterContentInit(): void;
53
- reset(): void;
54
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxSearchContainerComponent, never>;
55
- static ɵcmp: i0.ɵɵComponentDeclaration<NgxSearchContainerComponent, "ngx-search-container", never, { "right": { "alias": "right"; "required": false; }; }, { "cleared": "cleared"; }, ["mobileSearch", "searchInput"], ["*"], true, never>;
56
- }
57
-
58
- export { NgxSearchContainerComponent, NgxSearchContainerIntl, NgxSearchInputDirective, provideNgxSearchContainer };
3
+ export { m3 };
File without changes
File without changes
File without changes