@feature23/ngx-mat-split-button 0.1.1 → 0.1.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.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVhdHVyZTIzLW5neC1tYXQtc3BsaXQtYnV0dG9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdC1zcGxpdC1idXR0b24vc3JjL2ZlYXR1cmUyMy1uZ3gtbWF0LXNwbGl0LWJ1dHRvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsY0FBYyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL3B1YmxpYy1hcGknO1xuIl19
@@ -0,0 +1,126 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, contentChild, inject, input, output } from '@angular/core';
3
+ import { MatButton } from '@angular/material/button';
4
+ import { MatIcon } from '@angular/material/icon';
5
+ import { MatMenuModule } from '@angular/material/menu';
6
+ import { NgxMatSplitButtonService } from './ngx-mat-split-button.service';
7
+ import { NgxMatSplitPrimaryAction } from './ngx-mat-split-primary-action.directive';
8
+ import * as i0 from "@angular/core";
9
+ import * as i1 from "@angular/common";
10
+ import * as i2 from "@angular/material/menu";
11
+ export class NgxMatSplitButton {
12
+ color = input();
13
+ buttonStyle = input('basic');
14
+ primaryClick = output();
15
+ primaryAction = contentChild.required(NgxMatSplitPrimaryAction);
16
+ constructor() {
17
+ const service = inject(NgxMatSplitButtonService);
18
+ service.initialize();
19
+ }
20
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
21
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: NgxMatSplitButton, isStandalone: true, selector: "ngx-mat-split-button", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, buttonStyle: { classPropertyName: "buttonStyle", publicName: "buttonStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { primaryClick: "primaryClick" }, queries: [{ propertyName: "primaryAction", first: true, predicate: NgxMatSplitPrimaryAction, descendants: true, isSignal: true }], ngImport: i0, template: `
22
+ @if (buttonStyle() === 'basic') {
23
+ <button mat-button [color]="color()" (click)="primaryClick.emit($event)"
24
+ class="ngx-mat-split-button-primary ngx-mat-split-button-basic">
25
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
26
+ </button>
27
+ <button mat-button [color]="color()" [matMenuTriggerFor]="menu"
28
+ class="ngx-mat-split-button-trigger"
29
+ aria-label="Toggle dropdown">
30
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
31
+ </button>
32
+ } @else if (buttonStyle() === 'raised') {
33
+ <div class="ngx-mat-split-button-raised-wrapper">
34
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
35
+ class="ngx-mat-split-button-primary ngx-mat-split-button-raised">
36
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
37
+ </button>
38
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
39
+ class="ngx-mat-split-button-trigger"
40
+ aria-label="Toggle dropdown">
41
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
42
+ </button>
43
+ </div>
44
+ } @else if (buttonStyle() === 'stroked') {
45
+ <button mat-stroked-button [color]="color()" (click)="primaryClick.emit($event)"
46
+ class="ngx-mat-split-button-primary ngx-mat-split-button-stroked">
47
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
48
+ </button>
49
+ <button mat-stroked-button [color]="color()" [matMenuTriggerFor]="menu"
50
+ class="ngx-mat-split-button-trigger"
51
+ aria-label="Toggle dropdown">
52
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
53
+ </button>
54
+ } @else if (buttonStyle() === 'flat') {
55
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
56
+ class="ngx-mat-split-button-primary ngx-mat-split-button-flat">
57
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
58
+ </button>
59
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
60
+ class="ngx-mat-split-button-trigger"
61
+ aria-label="Toggle dropdown">
62
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
63
+ </button>
64
+ }
65
+ <mat-menu #menu="matMenu" xPosition="before">
66
+ <ng-content />
67
+ </mat-menu>
68
+ `, isInline: true, styles: [".ngx-mat-split-button-primary{border-top-right-radius:0;border-bottom-right-radius:0}.ngx-mat-split-button-trigger{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;min-width:3rem}.ngx-mat-split-button-trigger mat-icon{--mat-text-button-icon-spacing: 0;--mat-filled-button-icon-spacing: 0;--mat-protected-button-icon-spacing: 0;--mat-outlined-button-icon-spacing: 0}.ngx-mat-split-button-raised-wrapper{display:inline-block;border-radius:var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));box-shadow:var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1))}.ngx-mat-split-button-flat mat-icon svg{fill:var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }] });
69
+ }
70
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButton, decorators: [{
71
+ type: Component,
72
+ args: [{ selector: 'ngx-mat-split-button', standalone: true, imports: [
73
+ CommonModule,
74
+ MatButton,
75
+ MatIcon,
76
+ MatMenuModule,
77
+ ], template: `
78
+ @if (buttonStyle() === 'basic') {
79
+ <button mat-button [color]="color()" (click)="primaryClick.emit($event)"
80
+ class="ngx-mat-split-button-primary ngx-mat-split-button-basic">
81
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
82
+ </button>
83
+ <button mat-button [color]="color()" [matMenuTriggerFor]="menu"
84
+ class="ngx-mat-split-button-trigger"
85
+ aria-label="Toggle dropdown">
86
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
87
+ </button>
88
+ } @else if (buttonStyle() === 'raised') {
89
+ <div class="ngx-mat-split-button-raised-wrapper">
90
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
91
+ class="ngx-mat-split-button-primary ngx-mat-split-button-raised">
92
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
93
+ </button>
94
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
95
+ class="ngx-mat-split-button-trigger"
96
+ aria-label="Toggle dropdown">
97
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
98
+ </button>
99
+ </div>
100
+ } @else if (buttonStyle() === 'stroked') {
101
+ <button mat-stroked-button [color]="color()" (click)="primaryClick.emit($event)"
102
+ class="ngx-mat-split-button-primary ngx-mat-split-button-stroked">
103
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
104
+ </button>
105
+ <button mat-stroked-button [color]="color()" [matMenuTriggerFor]="menu"
106
+ class="ngx-mat-split-button-trigger"
107
+ aria-label="Toggle dropdown">
108
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
109
+ </button>
110
+ } @else if (buttonStyle() === 'flat') {
111
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
112
+ class="ngx-mat-split-button-primary ngx-mat-split-button-flat">
113
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
114
+ </button>
115
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
116
+ class="ngx-mat-split-button-trigger"
117
+ aria-label="Toggle dropdown">
118
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
119
+ </button>
120
+ }
121
+ <mat-menu #menu="matMenu" xPosition="before">
122
+ <ng-content />
123
+ </mat-menu>
124
+ `, styles: [".ngx-mat-split-button-primary{border-top-right-radius:0;border-bottom-right-radius:0}.ngx-mat-split-button-trigger{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;min-width:3rem}.ngx-mat-split-button-trigger mat-icon{--mat-text-button-icon-spacing: 0;--mat-filled-button-icon-spacing: 0;--mat-protected-button-icon-spacing: 0;--mat-outlined-button-icon-spacing: 0}.ngx-mat-split-button-raised-wrapper{display:inline-block;border-radius:var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));box-shadow:var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1))}.ngx-mat-split-button-flat mat-icon svg{fill:var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary))}\n"] }]
125
+ }], ctorParameters: () => [] });
126
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hdC1zcGxpdC1idXR0b24uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmd4LW1hdC1zcGxpdC1idXR0b24vc3JjL2xpYi9uZ3gtbWF0LXNwbGl0LWJ1dHRvbi5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQy9DLE9BQU8sRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQy9FLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNyRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDakQsT0FBTyxFQUFFLGFBQWEsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBQ3ZELE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQzFFLE9BQU8sRUFBRSx3QkFBd0IsRUFBRSxNQUFNLDBDQUEwQyxDQUFDOzs7O0FBMEZwRixNQUFNLE9BQU8saUJBQWlCO0lBQ2pCLEtBQUssR0FBRyxLQUFLLEVBQVUsQ0FBQztJQUN4QixXQUFXLEdBQUcsS0FBSyxDQUEwQyxPQUFPLENBQUMsQ0FBQztJQUV0RSxZQUFZLE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gIGZpbGw6IHZhcigtLW1kYy1maWxsZWQtYnV0dG9uLWxhYmVsLXRleHQtY29sb3IsIHZhcigtLW1hdC1hcHAtb24tcHJpbWFyeSkpO1xuICAgICAgICB9XG4gICAgfVxuICAgIGBcbn0pXG5leHBvcnQgY2xhc3MgTmd4TWF0U3BsaXRCdXR0b24ge1xuICAgIHJlYWRvbmx5IGNvbG9yID0gaW5wdXQ8c3RyaW5nPigpO1xuICAgIHJlYWRvbmx5IGJ1dHRvblN0eWxlID0gaW5wdXQ8J2Jhc2ljJyB8ICdyYWlzZWQnIHwgJ3N0cm9rZWQnIHwgJ2ZsYXQnPignYmFzaWMnKTtcblxuICAgIHJlYWRvbmx5IHByaW1hcnlDbGljayA9IG91dHB1dDxNb3VzZUV2ZW50PigpO1xuXG4gICAgcmVhZG9ubHkgcHJpbWFyeUFjdGlvbiA9IGNvbnRlbnRDaGlsZC5yZXF1aXJlZChOZ3hNYXRTcGxpdFByaW1hcnlBY3Rpb24pO1xuXG4gICAgY29uc3RydWN0b3IoKSB7XG4gICAgICAgIGNvbnN0IHNlcnZpY2UgPSBpbmplY3QoTmd4TWF0U3BsaXRCdXR0b25TZXJ2aWNlKTtcbiAgICAgICAgc2VydmljZS5pbml0aWFsaXplKCk7XG4gICAgfVxufVxuIl19
@@ -0,0 +1,26 @@
1
+ import { inject, Injectable } from '@angular/core';
2
+ import { MatIconRegistry } from '@angular/material/icon';
3
+ import { DomSanitizer } from '@angular/platform-browser';
4
+ import * as i0 from "@angular/core";
5
+ const ARROW_DOWN_ICON = `
6
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M7 10l5 5 5-5z"/></svg>
7
+ `;
8
+ export class NgxMatSplitButtonService {
9
+ constructor() {
10
+ const iconRegistry = inject(MatIconRegistry);
11
+ const sanitizer = inject(DomSanitizer);
12
+ iconRegistry.addSvgIconLiteral('ngx-mat-split-arrow-down-icon', sanitizer.bypassSecurityTrustHtml(ARROW_DOWN_ICON));
13
+ }
14
+ initialize() {
15
+ // noop, ensure service is injected and constructor run
16
+ }
17
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, providedIn: 'root' });
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, decorators: [{
21
+ type: Injectable,
22
+ args: [{
23
+ providedIn: 'root'
24
+ }]
25
+ }], ctorParameters: () => [] });
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hdC1zcGxpdC1idXR0b24uc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL25neC1tYXQtc3BsaXQtYnV0dG9uL3NyYy9saWIvbmd4LW1hdC1zcGxpdC1idXR0b24uc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLGVBQWUsQ0FBQztBQUNuRCxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sd0JBQXdCLENBQUM7QUFDekQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDOztBQUV6RCxNQUFNLGVBQWUsR0FBRzs7Q0FFdkIsQ0FBQztBQUtGLE1BQU0sT0FBTyx3QkFBd0I7SUFFakM7UUFDSSxNQUFNLFlBQVksR0FBRyxNQUFNLENBQUMsZUFBZSxDQUFDLENBQUM7UUFDN0MsTUFBTSxTQUFTLEdBQUcsTUFBTSxDQUFDLFlBQ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7XG4gICAgICAgIGNvbnN0IHNhbml0aXplciA9IGluamVjdChEb21TYW5pdGl6ZXIpO1xuICAgICAgICBpY29uUmVnaXN0cnkuYWRkU3ZnSWNvbkxpdGVyYWwoJ25neC1tYXQtc3BsaXQtYXJyb3ctZG93bi1pY29uJywgc2FuaXRpemVyLmJ5cGFzc1NlY3VyaXR5VHJ1c3RIdG1sKEFSUk9XX0RPV05fSUNPTikpO1xuICAgIH1cblxuICAgIGluaXRpYWxpemUoKSB7XG4gICAgICAgIC8vIG5vb3AsIGVuc3VyZSBzZXJ2aWNlIGlzIGluamVjdGVkIGFuZCBjb25zdHJ1Y3RvciBydW5cbiAgICB9XG59XG4iXX0=
@@ -0,0 +1,18 @@
1
+ import { Directive } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export class NgxMatSplitPrimaryAction {
4
+ templateRef;
5
+ constructor(templateRef) {
6
+ this.templateRef = templateRef;
7
+ }
8
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitPrimaryAction, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
9
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.12", type: NgxMatSplitPrimaryAction, isStandalone: true, selector: "[ngx-mat-split-primary-action]", ngImport: i0 });
10
+ }
11
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitPrimaryAction, decorators: [{
12
+ type: Directive,
13
+ args: [{
14
+ selector: '[ngx-mat-split-primary-action]',
15
+ standalone: true,
16
+ }]
17
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LW1hdC1zcGxpdC1wcmltYXJ5LWFjdGlvbi5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9uZ3gtbWF0LXNwbGl0LWJ1dHRvbi9zcmMvbGliL25neC1tYXQtc3BsaXQtcHJpbWFyeS1hY3Rpb24uZGlyZWN0aXZlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQWUsTUFBTSxlQUFlLENBQUM7O0FBTXZELE1BQU0sT0FBTyx3QkFBd0I7SUFDZDtJQUFuQixZQUFtQixXQUFpQztRQUFqQyxnQkFBVyxHQUFYLFdBQVcsQ0FBc0I7SUFDcEQsQ0FBQzt3R0FGUSx3QkFBd0I7NEZBQXhCLHdCQUF3Qjs7NEZBQXhCLHdCQUF3QjtrQkFKcEMsU0FBUzttQkFBQztvQkFDUCxRQUFRLEVBQUUsZ0NBQWdDO29CQUMxQyxVQUFVLEVBQUUsSUFBSTtpQkFDbkIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUsIFRlbXBsYXRlUmVmIH0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5cbkBEaXJlY3RpdmUoe1xuICAgIHNlbGVjdG9yOiAnW25neC1tYXQtc3BsaXQtcHJpbWFyeS1hY3Rpb25dJyxcbiAgICBzdGFuZGFsb25lOiB0cnVlLFxufSlcbmV4cG9ydCBjbGFzcyBOZ3hNYXRTcGxpdFByaW1hcnlBY3Rpb24ge1xuICAgIGNvbnN0cnVjdG9yKHB1YmxpYyB0ZW1wbGF0ZVJlZjogVGVtcGxhdGVSZWY8dW5rbm93bj4pIHtcbiAgICB9XG4gfVxuIl19
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Public API Surface of ngx-mat-split-button
3
+ */
4
+ export * from './lib/ngx-mat-split-button.component';
5
+ export * from './lib/ngx-mat-split-primary-action.directive';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25neC1tYXQtc3BsaXQtYnV0dG9uL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxzQ0FBc0MsQ0FBQztBQUNyRCxjQUFjLDhDQUE4QyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBuZ3gtbWF0LXNwbGl0LWJ1dHRvblxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL25neC1tYXQtc3BsaXQtYnV0dG9uLmNvbXBvbmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9uZ3gtbWF0LXNwbGl0LXByaW1hcnktYWN0aW9uLmRpcmVjdGl2ZSc7XG4iXX0=
@@ -0,0 +1,174 @@
1
+ import * as i1 from '@angular/common';
2
+ import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, Injectable, Directive, input, output, contentChild, Component } from '@angular/core';
5
+ import { MatButton } from '@angular/material/button';
6
+ import { MatIconRegistry, MatIcon } from '@angular/material/icon';
7
+ import * as i2 from '@angular/material/menu';
8
+ import { MatMenuModule } from '@angular/material/menu';
9
+ import { DomSanitizer } from '@angular/platform-browser';
10
+
11
+ const ARROW_DOWN_ICON = `
12
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M7 10l5 5 5-5z"/></svg>
13
+ `;
14
+ class NgxMatSplitButtonService {
15
+ constructor() {
16
+ const iconRegistry = inject(MatIconRegistry);
17
+ const sanitizer = inject(DomSanitizer);
18
+ iconRegistry.addSvgIconLiteral('ngx-mat-split-arrow-down-icon', sanitizer.bypassSecurityTrustHtml(ARROW_DOWN_ICON));
19
+ }
20
+ initialize() {
21
+ // noop, ensure service is injected and constructor run
22
+ }
23
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
24
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, providedIn: 'root' });
25
+ }
26
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButtonService, decorators: [{
27
+ type: Injectable,
28
+ args: [{
29
+ providedIn: 'root'
30
+ }]
31
+ }], ctorParameters: () => [] });
32
+
33
+ class NgxMatSplitPrimaryAction {
34
+ templateRef;
35
+ constructor(templateRef) {
36
+ this.templateRef = templateRef;
37
+ }
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitPrimaryAction, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
39
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.12", type: NgxMatSplitPrimaryAction, isStandalone: true, selector: "[ngx-mat-split-primary-action]", ngImport: i0 });
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitPrimaryAction, decorators: [{
42
+ type: Directive,
43
+ args: [{
44
+ selector: '[ngx-mat-split-primary-action]',
45
+ standalone: true,
46
+ }]
47
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
48
+
49
+ class NgxMatSplitButton {
50
+ color = input();
51
+ buttonStyle = input('basic');
52
+ primaryClick = output();
53
+ primaryAction = contentChild.required(NgxMatSplitPrimaryAction);
54
+ constructor() {
55
+ const service = inject(NgxMatSplitButtonService);
56
+ service.initialize();
57
+ }
58
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
59
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.12", type: NgxMatSplitButton, isStandalone: true, selector: "ngx-mat-split-button", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, buttonStyle: { classPropertyName: "buttonStyle", publicName: "buttonStyle", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { primaryClick: "primaryClick" }, queries: [{ propertyName: "primaryAction", first: true, predicate: NgxMatSplitPrimaryAction, descendants: true, isSignal: true }], ngImport: i0, template: `
60
+ @if (buttonStyle() === 'basic') {
61
+ <button mat-button [color]="color()" (click)="primaryClick.emit($event)"
62
+ class="ngx-mat-split-button-primary ngx-mat-split-button-basic">
63
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
64
+ </button>
65
+ <button mat-button [color]="color()" [matMenuTriggerFor]="menu"
66
+ class="ngx-mat-split-button-trigger"
67
+ aria-label="Toggle dropdown">
68
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
69
+ </button>
70
+ } @else if (buttonStyle() === 'raised') {
71
+ <div class="ngx-mat-split-button-raised-wrapper">
72
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
73
+ class="ngx-mat-split-button-primary ngx-mat-split-button-raised">
74
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
75
+ </button>
76
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
77
+ class="ngx-mat-split-button-trigger"
78
+ aria-label="Toggle dropdown">
79
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
80
+ </button>
81
+ </div>
82
+ } @else if (buttonStyle() === 'stroked') {
83
+ <button mat-stroked-button [color]="color()" (click)="primaryClick.emit($event)"
84
+ class="ngx-mat-split-button-primary ngx-mat-split-button-stroked">
85
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
86
+ </button>
87
+ <button mat-stroked-button [color]="color()" [matMenuTriggerFor]="menu"
88
+ class="ngx-mat-split-button-trigger"
89
+ aria-label="Toggle dropdown">
90
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
91
+ </button>
92
+ } @else if (buttonStyle() === 'flat') {
93
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
94
+ class="ngx-mat-split-button-primary ngx-mat-split-button-flat">
95
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
96
+ </button>
97
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
98
+ class="ngx-mat-split-button-trigger"
99
+ aria-label="Toggle dropdown">
100
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
101
+ </button>
102
+ }
103
+ <mat-menu #menu="matMenu" xPosition="before">
104
+ <ng-content />
105
+ </mat-menu>
106
+ `, isInline: true, styles: [".ngx-mat-split-button-primary{border-top-right-radius:0;border-bottom-right-radius:0}.ngx-mat-split-button-trigger{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;min-width:3rem}.ngx-mat-split-button-trigger mat-icon{--mat-text-button-icon-spacing: 0;--mat-filled-button-icon-spacing: 0;--mat-protected-button-icon-spacing: 0;--mat-outlined-button-icon-spacing: 0}.ngx-mat-split-button-raised-wrapper{display:inline-block;border-radius:var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));box-shadow:var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1))}.ngx-mat-split-button-flat mat-icon svg{fill:var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatMenuModule }, { kind: "component", type: i2.MatMenu, selector: "mat-menu", inputs: ["backdropClass", "aria-label", "aria-labelledby", "aria-describedby", "xPosition", "yPosition", "overlapTrigger", "hasBackdrop", "class", "classList"], outputs: ["closed", "close"], exportAs: ["matMenu"] }, { kind: "directive", type: i2.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", inputs: ["mat-menu-trigger-for", "matMenuTriggerFor", "matMenuTriggerData", "matMenuTriggerRestoreFocus"], outputs: ["menuOpened", "onMenuOpen", "menuClosed", "onMenuClose"], exportAs: ["matMenuTrigger"] }] });
107
+ }
108
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImport: i0, type: NgxMatSplitButton, decorators: [{
109
+ type: Component,
110
+ args: [{ selector: 'ngx-mat-split-button', standalone: true, imports: [
111
+ CommonModule,
112
+ MatButton,
113
+ MatIcon,
114
+ MatMenuModule,
115
+ ], template: `
116
+ @if (buttonStyle() === 'basic') {
117
+ <button mat-button [color]="color()" (click)="primaryClick.emit($event)"
118
+ class="ngx-mat-split-button-primary ngx-mat-split-button-basic">
119
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
120
+ </button>
121
+ <button mat-button [color]="color()" [matMenuTriggerFor]="menu"
122
+ class="ngx-mat-split-button-trigger"
123
+ aria-label="Toggle dropdown">
124
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
125
+ </button>
126
+ } @else if (buttonStyle() === 'raised') {
127
+ <div class="ngx-mat-split-button-raised-wrapper">
128
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
129
+ class="ngx-mat-split-button-primary ngx-mat-split-button-raised">
130
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
131
+ </button>
132
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
133
+ class="ngx-mat-split-button-trigger"
134
+ aria-label="Toggle dropdown">
135
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
136
+ </button>
137
+ </div>
138
+ } @else if (buttonStyle() === 'stroked') {
139
+ <button mat-stroked-button [color]="color()" (click)="primaryClick.emit($event)"
140
+ class="ngx-mat-split-button-primary ngx-mat-split-button-stroked">
141
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
142
+ </button>
143
+ <button mat-stroked-button [color]="color()" [matMenuTriggerFor]="menu"
144
+ class="ngx-mat-split-button-trigger"
145
+ aria-label="Toggle dropdown">
146
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
147
+ </button>
148
+ } @else if (buttonStyle() === 'flat') {
149
+ <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
150
+ class="ngx-mat-split-button-primary ngx-mat-split-button-flat">
151
+ <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
152
+ </button>
153
+ <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
154
+ class="ngx-mat-split-button-trigger"
155
+ aria-label="Toggle dropdown">
156
+ <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
157
+ </button>
158
+ }
159
+ <mat-menu #menu="matMenu" xPosition="before">
160
+ <ng-content />
161
+ </mat-menu>
162
+ `, styles: [".ngx-mat-split-button-primary{border-top-right-radius:0;border-bottom-right-radius:0}.ngx-mat-split-button-trigger{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;min-width:3rem}.ngx-mat-split-button-trigger mat-icon{--mat-text-button-icon-spacing: 0;--mat-filled-button-icon-spacing: 0;--mat-protected-button-icon-spacing: 0;--mat-outlined-button-icon-spacing: 0}.ngx-mat-split-button-raised-wrapper{display:inline-block;border-radius:var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));box-shadow:var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1))}.ngx-mat-split-button-flat mat-icon svg{fill:var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary))}\n"] }]
163
+ }], ctorParameters: () => [] });
164
+
165
+ /*
166
+ * Public API Surface of ngx-mat-split-button
167
+ */
168
+
169
+ /**
170
+ * Generated bundle index. Do not edit.
171
+ */
172
+
173
+ export { NgxMatSplitButton, NgxMatSplitPrimaryAction };
174
+ //# sourceMappingURL=feature23-ngx-mat-split-button.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature23-ngx-mat-split-button.mjs","sources":["../../../projects/ngx-mat-split-button/src/lib/ngx-mat-split-button.service.ts","../../../projects/ngx-mat-split-button/src/lib/ngx-mat-split-primary-action.directive.ts","../../../projects/ngx-mat-split-button/src/lib/ngx-mat-split-button.component.ts","../../../projects/ngx-mat-split-button/src/public-api.ts","../../../projects/ngx-mat-split-button/src/feature23-ngx-mat-split-button.ts"],"sourcesContent":["import { inject, Injectable } from '@angular/core';\nimport { MatIconRegistry } from '@angular/material/icon';\nimport { DomSanitizer } from '@angular/platform-browser';\n\nconst ARROW_DOWN_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M7 10l5 5 5-5z\"/></svg>\n`;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class NgxMatSplitButtonService {\n\n constructor() {\n const iconRegistry = inject(MatIconRegistry);\n const sanitizer = inject(DomSanitizer);\n iconRegistry.addSvgIconLiteral('ngx-mat-split-arrow-down-icon', sanitizer.bypassSecurityTrustHtml(ARROW_DOWN_ICON));\n }\n\n initialize() {\n // noop, ensure service is injected and constructor run\n }\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({\n selector: '[ngx-mat-split-primary-action]',\n standalone: true,\n})\nexport class NgxMatSplitPrimaryAction {\n constructor(public templateRef: TemplateRef<unknown>) {\n }\n }\n","import { CommonModule } from '@angular/common';\nimport { Component, contentChild, inject, input, output } from '@angular/core';\nimport { MatButton } from '@angular/material/button';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatMenuModule } from '@angular/material/menu';\nimport { NgxMatSplitButtonService } from './ngx-mat-split-button.service';\nimport { NgxMatSplitPrimaryAction } from './ngx-mat-split-primary-action.directive';\n\n@Component({\n selector: 'ngx-mat-split-button',\n standalone: true,\n imports: [\n CommonModule,\n MatButton,\n MatIcon,\n MatMenuModule,\n ],\n // NOTE: the repetitive code here is required because it doesn't appear that you can conditionally add directives like `mat-button` vs `mat-flat-button`.\n template: `\n @if (buttonStyle() === 'basic') {\n <button mat-button [color]=\"color()\" (click)=\"primaryClick.emit($event)\"\n class=\"ngx-mat-split-button-primary ngx-mat-split-button-basic\">\n <ng-container [ngTemplateOutlet]=\"primaryAction().templateRef\" />\n </button>\n <button mat-button [color]=\"color()\" [matMenuTriggerFor]=\"menu\"\n class=\"ngx-mat-split-button-trigger\"\n aria-label=\"Toggle dropdown\">\n <mat-icon svgIcon=\"ngx-mat-split-arrow-down-icon\" aria-label=\"Down arrow icon\" />\n </button>\n } @else if (buttonStyle() === 'raised') {\n <div class=\"ngx-mat-split-button-raised-wrapper\">\n <button mat-flat-button [color]=\"color()\" (click)=\"primaryClick.emit($event)\"\n class=\"ngx-mat-split-button-primary ngx-mat-split-button-raised\">\n <ng-container [ngTemplateOutlet]=\"primaryAction().templateRef\" />\n </button>\n <button mat-flat-button [color]=\"color()\" [matMenuTriggerFor]=\"menu\"\n class=\"ngx-mat-split-button-trigger\"\n aria-label=\"Toggle dropdown\">\n <mat-icon svgIcon=\"ngx-mat-split-arrow-down-icon\" aria-label=\"Down arrow icon\" />\n </button>\n </div>\n } @else if (buttonStyle() === 'stroked') {\n <button mat-stroked-button [color]=\"color()\" (click)=\"primaryClick.emit($event)\"\n class=\"ngx-mat-split-button-primary ngx-mat-split-button-stroked\">\n <ng-container [ngTemplateOutlet]=\"primaryAction().templateRef\" />\n </button>\n <button mat-stroked-button [color]=\"color()\" [matMenuTriggerFor]=\"menu\"\n class=\"ngx-mat-split-button-trigger\"\n aria-label=\"Toggle dropdown\">\n <mat-icon svgIcon=\"ngx-mat-split-arrow-down-icon\" aria-label=\"Down arrow icon\" />\n </button>\n } @else if (buttonStyle() === 'flat') {\n <button mat-flat-button [color]=\"color()\" (click)=\"primaryClick.emit($event)\"\n class=\"ngx-mat-split-button-primary ngx-mat-split-button-flat\">\n <ng-container [ngTemplateOutlet]=\"primaryAction().templateRef\" />\n </button>\n <button mat-flat-button [color]=\"color()\" [matMenuTriggerFor]=\"menu\"\n class=\"ngx-mat-split-button-trigger\"\n aria-label=\"Toggle dropdown\">\n <mat-icon svgIcon=\"ngx-mat-split-arrow-down-icon\" aria-label=\"Down arrow icon\" />\n </button>\n }\n <mat-menu #menu=\"matMenu\" xPosition=\"before\">\n <ng-content />\n </mat-menu>\n `,\n styles: `\n .ngx-mat-split-button-primary {\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n }\n .ngx-mat-split-button-trigger {\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n border-left-width: 0;\n min-width: 3rem;\n\n mat-icon {\n --mat-text-button-icon-spacing: 0;\n --mat-filled-button-icon-spacing: 0;\n --mat-protected-button-icon-spacing: 0;\n --mat-outlined-button-icon-spacing: 0;\n }\n }\n .ngx-mat-split-button-raised-wrapper {\n display: inline-block;\n border-radius: var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));\n box-shadow: var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1));\n }\n .ngx-mat-split-button-flat {\n mat-icon svg {\n fill: var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary));\n }\n }\n `\n})\nexport class NgxMatSplitButton {\n readonly color = input<string>();\n readonly buttonStyle = input<'basic' | 'raised' | 'stroked' | 'flat'>('basic');\n\n readonly primaryClick = output<MouseEvent>();\n\n readonly primaryAction = contentChild.required(NgxMatSplitPrimaryAction);\n\n constructor() {\n const service = inject(NgxMatSplitButtonService);\n service.initialize();\n }\n}\n","/*\n * Public API Surface of ngx-mat-split-button\n */\n\nexport * from './lib/ngx-mat-split-button.component';\nexport * from './lib/ngx-mat-split-primary-action.directive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;AAIA,MAAM,eAAe,GAAG,CAAA;;CAEvB,CAAC;MAKW,wBAAwB,CAAA;AAEjC,IAAA,WAAA,GAAA;AACI,QAAA,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAC7C,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AACvC,QAAA,YAAY,CAAC,iBAAiB,CAAC,+BAA+B,EAAE,SAAS,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAC;KACvH;IAED,UAAU,GAAA;;KAET;wGAVQ,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cAFrB,MAAM,EAAA,CAAA,CAAA;;4FAET,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBAHpC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,UAAU,EAAE,MAAM;AACrB,iBAAA,CAAA;;;MCJY,wBAAwB,CAAA;AACd,IAAA,WAAA,CAAA;AAAnB,IAAA,WAAA,CAAmB,WAAiC,EAAA;QAAjC,IAAW,CAAA,WAAA,GAAX,WAAW,CAAsB;KACnD;wGAFQ,wBAAwB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,WAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,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,EAAA,4BAAA,CAAA,EAAA,OAAA,EAAA,CAAA,YAAA,EAAA,YAAA,EAAA,YAAA,EAAA,aAAA,CAAA,EAAA,QAAA,EAAA,CAAA,gBAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA;;4FAiFR,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAxF7B,SAAS;+BACI,sBAAsB,EAAA,UAAA,EACpB,IAAI,EACP,OAAA,EAAA;wBACL,YAAY;wBACZ,SAAS;wBACT,OAAO;wBACP,aAAa;qBAChB,EAES,QAAA,EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CX,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,iuBAAA,CAAA,EAAA,CAAA;;;ACjEH;;AAEG;;ACFH;;AAEG;;;;"}
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@feature23/ngx-mat-split-button" />
5
+ export * from './public-api';
@@ -0,0 +1,11 @@
1
+ import { NgxMatSplitPrimaryAction } from './ngx-mat-split-primary-action.directive';
2
+ import * as i0 from "@angular/core";
3
+ export declare class NgxMatSplitButton {
4
+ readonly color: import("@angular/core").InputSignal<string | undefined>;
5
+ readonly buttonStyle: import("@angular/core").InputSignal<"basic" | "raised" | "stroked" | "flat">;
6
+ readonly primaryClick: import("@angular/core").OutputEmitterRef<MouseEvent>;
7
+ readonly primaryAction: import("@angular/core").Signal<NgxMatSplitPrimaryAction>;
8
+ constructor();
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatSplitButton, never>;
10
+ static ɵcmp: i0.ɵɵComponentDeclaration<NgxMatSplitButton, "ngx-mat-split-button", never, { "color": { "alias": "color"; "required": false; "isSignal": true; }; "buttonStyle": { "alias": "buttonStyle"; "required": false; "isSignal": true; }; }, { "primaryClick": "primaryClick"; }, ["primaryAction"], ["*"], true, never>;
11
+ }
@@ -0,0 +1,7 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class NgxMatSplitButtonService {
3
+ constructor();
4
+ initialize(): void;
5
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatSplitButtonService, never>;
6
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxMatSplitButtonService>;
7
+ }
@@ -0,0 +1,8 @@
1
+ import { TemplateRef } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ export declare class NgxMatSplitPrimaryAction {
4
+ templateRef: TemplateRef<unknown>;
5
+ constructor(templateRef: TemplateRef<unknown>);
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxMatSplitPrimaryAction, never>;
7
+ static ɵdir: i0.ɵɵDirectiveDeclaration<NgxMatSplitPrimaryAction, "[ngx-mat-split-primary-action]", never, {}, {}, never, never, true, never>;
8
+ }
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@feature23/ngx-mat-split-button",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "license": "MIT",
5
5
  "private": false,
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/feature23/ngx-mat-split-button.git"
9
+ },
6
10
  "peerDependencies": {
7
11
  "@angular/common": "^18.2.0",
8
12
  "@angular/core": "^18.2.0",
@@ -11,5 +15,18 @@
11
15
  "dependencies": {
12
16
  "tslib": "^2.3.0"
13
17
  },
14
- "sideEffects": false
15
- }
18
+ "sideEffects": false,
19
+ "module": "fesm2022/feature23-ngx-mat-split-button.mjs",
20
+ "typings": "index.d.ts",
21
+ "exports": {
22
+ "./package.json": {
23
+ "default": "./package.json"
24
+ },
25
+ ".": {
26
+ "types": "./index.d.ts",
27
+ "esm2022": "./esm2022/feature23-ngx-mat-split-button.mjs",
28
+ "esm": "./esm2022/feature23-ngx-mat-split-button.mjs",
29
+ "default": "./fesm2022/feature23-ngx-mat-split-button.mjs"
30
+ }
31
+ }
32
+ }
@@ -1,6 +1,2 @@
1
- /*
2
- * Public API Surface of ngx-mat-split-button
3
- */
4
-
5
1
  export * from './lib/ngx-mat-split-button.component';
6
2
  export * from './lib/ngx-mat-split-primary-action.directive';
package/ng-package.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/ngx-mat-split-button",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- }
7
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { NgxMatSplitButton } from './ngx-mat-split-button.component';
4
-
5
- describe('NgxMatSplitButton', () => {
6
- let component: NgxMatSplitButton;
7
- let fixture: ComponentFixture<NgxMatSplitButton>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- imports: [NgxMatSplitButton]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(NgxMatSplitButton);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,109 +0,0 @@
1
- import { CommonModule } from '@angular/common';
2
- import { Component, contentChild, inject, input, output } from '@angular/core';
3
- import { MatButton } from '@angular/material/button';
4
- import { MatIcon } from '@angular/material/icon';
5
- import { MatMenuModule } from '@angular/material/menu';
6
- import { NgxMatSplitButtonService } from './ngx-mat-split-button.service';
7
- import { NgxMatSplitPrimaryAction } from './ngx-mat-split-primary-action.directive';
8
-
9
- @Component({
10
- selector: 'ngx-mat-split-button',
11
- standalone: true,
12
- imports: [
13
- CommonModule,
14
- MatButton,
15
- MatIcon,
16
- MatMenuModule,
17
- ],
18
- // NOTE: the repetitive code here is required because it doesn't appear that you can conditionally add directives like `mat-button` vs `mat-flat-button`.
19
- template: `
20
- @if (buttonStyle() === 'basic') {
21
- <button mat-button [color]="color()" (click)="primaryClick.emit($event)"
22
- class="ngx-mat-split-button-primary ngx-mat-split-button-basic">
23
- <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
24
- </button>
25
- <button mat-button [color]="color()" [matMenuTriggerFor]="menu"
26
- class="ngx-mat-split-button-trigger"
27
- aria-label="Toggle dropdown">
28
- <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
29
- </button>
30
- } @else if (buttonStyle() === 'raised') {
31
- <div class="ngx-mat-split-button-raised-wrapper">
32
- <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
33
- class="ngx-mat-split-button-primary ngx-mat-split-button-raised">
34
- <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
35
- </button>
36
- <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
37
- class="ngx-mat-split-button-trigger"
38
- aria-label="Toggle dropdown">
39
- <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
40
- </button>
41
- </div>
42
- } @else if (buttonStyle() === 'stroked') {
43
- <button mat-stroked-button [color]="color()" (click)="primaryClick.emit($event)"
44
- class="ngx-mat-split-button-primary ngx-mat-split-button-stroked">
45
- <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
46
- </button>
47
- <button mat-stroked-button [color]="color()" [matMenuTriggerFor]="menu"
48
- class="ngx-mat-split-button-trigger"
49
- aria-label="Toggle dropdown">
50
- <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
51
- </button>
52
- } @else if (buttonStyle() === 'flat') {
53
- <button mat-flat-button [color]="color()" (click)="primaryClick.emit($event)"
54
- class="ngx-mat-split-button-primary ngx-mat-split-button-flat">
55
- <ng-container [ngTemplateOutlet]="primaryAction().templateRef" />
56
- </button>
57
- <button mat-flat-button [color]="color()" [matMenuTriggerFor]="menu"
58
- class="ngx-mat-split-button-trigger"
59
- aria-label="Toggle dropdown">
60
- <mat-icon svgIcon="ngx-mat-split-arrow-down-icon" aria-label="Down arrow icon" />
61
- </button>
62
- }
63
- <mat-menu #menu="matMenu" xPosition="before">
64
- <ng-content />
65
- </mat-menu>
66
- `,
67
- styles: `
68
- .ngx-mat-split-button-primary {
69
- border-top-right-radius: 0;
70
- border-bottom-right-radius: 0;
71
- }
72
- .ngx-mat-split-button-trigger {
73
- border-top-left-radius: 0;
74
- border-bottom-left-radius: 0;
75
- border-left-width: 0;
76
- min-width: 3rem;
77
-
78
- mat-icon {
79
- --mat-text-button-icon-spacing: 0;
80
- --mat-filled-button-icon-spacing: 0;
81
- --mat-protected-button-icon-spacing: 0;
82
- --mat-outlined-button-icon-spacing: 0;
83
- }
84
- }
85
- .ngx-mat-split-button-raised-wrapper {
86
- display: inline-block;
87
- border-radius: var(--mdc-filled-button-container-shape, var(--mat-app-corner-full));
88
- box-shadow: var(--mdc-protected-button-container-elevation-shadow, var(--mat-app-level1));
89
- }
90
- .ngx-mat-split-button-flat {
91
- mat-icon svg {
92
- fill: var(--mdc-filled-button-label-text-color, var(--mat-app-on-primary));
93
- }
94
- }
95
- `
96
- })
97
- export class NgxMatSplitButton {
98
- readonly color = input<string>();
99
- readonly buttonStyle = input<'basic' | 'raised' | 'stroked' | 'flat'>('basic');
100
-
101
- readonly primaryClick = output<MouseEvent>();
102
-
103
- readonly primaryAction = contentChild.required(NgxMatSplitPrimaryAction);
104
-
105
- constructor() {
106
- const service = inject(NgxMatSplitButtonService);
107
- service.initialize();
108
- }
109
- }
@@ -1,23 +0,0 @@
1
- import { inject, Injectable } from '@angular/core';
2
- import { MatIconRegistry } from '@angular/material/icon';
3
- import { DomSanitizer } from '@angular/platform-browser';
4
-
5
- const ARROW_DOWN_ICON = `
6
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"><path d="M0 0h24v24H0z" fill="none"/><path d="M7 10l5 5 5-5z"/></svg>
7
- `;
8
-
9
- @Injectable({
10
- providedIn: 'root'
11
- })
12
- export class NgxMatSplitButtonService {
13
-
14
- constructor() {
15
- const iconRegistry = inject(MatIconRegistry);
16
- const sanitizer = inject(DomSanitizer);
17
- iconRegistry.addSvgIconLiteral('ngx-mat-split-arrow-down-icon', sanitizer.bypassSecurityTrustHtml(ARROW_DOWN_ICON));
18
- }
19
-
20
- initialize() {
21
- // noop, ensure service is injected and constructor run
22
- }
23
- }
@@ -1,10 +0,0 @@
1
- import { Directive, TemplateRef } from '@angular/core';
2
-
3
- @Directive({
4
- selector: '[ngx-mat-split-primary-action]',
5
- standalone: true,
6
- })
7
- export class NgxMatSplitPrimaryAction {
8
- constructor(public templateRef: TemplateRef<unknown>) {
9
- }
10
- }
package/tsconfig.lib.json DELETED
@@ -1,15 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/lib",
7
- "declaration": true,
8
- "declarationMap": true,
9
- "inlineSources": true,
10
- "types": []
11
- },
12
- "exclude": [
13
- "**/*.spec.ts"
14
- ]
15
- }
@@ -1,11 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "./tsconfig.lib.json",
5
- "compilerOptions": {
6
- "declarationMap": false
7
- },
8
- "angularCompilerOptions": {
9
- "compilationMode": "partial"
10
- }
11
- }
@@ -1,15 +0,0 @@
1
- /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
- /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
- {
4
- "extends": "../../tsconfig.json",
5
- "compilerOptions": {
6
- "outDir": "../../out-tsc/spec",
7
- "types": [
8
- "jasmine"
9
- ]
10
- },
11
- "include": [
12
- "**/*.spec.ts",
13
- "**/*.d.ts"
14
- ]
15
- }