@memberjunction/ng-ui-components 0.0.1 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/accordion/accordion.component.d.ts +58 -0
- package/dist/lib/accordion/accordion.component.d.ts.map +1 -0
- package/dist/lib/accordion/accordion.component.js +163 -0
- package/dist/lib/accordion/accordion.component.js.map +1 -0
- package/dist/lib/accordion/accordion.scss +45 -0
- package/dist/lib/button/button.directive.d.ts +45 -0
- package/dist/lib/button/button.directive.d.ts.map +1 -0
- package/dist/lib/button/button.directive.js +114 -0
- package/dist/lib/button/button.directive.js.map +1 -0
- package/dist/lib/button/button.scss +250 -0
- package/dist/lib/calendar/calendar-utils.d.ts +16 -0
- package/dist/lib/calendar/calendar-utils.d.ts.map +1 -0
- package/dist/lib/calendar/calendar-utils.js +41 -0
- package/dist/lib/calendar/calendar-utils.js.map +1 -0
- package/dist/lib/combobox/combobox.component.d.ts +83 -0
- package/dist/lib/combobox/combobox.component.d.ts.map +1 -0
- package/dist/lib/combobox/combobox.component.js +483 -0
- package/dist/lib/combobox/combobox.component.js.map +1 -0
- package/dist/lib/combobox/combobox.scss +86 -0
- package/dist/lib/datepicker/datepicker.component.d.ts +50 -0
- package/dist/lib/datepicker/datepicker.component.d.ts.map +1 -0
- package/dist/lib/datepicker/datepicker.component.js +279 -0
- package/dist/lib/datepicker/datepicker.component.js.map +1 -0
- package/dist/lib/datepicker/datepicker.scss +60 -0
- package/dist/lib/dialog/dialog.component.d.ts +84 -0
- package/dist/lib/dialog/dialog.component.d.ts.map +1 -0
- package/dist/lib/dialog/dialog.component.js +285 -0
- package/dist/lib/dialog/dialog.component.js.map +1 -0
- package/dist/lib/dialog/dialog.scss +134 -0
- package/dist/lib/dialog/dialog.service.d.ts +114 -0
- package/dist/lib/dialog/dialog.service.d.ts.map +1 -0
- package/dist/lib/dialog/dialog.service.js +282 -0
- package/dist/lib/dialog/dialog.service.js.map +1 -0
- package/dist/lib/dropdown/dropdown.component.d.ts +75 -0
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -0
- package/dist/lib/dropdown/dropdown.component.js +445 -0
- package/dist/lib/dropdown/dropdown.component.js.map +1 -0
- package/dist/lib/dropdown/dropdown.scss +68 -0
- package/dist/lib/input/chip.scss +64 -0
- package/dist/lib/input/input-switch-progress.scss +57 -0
- package/dist/lib/input/input.scss +77 -0
- package/dist/lib/numeric-input/numeric-input.component.d.ts +31 -0
- package/dist/lib/numeric-input/numeric-input.component.d.ts.map +1 -0
- package/dist/lib/numeric-input/numeric-input.component.js +103 -0
- package/dist/lib/numeric-input/numeric-input.component.js.map +1 -0
- package/dist/lib/progress-bar/progress-bar.component.d.ts +14 -0
- package/dist/lib/progress-bar/progress-bar.component.d.ts.map +1 -0
- package/dist/lib/progress-bar/progress-bar.component.js +62 -0
- package/dist/lib/progress-bar/progress-bar.component.js.map +1 -0
- package/dist/lib/splitter/splitter.component.d.ts +23 -0
- package/dist/lib/splitter/splitter.component.d.ts.map +1 -0
- package/dist/lib/splitter/splitter.component.js +24 -0
- package/dist/lib/splitter/splitter.component.js.map +1 -0
- package/dist/lib/splitter/splitter.scss +29 -0
- package/dist/lib/switch/switch.component.d.ts +24 -0
- package/dist/lib/switch/switch.component.d.ts.map +1 -0
- package/dist/lib/switch/switch.component.js +82 -0
- package/dist/lib/switch/switch.component.js.map +1 -0
- package/dist/lib/window/window.component.d.ts +115 -0
- package/dist/lib/window/window.component.d.ts.map +1 -0
- package/dist/lib/window/window.component.js +502 -0
- package/dist/lib/window/window.component.js.map +1 -0
- package/dist/lib/window/window.scss +97 -0
- package/dist/public-api.d.ts +14 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +39 -6
- package/README.md +0 -45
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventEmitter, TemplateRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Directive to mark a template as the accordion panel title.
|
|
5
|
+
* Supports rich HTML content (icons, badges, dynamic text).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```html
|
|
9
|
+
* <mj-accordion-panel [Expanded]="true">
|
|
10
|
+
* <ng-template mjAccordionTitle>
|
|
11
|
+
* <i class="fa-solid fa-code"></i> Template Editor
|
|
12
|
+
* <span class="badge">3</span>
|
|
13
|
+
* </ng-template>
|
|
14
|
+
* <p>Panel content here</p>
|
|
15
|
+
* </mj-accordion-panel>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class MJAccordionTitleDirective {
|
|
19
|
+
templateRef: TemplateRef<unknown>;
|
|
20
|
+
constructor(templateRef: TemplateRef<unknown>);
|
|
21
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJAccordionTitleDirective, never>;
|
|
22
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MJAccordionTitleDirective, "[mjAccordionTitle]", never, {}, {}, never, never, true, never>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* mj-accordion-panel — Collapsible panel. Replaces `<kendo-panelbar-item>` and `<kendo-expansionpanel>`.
|
|
26
|
+
*
|
|
27
|
+
* Supports two title modes:
|
|
28
|
+
* - Simple string: `[Title]="'Details'"` — plain text title
|
|
29
|
+
* - Rich template: `<ng-template mjAccordionTitle>` — HTML with icons, badges, etc.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```html
|
|
33
|
+
* <!-- Simple string title -->
|
|
34
|
+
* <mj-accordion-panel Title="Details" [Expanded]="true">
|
|
35
|
+
* <p>Panel content here</p>
|
|
36
|
+
* </mj-accordion-panel>
|
|
37
|
+
*
|
|
38
|
+
* <!-- Rich HTML title -->
|
|
39
|
+
* <mj-accordion-panel [Expanded]="true">
|
|
40
|
+
* <ng-template mjAccordionTitle>
|
|
41
|
+
* <i class="fa-solid fa-code"></i> Template Editor
|
|
42
|
+
* </ng-template>
|
|
43
|
+
* <p>Panel content here</p>
|
|
44
|
+
* </mj-accordion-panel>
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class MJAccordionPanelComponent {
|
|
48
|
+
Title: string;
|
|
49
|
+
Expanded: boolean;
|
|
50
|
+
Disabled: boolean;
|
|
51
|
+
ExpandedChange: EventEmitter<boolean>;
|
|
52
|
+
titleTemplate: MJAccordionTitleDirective | null;
|
|
53
|
+
readonly hostClass = true;
|
|
54
|
+
Toggle(): void;
|
|
55
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJAccordionPanelComponent, never>;
|
|
56
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MJAccordionPanelComponent, "mj-accordion-panel", never, { "Title": { "alias": "Title"; "required": false; }; "Expanded": { "alias": "Expanded"; "required": false; }; "Disabled": { "alias": "Disabled"; "required": false; }; }, { "ExpandedChange": "ExpandedChange"; }, ["titleTemplate"], ["*"], true, never>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=accordion.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.component.d.ts","sourceRoot":"","sources":["../../../src/lib/accordion/accordion.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAA6B,WAAW,EAAa,MAAM,eAAe,CAAC;;AAG1H;;;;;;;;;;;;;;GAcG;AACH,qBAIa,yBAAyB;IACjB,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;gBAAjC,WAAW,EAAE,WAAW,CAAC,OAAO,CAAC;yCADzC,yBAAyB;2CAAzB,yBAAyB;CAErC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBA2Ba,yBAAyB;IAC3B,KAAK,SAAM;IACX,QAAQ,UAAS;IACjB,QAAQ,UAAS;IAChB,cAAc,wBAA+B;IACd,aAAa,EAAE,yBAAyB,GAAG,IAAI,CAAQ;IAClD,QAAQ,CAAC,SAAS,QAAQ;IAExE,MAAM,IAAI,IAAI;yCARH,yBAAyB;2CAAzB,yBAAyB;CAarC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Component, Input, Output, EventEmitter, HostBinding, ContentChild, Directive } from '@angular/core';
|
|
2
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
const _c0 = ["*"];
|
|
5
|
+
function MJAccordionPanelComponent_Conditional_3_Template(rf, ctx) { if (rf & 1) {
|
|
6
|
+
i0.ɵɵelementContainer(0, 3);
|
|
7
|
+
} if (rf & 2) {
|
|
8
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
9
|
+
i0.ɵɵproperty("ngTemplateOutlet", ctx_r0.titleTemplate.templateRef);
|
|
10
|
+
} }
|
|
11
|
+
function MJAccordionPanelComponent_Conditional_4_Template(rf, ctx) { if (rf & 1) {
|
|
12
|
+
i0.ɵɵtext(0);
|
|
13
|
+
} if (rf & 2) {
|
|
14
|
+
const ctx_r0 = i0.ɵɵnextContext();
|
|
15
|
+
i0.ɵɵtextInterpolate1(" ", ctx_r0.Title, " ");
|
|
16
|
+
} }
|
|
17
|
+
function MJAccordionPanelComponent_Conditional_6_Template(rf, ctx) { if (rf & 1) {
|
|
18
|
+
i0.ɵɵelementStart(0, "div", 5);
|
|
19
|
+
i0.ɵɵprojection(1);
|
|
20
|
+
i0.ɵɵelementEnd();
|
|
21
|
+
} }
|
|
22
|
+
/**
|
|
23
|
+
* Directive to mark a template as the accordion panel title.
|
|
24
|
+
* Supports rich HTML content (icons, badges, dynamic text).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```html
|
|
28
|
+
* <mj-accordion-panel [Expanded]="true">
|
|
29
|
+
* <ng-template mjAccordionTitle>
|
|
30
|
+
* <i class="fa-solid fa-code"></i> Template Editor
|
|
31
|
+
* <span class="badge">3</span>
|
|
32
|
+
* </ng-template>
|
|
33
|
+
* <p>Panel content here</p>
|
|
34
|
+
* </mj-accordion-panel>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export class MJAccordionTitleDirective {
|
|
38
|
+
templateRef;
|
|
39
|
+
constructor(templateRef) {
|
|
40
|
+
this.templateRef = templateRef;
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = function MJAccordionTitleDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJAccordionTitleDirective)(i0.ɵɵdirectiveInject(i0.TemplateRef)); };
|
|
43
|
+
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MJAccordionTitleDirective, selectors: [["", "mjAccordionTitle", ""]] });
|
|
44
|
+
}
|
|
45
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJAccordionTitleDirective, [{
|
|
46
|
+
type: Directive,
|
|
47
|
+
args: [{
|
|
48
|
+
selector: '[mjAccordionTitle]',
|
|
49
|
+
standalone: true
|
|
50
|
+
}]
|
|
51
|
+
}], () => [{ type: i0.TemplateRef }], null); })();
|
|
52
|
+
/**
|
|
53
|
+
* mj-accordion-panel — Collapsible panel. Replaces `<kendo-panelbar-item>` and `<kendo-expansionpanel>`.
|
|
54
|
+
*
|
|
55
|
+
* Supports two title modes:
|
|
56
|
+
* - Simple string: `[Title]="'Details'"` — plain text title
|
|
57
|
+
* - Rich template: `<ng-template mjAccordionTitle>` — HTML with icons, badges, etc.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```html
|
|
61
|
+
* <!-- Simple string title -->
|
|
62
|
+
* <mj-accordion-panel Title="Details" [Expanded]="true">
|
|
63
|
+
* <p>Panel content here</p>
|
|
64
|
+
* </mj-accordion-panel>
|
|
65
|
+
*
|
|
66
|
+
* <!-- Rich HTML title -->
|
|
67
|
+
* <mj-accordion-panel [Expanded]="true">
|
|
68
|
+
* <ng-template mjAccordionTitle>
|
|
69
|
+
* <i class="fa-solid fa-code"></i> Template Editor
|
|
70
|
+
* </ng-template>
|
|
71
|
+
* <p>Panel content here</p>
|
|
72
|
+
* </mj-accordion-panel>
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export class MJAccordionPanelComponent {
|
|
76
|
+
Title = '';
|
|
77
|
+
Expanded = false;
|
|
78
|
+
Disabled = false;
|
|
79
|
+
ExpandedChange = new EventEmitter();
|
|
80
|
+
titleTemplate = null;
|
|
81
|
+
hostClass = true;
|
|
82
|
+
Toggle() {
|
|
83
|
+
if (this.Disabled)
|
|
84
|
+
return;
|
|
85
|
+
this.Expanded = !this.Expanded;
|
|
86
|
+
this.ExpandedChange.emit(this.Expanded);
|
|
87
|
+
}
|
|
88
|
+
static ɵfac = function MJAccordionPanelComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJAccordionPanelComponent)(); };
|
|
89
|
+
static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJAccordionPanelComponent, selectors: [["mj-accordion-panel"]], contentQueries: function MJAccordionPanelComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
|
|
90
|
+
i0.ɵɵcontentQuery(dirIndex, MJAccordionTitleDirective, 5);
|
|
91
|
+
} if (rf & 2) {
|
|
92
|
+
let _t;
|
|
93
|
+
i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.titleTemplate = _t.first);
|
|
94
|
+
} }, hostVars: 2, hostBindings: function MJAccordionPanelComponent_HostBindings(rf, ctx) { if (rf & 2) {
|
|
95
|
+
i0.ɵɵclassProp("mj-accordion-panel-host", ctx.hostClass);
|
|
96
|
+
} }, inputs: { Title: "Title", Expanded: "Expanded", Disabled: "Disabled" }, outputs: { ExpandedChange: "ExpandedChange" }, ngContentSelectors: _c0, decls: 7, vars: 8, consts: [[1, "mj-accordion-panel"], ["type", "button", 1, "mj-accordion-header", 3, "click", "disabled"], [1, "mj-accordion-title"], [3, "ngTemplateOutlet"], [1, "fa-solid", "fa-chevron-down", "mj-accordion-icon"], ["role", "region", 1, "mj-accordion-body"]], template: function MJAccordionPanelComponent_Template(rf, ctx) { if (rf & 1) {
|
|
97
|
+
i0.ɵɵprojectionDef();
|
|
98
|
+
i0.ɵɵelementStart(0, "div", 0)(1, "button", 1);
|
|
99
|
+
i0.ɵɵlistener("click", function MJAccordionPanelComponent_Template_button_click_1_listener() { return ctx.Toggle(); });
|
|
100
|
+
i0.ɵɵelementStart(2, "span", 2);
|
|
101
|
+
i0.ɵɵconditionalCreate(3, MJAccordionPanelComponent_Conditional_3_Template, 1, 1, "ng-container", 3)(4, MJAccordionPanelComponent_Conditional_4_Template, 1, 1);
|
|
102
|
+
i0.ɵɵelementEnd();
|
|
103
|
+
i0.ɵɵelement(5, "i", 4);
|
|
104
|
+
i0.ɵɵelementEnd();
|
|
105
|
+
i0.ɵɵconditionalCreate(6, MJAccordionPanelComponent_Conditional_6_Template, 2, 0, "div", 5);
|
|
106
|
+
i0.ɵɵelementEnd();
|
|
107
|
+
} if (rf & 2) {
|
|
108
|
+
i0.ɵɵclassProp("mj-accordion-panel--expanded", ctx.Expanded)("mj-accordion-panel--disabled", ctx.Disabled);
|
|
109
|
+
i0.ɵɵadvance();
|
|
110
|
+
i0.ɵɵproperty("disabled", ctx.Disabled);
|
|
111
|
+
i0.ɵɵattribute("aria-expanded", ctx.Expanded);
|
|
112
|
+
i0.ɵɵadvance(2);
|
|
113
|
+
i0.ɵɵconditional(ctx.titleTemplate ? 3 : 4);
|
|
114
|
+
i0.ɵɵadvance(3);
|
|
115
|
+
i0.ɵɵconditional(ctx.Expanded ? 6 : -1);
|
|
116
|
+
} }, dependencies: [NgTemplateOutlet], encapsulation: 2 });
|
|
117
|
+
}
|
|
118
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJAccordionPanelComponent, [{
|
|
119
|
+
type: Component,
|
|
120
|
+
args: [{
|
|
121
|
+
selector: 'mj-accordion-panel',
|
|
122
|
+
standalone: true,
|
|
123
|
+
imports: [NgTemplateOutlet],
|
|
124
|
+
template: `
|
|
125
|
+
<div class="mj-accordion-panel" [class.mj-accordion-panel--expanded]="Expanded" [class.mj-accordion-panel--disabled]="Disabled">
|
|
126
|
+
<button class="mj-accordion-header" type="button"
|
|
127
|
+
[attr.aria-expanded]="Expanded"
|
|
128
|
+
[disabled]="Disabled"
|
|
129
|
+
(click)="Toggle()">
|
|
130
|
+
<span class="mj-accordion-title">
|
|
131
|
+
@if (titleTemplate) {
|
|
132
|
+
<ng-container [ngTemplateOutlet]="titleTemplate.templateRef"></ng-container>
|
|
133
|
+
} @else {
|
|
134
|
+
{{ Title }}
|
|
135
|
+
}
|
|
136
|
+
</span>
|
|
137
|
+
<i class="fa-solid fa-chevron-down mj-accordion-icon"></i>
|
|
138
|
+
</button>
|
|
139
|
+
@if (Expanded) {
|
|
140
|
+
<div class="mj-accordion-body" role="region">
|
|
141
|
+
<ng-content></ng-content>
|
|
142
|
+
</div>
|
|
143
|
+
}
|
|
144
|
+
</div>
|
|
145
|
+
`
|
|
146
|
+
}]
|
|
147
|
+
}], null, { Title: [{
|
|
148
|
+
type: Input
|
|
149
|
+
}], Expanded: [{
|
|
150
|
+
type: Input
|
|
151
|
+
}], Disabled: [{
|
|
152
|
+
type: Input
|
|
153
|
+
}], ExpandedChange: [{
|
|
154
|
+
type: Output
|
|
155
|
+
}], titleTemplate: [{
|
|
156
|
+
type: ContentChild,
|
|
157
|
+
args: [MJAccordionTitleDirective]
|
|
158
|
+
}], hostClass: [{
|
|
159
|
+
type: HostBinding,
|
|
160
|
+
args: ['class.mj-accordion-panel-host']
|
|
161
|
+
}] }); })();
|
|
162
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJAccordionPanelComponent, { className: "MJAccordionPanelComponent", filePath: "lib/accordion/accordion.component.ts", lineNumber: 77 }); })();
|
|
163
|
+
//# sourceMappingURL=accordion.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.component.js","sourceRoot":"","sources":["../../../src/lib/accordion/accordion.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAe,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;;;;IA4DvC,2BAA4E;;;IAA9D,mEAA8C;;;IAE5D,YACF;;;IADE,6CACF;;;IAKF,8BAA6C;IAC3C,kBAAyB;IAC3B,iBAAM;;AApEd;;;;;;;;;;;;;;GAcG;AAKH,MAAM,OAAO,yBAAyB;IACjB;IAAnB,YAAmB,WAAiC;QAAjC,gBAAW,GAAX,WAAW,CAAsB;IAAG,CAAC;mHAD7C,yBAAyB;6DAAzB,yBAAyB;;iFAAzB,yBAAyB;cAJrC,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;aACjB;;AAKD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AA4BH,MAAM,OAAO,yBAAyB;IAC3B,KAAK,GAAG,EAAE,CAAC;IACX,QAAQ,GAAG,KAAK,CAAC;IACjB,QAAQ,GAAG,KAAK,CAAC;IAChB,cAAc,GAAG,IAAI,YAAY,EAAW,CAAC;IACd,aAAa,GAAqC,IAAI,CAAC;IACzC,SAAS,GAAG,IAAI,CAAC;IAExE,MAAM;QACJ,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO;QAC1B,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;mHAZU,yBAAyB;6DAAzB,yBAAyB;wCAKtB,yBAAyB;;;;;YAL5B,wDAAyB;;;YArBhC,AADF,8BAAgI,gBAIzG;YAAnB,sGAAS,YAAQ,IAAC;YAClB,+BAAiC;YAG7B,AAFF,oGAAqB,2DAEZ;YAGX,iBAAO;YACP,uBAA0D;YAC5D,iBAAS;YACT,2FAAgB;YAKlB,iBAAM;;YAnB0E,AAAhD,4DAA+C,8CAAgD;YAG3H,cAAqB;YAArB,uCAAqB;;YAGnB,eAIC;YAJD,2CAIC;YAIL,eAIC;YAJD,uCAIC;4BApBK,gBAAgB;;iFAwBf,yBAAyB;cA3BrC,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,OAAO,EAAE,CAAC,gBAAgB,CAAC;gBAC3B,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;GAqBT;aACF;;kBAEE,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kBACN,YAAY;mBAAC,yBAAyB;;kBACtC,WAAW;mBAAC,+BAA+B;;kFANjC,yBAAyB","sourcesContent":["import { Component, Input, Output, EventEmitter, HostBinding, ContentChild, TemplateRef, Directive } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\n\n/**\n * Directive to mark a template as the accordion panel title.\n * Supports rich HTML content (icons, badges, dynamic text).\n *\n * @example\n * ```html\n * <mj-accordion-panel [Expanded]=\"true\">\n * <ng-template mjAccordionTitle>\n * <i class=\"fa-solid fa-code\"></i> Template Editor\n * <span class=\"badge\">3</span>\n * </ng-template>\n * <p>Panel content here</p>\n * </mj-accordion-panel>\n * ```\n */\n@Directive({\n selector: '[mjAccordionTitle]',\n standalone: true\n})\nexport class MJAccordionTitleDirective {\n constructor(public templateRef: TemplateRef<unknown>) {}\n}\n\n/**\n * mj-accordion-panel — Collapsible panel. Replaces `<kendo-panelbar-item>` and `<kendo-expansionpanel>`.\n *\n * Supports two title modes:\n * - Simple string: `[Title]=\"'Details'\"` — plain text title\n * - Rich template: `<ng-template mjAccordionTitle>` — HTML with icons, badges, etc.\n *\n * @example\n * ```html\n * <!-- Simple string title -->\n * <mj-accordion-panel Title=\"Details\" [Expanded]=\"true\">\n * <p>Panel content here</p>\n * </mj-accordion-panel>\n *\n * <!-- Rich HTML title -->\n * <mj-accordion-panel [Expanded]=\"true\">\n * <ng-template mjAccordionTitle>\n * <i class=\"fa-solid fa-code\"></i> Template Editor\n * </ng-template>\n * <p>Panel content here</p>\n * </mj-accordion-panel>\n * ```\n */\n@Component({\n selector: 'mj-accordion-panel',\n standalone: true,\n imports: [NgTemplateOutlet],\n template: `\n <div class=\"mj-accordion-panel\" [class.mj-accordion-panel--expanded]=\"Expanded\" [class.mj-accordion-panel--disabled]=\"Disabled\">\n <button class=\"mj-accordion-header\" type=\"button\"\n [attr.aria-expanded]=\"Expanded\"\n [disabled]=\"Disabled\"\n (click)=\"Toggle()\">\n <span class=\"mj-accordion-title\">\n @if (titleTemplate) {\n <ng-container [ngTemplateOutlet]=\"titleTemplate.templateRef\"></ng-container>\n } @else {\n {{ Title }}\n }\n </span>\n <i class=\"fa-solid fa-chevron-down mj-accordion-icon\"></i>\n </button>\n @if (Expanded) {\n <div class=\"mj-accordion-body\" role=\"region\">\n <ng-content></ng-content>\n </div>\n }\n </div>\n `\n})\nexport class MJAccordionPanelComponent {\n @Input() Title = '';\n @Input() Expanded = false;\n @Input() Disabled = false;\n @Output() ExpandedChange = new EventEmitter<boolean>();\n @ContentChild(MJAccordionTitleDirective) titleTemplate: MJAccordionTitleDirective | null = null;\n @HostBinding('class.mj-accordion-panel-host') readonly hostClass = true;\n\n Toggle(): void {\n if (this.Disabled) return;\n this.Expanded = !this.Expanded;\n this.ExpandedChange.emit(this.Expanded);\n }\n}\n"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MJ Accordion Panel Styles
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.mj-accordion-panel {
|
|
6
|
+
border: 1px solid var(--mj-border-default);
|
|
7
|
+
border-radius: var(--mj-radius-sm);
|
|
8
|
+
margin-bottom: 4px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.mj-accordion-header {
|
|
13
|
+
display: flex; align-items: center; justify-content: space-between;
|
|
14
|
+
width: 100%; padding: 12px 16px;
|
|
15
|
+
background: var(--mj-bg-surface-sunken); border: none; cursor: pointer;
|
|
16
|
+
font-family: var(--mj-font-family); font-size: var(--mj-text-sm);
|
|
17
|
+
font-weight: var(--mj-font-semibold); color: var(--mj-text-primary);
|
|
18
|
+
text-align: left; transition: background var(--mj-transition-fast);
|
|
19
|
+
&:hover { background: var(--mj-bg-surface-hover); }
|
|
20
|
+
&:focus-visible { outline: none; box-shadow: var(--mj-focus-ring); }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.mj-accordion-icon {
|
|
24
|
+
font-size: 0.75rem; color: var(--mj-text-muted);
|
|
25
|
+
transition: transform var(--mj-transition-base);
|
|
26
|
+
.mj-accordion-panel--expanded & { transform: rotate(180deg); }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.mj-accordion-body {
|
|
30
|
+
padding: 16px;
|
|
31
|
+
border-top: 1px solid var(--mj-border-default);
|
|
32
|
+
background: var(--mj-bg-surface);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.mj-accordion-title { flex: 1; }
|
|
36
|
+
|
|
37
|
+
.mj-accordion-panel--disabled .mj-accordion-header {
|
|
38
|
+
opacity: 0.5;
|
|
39
|
+
cursor: not-allowed;
|
|
40
|
+
&:hover { background: var(--mj-bg-surface-sunken); }
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@media (prefers-reduced-motion: reduce) {
|
|
44
|
+
.mj-accordion-icon { transition: none; }
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type MjButtonVariant = 'primary' | 'secondary' | 'outline' | 'flat' | 'danger' | 'icon' | 'success' | 'warning';
|
|
4
|
+
export type MjButtonSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/**
|
|
6
|
+
* mjButton — Attribute directive that styles a native `<button>` or `<a>` element
|
|
7
|
+
* as an MJ-branded button.
|
|
8
|
+
*
|
|
9
|
+
* Uses `--mj-*` design tokens for all colors, ensuring dark-mode support
|
|
10
|
+
* with zero extra CSS.
|
|
11
|
+
*
|
|
12
|
+
* Inputs use lowercase (not PascalCase) per the Phase 2 plan exception for
|
|
13
|
+
* directives — matches HTML attribute convention.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```html
|
|
17
|
+
* <button mjButton variant="primary" (click)="save()">Save</button>
|
|
18
|
+
* <button mjButton variant="outline" size="sm">Cancel</button>
|
|
19
|
+
* <button mjButton variant="flat" [toggleable]="true" [(selected)]="isActive">Toggle</button>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class MJButtonDirective {
|
|
23
|
+
variant: MjButtonVariant;
|
|
24
|
+
size: MjButtonSize;
|
|
25
|
+
toggleable: boolean;
|
|
26
|
+
selected: boolean;
|
|
27
|
+
selectedChange: EventEmitter<boolean>;
|
|
28
|
+
readonly baseClass = true;
|
|
29
|
+
get isPrimary(): boolean;
|
|
30
|
+
get isSecondary(): boolean;
|
|
31
|
+
get isOutline(): boolean;
|
|
32
|
+
get isFlat(): boolean;
|
|
33
|
+
get isDanger(): boolean;
|
|
34
|
+
get isIcon(): boolean;
|
|
35
|
+
get isSuccess(): boolean;
|
|
36
|
+
get isWarning(): boolean;
|
|
37
|
+
get isSm(): boolean;
|
|
38
|
+
get isLg(): boolean;
|
|
39
|
+
get isSelected(): boolean;
|
|
40
|
+
get ariaPressed(): string | null;
|
|
41
|
+
OnClick(): void;
|
|
42
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJButtonDirective, never>;
|
|
43
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MJButtonDirective, "button[mjButton], a[mjButton]", never, { "variant": { "alias": "variant"; "required": false; }; "size": { "alias": "size"; "required": false; }; "toggleable": { "alias": "toggleable"; "required": false; }; "selected": { "alias": "selected"; "required": false; }; }, { "selectedChange": "selectedChange"; }, never, never, true, never>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=button.directive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.directive.d.ts","sourceRoot":"","sources":["../../../src/lib/button/button.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAGb,MAAM,eAAe,CAAC;;AAEvB,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,WAAW,GACX,SAAS,GACT,MAAM,GACN,QAAQ,GACR,MAAM,GACN,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9C;;;;;;;;;;;;;;;;GAgBG;AACH,qBAIa,iBAAiB;IACnB,OAAO,EAAE,eAAe,CAAe;IACvC,IAAI,EAAE,YAAY,CAAQ;IAC1B,UAAU,UAAS;IACnB,QAAQ,UAAS;IAChB,cAAc,wBAA+B;IAE1B,QAAQ,CAAC,SAAS,QAAQ;IAEvD,IAA0C,SAAS,YAAyC;IAC5F,IAA4C,WAAW,YAA2C;IAClG,IAA0C,SAAS,YAAyC;IAC5F,IAAuC,MAAM,YAAsC;IACnF,IAAyC,QAAQ,YAAwC;IACzF,IAAuC,MAAM,YAAsC;IACnF,IAA0C,SAAS,YAAyC;IAC5F,IAA0C,SAAS,YAAyC;IAE5F,IAAqC,IAAI,YAAiC;IAC1E,IAAqC,IAAI,YAAiC;IAE1E,IAA2C,UAAU,YAA+C;IACpG,IAAsC,WAAW,IAAI,MAAM,GAAG,IAAI,CAEjE;IAGD,OAAO,IAAI,IAAI;yCA3BJ,iBAAiB;2CAAjB,iBAAiB;CAiC7B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Directive, Input, Output, EventEmitter, HostBinding, HostListener } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* mjButton — Attribute directive that styles a native `<button>` or `<a>` element
|
|
5
|
+
* as an MJ-branded button.
|
|
6
|
+
*
|
|
7
|
+
* Uses `--mj-*` design tokens for all colors, ensuring dark-mode support
|
|
8
|
+
* with zero extra CSS.
|
|
9
|
+
*
|
|
10
|
+
* Inputs use lowercase (not PascalCase) per the Phase 2 plan exception for
|
|
11
|
+
* directives — matches HTML attribute convention.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```html
|
|
15
|
+
* <button mjButton variant="primary" (click)="save()">Save</button>
|
|
16
|
+
* <button mjButton variant="outline" size="sm">Cancel</button>
|
|
17
|
+
* <button mjButton variant="flat" [toggleable]="true" [(selected)]="isActive">Toggle</button>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export class MJButtonDirective {
|
|
21
|
+
variant = 'secondary';
|
|
22
|
+
size = 'md';
|
|
23
|
+
toggleable = false;
|
|
24
|
+
selected = false;
|
|
25
|
+
selectedChange = new EventEmitter();
|
|
26
|
+
baseClass = true;
|
|
27
|
+
get isPrimary() { return this.variant === 'primary'; }
|
|
28
|
+
get isSecondary() { return this.variant === 'secondary'; }
|
|
29
|
+
get isOutline() { return this.variant === 'outline'; }
|
|
30
|
+
get isFlat() { return this.variant === 'flat'; }
|
|
31
|
+
get isDanger() { return this.variant === 'danger'; }
|
|
32
|
+
get isIcon() { return this.variant === 'icon'; }
|
|
33
|
+
get isSuccess() { return this.variant === 'success'; }
|
|
34
|
+
get isWarning() { return this.variant === 'warning'; }
|
|
35
|
+
get isSm() { return this.size === 'sm'; }
|
|
36
|
+
get isLg() { return this.size === 'lg'; }
|
|
37
|
+
get isSelected() { return this.toggleable && this.selected; }
|
|
38
|
+
get ariaPressed() {
|
|
39
|
+
return this.toggleable ? String(this.selected) : null;
|
|
40
|
+
}
|
|
41
|
+
OnClick() {
|
|
42
|
+
if (this.toggleable) {
|
|
43
|
+
this.selected = !this.selected;
|
|
44
|
+
this.selectedChange.emit(this.selected);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
static ɵfac = function MJButtonDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJButtonDirective)(); };
|
|
48
|
+
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MJButtonDirective, selectors: [["button", "mjButton", ""], ["a", "mjButton", ""]], hostVars: 25, hostBindings: function MJButtonDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
49
|
+
i0.ɵɵlistener("click", function MJButtonDirective_click_HostBindingHandler() { return ctx.OnClick(); });
|
|
50
|
+
} if (rf & 2) {
|
|
51
|
+
i0.ɵɵattribute("aria-pressed", ctx.ariaPressed);
|
|
52
|
+
i0.ɵɵclassProp("mj-btn", ctx.baseClass)("mj-btn--primary", ctx.isPrimary)("mj-btn--secondary", ctx.isSecondary)("mj-btn--outline", ctx.isOutline)("mj-btn--flat", ctx.isFlat)("mj-btn--danger", ctx.isDanger)("mj-btn--icon", ctx.isIcon)("mj-btn--success", ctx.isSuccess)("mj-btn--warning", ctx.isWarning)("mj-btn--sm", ctx.isSm)("mj-btn--lg", ctx.isLg)("mj-btn--selected", ctx.isSelected);
|
|
53
|
+
} }, inputs: { variant: "variant", size: "size", toggleable: "toggleable", selected: "selected" }, outputs: { selectedChange: "selectedChange" } });
|
|
54
|
+
}
|
|
55
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJButtonDirective, [{
|
|
56
|
+
type: Directive,
|
|
57
|
+
args: [{
|
|
58
|
+
selector: 'button[mjButton], a[mjButton]',
|
|
59
|
+
standalone: true
|
|
60
|
+
}]
|
|
61
|
+
}], null, { variant: [{
|
|
62
|
+
type: Input
|
|
63
|
+
}], size: [{
|
|
64
|
+
type: Input
|
|
65
|
+
}], toggleable: [{
|
|
66
|
+
type: Input
|
|
67
|
+
}], selected: [{
|
|
68
|
+
type: Input
|
|
69
|
+
}], selectedChange: [{
|
|
70
|
+
type: Output
|
|
71
|
+
}], baseClass: [{
|
|
72
|
+
type: HostBinding,
|
|
73
|
+
args: ['class.mj-btn']
|
|
74
|
+
}], isPrimary: [{
|
|
75
|
+
type: HostBinding,
|
|
76
|
+
args: ['class.mj-btn--primary']
|
|
77
|
+
}], isSecondary: [{
|
|
78
|
+
type: HostBinding,
|
|
79
|
+
args: ['class.mj-btn--secondary']
|
|
80
|
+
}], isOutline: [{
|
|
81
|
+
type: HostBinding,
|
|
82
|
+
args: ['class.mj-btn--outline']
|
|
83
|
+
}], isFlat: [{
|
|
84
|
+
type: HostBinding,
|
|
85
|
+
args: ['class.mj-btn--flat']
|
|
86
|
+
}], isDanger: [{
|
|
87
|
+
type: HostBinding,
|
|
88
|
+
args: ['class.mj-btn--danger']
|
|
89
|
+
}], isIcon: [{
|
|
90
|
+
type: HostBinding,
|
|
91
|
+
args: ['class.mj-btn--icon']
|
|
92
|
+
}], isSuccess: [{
|
|
93
|
+
type: HostBinding,
|
|
94
|
+
args: ['class.mj-btn--success']
|
|
95
|
+
}], isWarning: [{
|
|
96
|
+
type: HostBinding,
|
|
97
|
+
args: ['class.mj-btn--warning']
|
|
98
|
+
}], isSm: [{
|
|
99
|
+
type: HostBinding,
|
|
100
|
+
args: ['class.mj-btn--sm']
|
|
101
|
+
}], isLg: [{
|
|
102
|
+
type: HostBinding,
|
|
103
|
+
args: ['class.mj-btn--lg']
|
|
104
|
+
}], isSelected: [{
|
|
105
|
+
type: HostBinding,
|
|
106
|
+
args: ['class.mj-btn--selected']
|
|
107
|
+
}], ariaPressed: [{
|
|
108
|
+
type: HostBinding,
|
|
109
|
+
args: ['attr.aria-pressed']
|
|
110
|
+
}], OnClick: [{
|
|
111
|
+
type: HostListener,
|
|
112
|
+
args: ['click']
|
|
113
|
+
}] }); })();
|
|
114
|
+
//# sourceMappingURL=button.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.directive.js","sourceRoot":"","sources":["../../../src/lib/button/button.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;;AAcvB;;;;;;;;;;;;;;;;GAgBG;AAKH,MAAM,OAAO,iBAAiB;IACnB,OAAO,GAAoB,WAAW,CAAC;IACvC,IAAI,GAAiB,IAAI,CAAC;IAC1B,UAAU,GAAG,KAAK,CAAC;IACnB,QAAQ,GAAG,KAAK,CAAC;IAChB,cAAc,GAAG,IAAI,YAAY,EAAW,CAAC;IAEjB,SAAS,GAAG,IAAI,CAAC;IAEvD,IAA0C,SAAS,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;IAC5F,IAA4C,WAAW,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC;IAClG,IAA0C,SAAS,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;IAC5F,IAAuC,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC;IACnF,IAAyC,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC;IACzF,IAAuC,MAAM,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC;IACnF,IAA0C,SAAS,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;IAC5F,IAA0C,SAAS,KAAK,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC;IAE5F,IAAqC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAC1E,IAAqC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC;IAE1E,IAA2C,UAAU,KAAK,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpG,IAAsC,WAAW;QAC/C,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxD,CAAC;IAGD,OAAO;QACL,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;2GAhCU,iBAAiB;6DAAjB,iBAAiB;YAAjB,sFAAA,aAAS,IAAQ;;;YAAjB,uCAAiB,kCAAA,sCAAA,kCAAA,4BAAA,gCAAA,4BAAA,kCAAA,kCAAA,wBAAA,wBAAA,oCAAA;;;iFAAjB,iBAAiB;cAJ7B,SAAS;eAAC;gBACT,QAAQ,EAAE,+BAA+B;gBACzC,UAAU,EAAE,IAAI;aACjB;;kBAEE,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,MAAM;;kBAEN,WAAW;mBAAC,cAAc;;kBAE1B,WAAW;mBAAC,uBAAuB;;kBACnC,WAAW;mBAAC,yBAAyB;;kBACrC,WAAW;mBAAC,uBAAuB;;kBACnC,WAAW;mBAAC,oBAAoB;;kBAChC,WAAW;mBAAC,sBAAsB;;kBAClC,WAAW;mBAAC,oBAAoB;;kBAChC,WAAW;mBAAC,uBAAuB;;kBACnC,WAAW;mBAAC,uBAAuB;;kBAEnC,WAAW;mBAAC,kBAAkB;;kBAC9B,WAAW;mBAAC,kBAAkB;;kBAE9B,WAAW;mBAAC,wBAAwB;;kBACpC,WAAW;mBAAC,mBAAmB;;kBAI/B,YAAY;mBAAC,OAAO","sourcesContent":["import {\n Directive,\n Input,\n Output,\n EventEmitter,\n HostBinding,\n HostListener\n} from '@angular/core';\n\nexport type MjButtonVariant =\n | 'primary'\n | 'secondary'\n | 'outline'\n | 'flat'\n | 'danger'\n | 'icon'\n | 'success'\n | 'warning';\n\nexport type MjButtonSize = 'sm' | 'md' | 'lg';\n\n/**\n * mjButton — Attribute directive that styles a native `<button>` or `<a>` element\n * as an MJ-branded button.\n *\n * Uses `--mj-*` design tokens for all colors, ensuring dark-mode support\n * with zero extra CSS.\n *\n * Inputs use lowercase (not PascalCase) per the Phase 2 plan exception for\n * directives — matches HTML attribute convention.\n *\n * @example\n * ```html\n * <button mjButton variant=\"primary\" (click)=\"save()\">Save</button>\n * <button mjButton variant=\"outline\" size=\"sm\">Cancel</button>\n * <button mjButton variant=\"flat\" [toggleable]=\"true\" [(selected)]=\"isActive\">Toggle</button>\n * ```\n */\n@Directive({\n selector: 'button[mjButton], a[mjButton]',\n standalone: true\n})\nexport class MJButtonDirective {\n @Input() variant: MjButtonVariant = 'secondary';\n @Input() size: MjButtonSize = 'md';\n @Input() toggleable = false;\n @Input() selected = false;\n @Output() selectedChange = new EventEmitter<boolean>();\n\n @HostBinding('class.mj-btn') readonly baseClass = true;\n\n @HostBinding('class.mj-btn--primary') get isPrimary() { return this.variant === 'primary'; }\n @HostBinding('class.mj-btn--secondary') get isSecondary() { return this.variant === 'secondary'; }\n @HostBinding('class.mj-btn--outline') get isOutline() { return this.variant === 'outline'; }\n @HostBinding('class.mj-btn--flat') get isFlat() { return this.variant === 'flat'; }\n @HostBinding('class.mj-btn--danger') get isDanger() { return this.variant === 'danger'; }\n @HostBinding('class.mj-btn--icon') get isIcon() { return this.variant === 'icon'; }\n @HostBinding('class.mj-btn--success') get isSuccess() { return this.variant === 'success'; }\n @HostBinding('class.mj-btn--warning') get isWarning() { return this.variant === 'warning'; }\n\n @HostBinding('class.mj-btn--sm') get isSm() { return this.size === 'sm'; }\n @HostBinding('class.mj-btn--lg') get isLg() { return this.size === 'lg'; }\n\n @HostBinding('class.mj-btn--selected') get isSelected() { return this.toggleable && this.selected; }\n @HostBinding('attr.aria-pressed') get ariaPressed(): string | null {\n return this.toggleable ? String(this.selected) : null;\n }\n\n @HostListener('click')\n OnClick(): void {\n if (this.toggleable) {\n this.selected = !this.selected;\n this.selectedChange.emit(this.selected);\n }\n }\n}\n"]}
|