@memberjunction/ng-ui-components 6.2.0-edge.3 → 6.2.0-edge.4
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/README.md +1 -1
- package/dist/lib/accordion/accordion.component.d.ts +14 -4
- package/dist/lib/accordion/accordion.component.d.ts.map +1 -1
- package/dist/lib/accordion/accordion.component.js +96 -46
- package/dist/lib/accordion/accordion.component.js.map +1 -1
- package/dist/lib/accordion/accordion.scss +54 -5
- package/dist/lib/button/button.directive.d.ts +27 -15
- package/dist/lib/button/button.directive.d.ts.map +1 -1
- package/dist/lib/button/button.directive.js +34 -19
- package/dist/lib/button/button.directive.js.map +1 -1
- package/dist/lib/button/button.scss +35 -0
- package/dist/lib/dropdown/dropdown.component.d.ts +22 -0
- package/dist/lib/dropdown/dropdown.component.d.ts.map +1 -1
- package/dist/lib/dropdown/dropdown.component.js +43 -6
- package/dist/lib/dropdown/dropdown.component.js.map +1 -1
- package/dist/lib/menu/menu.component.d.ts +64 -0
- package/dist/lib/menu/menu.component.d.ts.map +1 -0
- package/dist/lib/menu/menu.component.js +149 -0
- package/dist/lib/menu/menu.component.js.map +1 -0
- package/dist/public-api.d.ts +1 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +1 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,21 +7,22 @@ import * as i0 from "@angular/core";
|
|
|
7
7
|
* Uses `--mj-*` design tokens for all colors, ensuring dark-mode support
|
|
8
8
|
* with zero extra CSS.
|
|
9
9
|
*
|
|
10
|
-
* Inputs
|
|
11
|
-
*
|
|
10
|
+
* Inputs are PascalCase. The lowercase names (`variant`, `size`, `toggleable`, `selected`,
|
|
11
|
+
* `ariaLabel`) are deprecated aliases.
|
|
12
12
|
*
|
|
13
|
-
* Accessibility: an **icon-only** button (`
|
|
14
|
-
* name unless you supply one — set `[
|
|
15
|
-
* readers announce it as an unlabeled "button" and DOM/accessibility-tree agents (e.g.
|
|
16
|
-
* can't identify it. In dev mode the directive logs a warning for an icon button
|
|
17
|
-
* no accessible name.
|
|
13
|
+
* Accessibility: an **icon-only** button (`Variant="icon"` or `Shape="circle"`, no visible text) has
|
|
14
|
+
* no accessible name unless you supply one — set `[AriaLabel]` (or a native `title`). Without a name,
|
|
15
|
+
* screen readers announce it as an unlabeled "button" and DOM/accessibility-tree agents (e.g.
|
|
16
|
+
* computer-use) can't identify it. In dev mode the directive logs a warning for an icon-only button
|
|
17
|
+
* that ends up with no accessible name.
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```html
|
|
21
|
-
* <button mjButton
|
|
22
|
-
* <button mjButton
|
|
23
|
-
* <button mjButton
|
|
24
|
-
* <button mjButton
|
|
21
|
+
* <button mjButton Variant="primary" (click)="save()">Save</button>
|
|
22
|
+
* <button mjButton Variant="outline" Size="sm">Cancel</button>
|
|
23
|
+
* <button mjButton Variant="icon" AriaLabel="Remove" (click)="remove()"><i class="fa-solid fa-xmark"></i></button>
|
|
24
|
+
* <button mjButton Variant="danger" Shape="circle" AriaLabel="Unmute microphone"><i class="fa-solid fa-microphone-slash"></i></button>
|
|
25
|
+
* <button mjButton Variant="flat" [Toggleable]="true" [(Selected)]="isActive">Toggle</button>
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export class MJButtonDirective {
|
|
@@ -44,6 +45,13 @@ export class MJButtonDirective {
|
|
|
44
45
|
get size() {
|
|
45
46
|
return this.Size;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* `circle` makes the button a circle, as wide as it is tall: 32, 44 or 52 px by {@link Size}. It suits call
|
|
50
|
+
* controls (microphone, camera, share, leave) and combines with any {@link Variant}, such as `danger` for a muted
|
|
51
|
+
* microphone. A circle has room for an icon only, so name it with {@link AriaLabel}; dev mode warns when it has no
|
|
52
|
+
* name, as it does for the `icon` variant.
|
|
53
|
+
*/
|
|
54
|
+
Shape = 'default';
|
|
47
55
|
Toggleable = false;
|
|
48
56
|
/** @deprecated Use {@link Toggleable}. */
|
|
49
57
|
set toggleable(value) {
|
|
@@ -110,6 +118,7 @@ export class MJButtonDirective {
|
|
|
110
118
|
get isWarning() { return this.Variant === 'warning'; }
|
|
111
119
|
get isSm() { return this.Size === 'sm'; }
|
|
112
120
|
get isLg() { return this.Size === 'lg'; }
|
|
121
|
+
get isCircle() { return this.Shape === 'circle'; }
|
|
113
122
|
get isSelected() { return this.Toggleable && this.Selected; }
|
|
114
123
|
get ariaPressed() {
|
|
115
124
|
return this.Toggleable ? String(this.Selected) : null;
|
|
@@ -121,12 +130,13 @@ export class MJButtonDirective {
|
|
|
121
130
|
}
|
|
122
131
|
}
|
|
123
132
|
/**
|
|
124
|
-
* Dev-only guard: an icon-
|
|
125
|
-
* `aria-labelledby`/`title` and no visible text) is
|
|
126
|
-
* agents. Warn so it gets a name. No-op in production
|
|
133
|
+
* Dev-only guard: an icon-only button (the `icon` variant or the `circle` shape) with no accessible
|
|
134
|
+
* name (no `ariaLabel`/`aria-label`/`aria-labelledby`/`title` and no visible text) is
|
|
135
|
+
* invisible-by-name to screen readers and DOM agents. Warn so it gets a name. No-op in production
|
|
136
|
+
* builds.
|
|
127
137
|
*/
|
|
128
138
|
ngAfterContentInit() {
|
|
129
|
-
if (!isDevMode() || this.Variant !== 'icon') {
|
|
139
|
+
if (!isDevMode() || (this.Variant !== 'icon' && this.Shape !== 'circle')) {
|
|
130
140
|
return;
|
|
131
141
|
}
|
|
132
142
|
const el = this.host.nativeElement;
|
|
@@ -136,17 +146,17 @@ export class MJButtonDirective {
|
|
|
136
146
|
el.getAttribute('title') ||
|
|
137
147
|
(el.textContent ?? '').trim().length > 0);
|
|
138
148
|
if (!hasAccessibleName) {
|
|
139
|
-
console.warn('[mjButton] icon-only button has no accessible name — add [
|
|
149
|
+
console.warn('[mjButton] icon-only button has no accessible name — add [AriaLabel]="…" (or a title) so ' +
|
|
140
150
|
'screen readers and computer-use agents can identify it.', el);
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
153
|
static ɵfac = function MJButtonDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJButtonDirective)(i0.ɵɵdirectiveInject(i0.ElementRef)); };
|
|
144
|
-
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MJButtonDirective, selectors: [["button", "mjButton", ""], ["a", "mjButton", ""]], hostVars:
|
|
154
|
+
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: MJButtonDirective, selectors: [["button", "mjButton", ""], ["a", "mjButton", ""]], hostVars: 27, hostBindings: function MJButtonDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
145
155
|
i0.ɵɵlistener("click", function MJButtonDirective_click_HostBindingHandler() { return ctx.OnClick(); });
|
|
146
156
|
} if (rf & 2) {
|
|
147
157
|
i0.ɵɵattribute("aria-pressed", ctx.ariaPressed);
|
|
148
|
-
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);
|
|
149
|
-
} }, inputs: { Variant: "Variant", variant: "variant", Size: "Size", size: "size", Toggleable: "Toggleable", toggleable: "toggleable", Selected: "Selected", selected: "selected", AriaLabel: "AriaLabel", ariaLabel: "ariaLabel" }, outputs: { SelectedChange: "SelectedChange", selectedChange: "selectedChange" } });
|
|
158
|
+
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--circle", ctx.isCircle)("mj-btn--selected", ctx.isSelected);
|
|
159
|
+
} }, inputs: { Variant: "Variant", variant: "variant", Size: "Size", size: "size", Shape: "Shape", Toggleable: "Toggleable", toggleable: "toggleable", Selected: "Selected", selected: "selected", AriaLabel: "AriaLabel", ariaLabel: "ariaLabel" }, outputs: { SelectedChange: "SelectedChange", selectedChange: "selectedChange" } });
|
|
150
160
|
}
|
|
151
161
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJButtonDirective, [{
|
|
152
162
|
type: Directive,
|
|
@@ -162,6 +172,8 @@ export class MJButtonDirective {
|
|
|
162
172
|
type: Input
|
|
163
173
|
}], size: [{
|
|
164
174
|
type: Input
|
|
175
|
+
}], Shape: [{
|
|
176
|
+
type: Input
|
|
165
177
|
}], Toggleable: [{
|
|
166
178
|
type: Input
|
|
167
179
|
}], toggleable: [{
|
|
@@ -211,6 +223,9 @@ export class MJButtonDirective {
|
|
|
211
223
|
}], isLg: [{
|
|
212
224
|
type: HostBinding,
|
|
213
225
|
args: ['class.mj-btn--lg']
|
|
226
|
+
}], isCircle: [{
|
|
227
|
+
type: HostBinding,
|
|
228
|
+
args: ['class.mj-btn--circle']
|
|
214
229
|
}], isSelected: [{
|
|
215
230
|
type: HostBinding,
|
|
216
231
|
args: ['class.mj-btn--selected']
|
|
@@ -1 +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,EAGZ,SAAS,EACV,MAAM,eAAe,CAAC;;AAcvB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,MAAM,OAAO,iBAAiB;IAsDC;IArDpB,OAAO,GAAoB,WAA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EAAE,IAAI;aACjB;;kBAEE,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAOL,MAAM;;kBASN,MAAM;;kBAWN,KAAK;;kBAgBL,KAAK;;kBAKL,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 ElementRef,\n AfterContentInit,\n isDevMode\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 * Accessibility: an **icon-only** button (`variant=\"icon\"`, no visible text) has no accessible\n * name unless you supply one — set `[ariaLabel]` (or a native `title`). Without a name, screen\n * readers announce it as an unlabeled \"button\" and DOM/accessibility-tree agents (e.g. computer-use)\n * can't identify it. In dev mode the directive logs a warning for an icon button that ends up with\n * no accessible name.\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=\"icon\" ariaLabel=\"Remove\" (click)=\"remove()\"><i class=\"fa-solid fa-xmark\"></i></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 implements AfterContentInit {\n @Input() Variant: MjButtonVariant = 'secondary';\n\n /** @deprecated Use {@link Variant}. */\n @Input() set variant(value: MjButtonVariant) {\n this.Variant = value;\n }\n /** @deprecated Use {@link Variant}. */\n get variant(): MjButtonVariant {\n return this.Variant;\n }\n @Input() Size: MjButtonSize = 'md';\n\n /** @deprecated Use {@link Size}. */\n @Input() set size(value: MjButtonSize) {\n this.Size = value;\n }\n /** @deprecated Use {@link Size}. */\n get size(): MjButtonSize {\n return this.Size;\n }\n @Input() Toggleable = false;\n\n /** @deprecated Use {@link Toggleable}. */\n @Input() set toggleable(value: MJButtonDirective['Toggleable']) {\n this.Toggleable = value;\n }\n /** @deprecated Use {@link Toggleable}. */\n get toggleable(): MJButtonDirective['Toggleable'] {\n return this.Toggleable;\n }\n @Input() Selected = false;\n\n /** @deprecated Use {@link Selected}. */\n @Input() set selected(value: MJButtonDirective['Selected']) {\n this.Selected = value;\n }\n /** @deprecated Use {@link Selected}. */\n get selected(): MJButtonDirective['Selected'] {\n return this.Selected;\n }\n @Output() SelectedChange = new EventEmitter<boolean>();\n\n /**\n * @deprecated Use {@link SelectedChange}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (selectedChange) keeps working. Must stay AFTER SelectedChange: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() selectedChange = this.SelectedChange;\n\n // Constructor injection (not inject()) so the directive can be unit-tested via direct\n // instantiation with a stub ElementRef — the established pattern in this package's specs.\n constructor(private readonly host: ElementRef<HTMLElement>) {}\n\n /**\n * Accessible name for the button, surfaced as `aria-label`. Primarily for **icon-only** buttons\n * (which otherwise have no name). Applied via `setAttribute` only when set, so a directly-authored\n * `aria-label=\"...\"` on the element is never clobbered.\n */\n @Input()\n set AriaLabel(value: string | null | undefined) {\n this._ariaLabel = value ?? undefined;\n if (this._ariaLabel) {\n this.host.nativeElement.setAttribute('aria-label', this._ariaLabel);\n }\n }\n get AriaLabel(): string | undefined {\n return this._ariaLabel;\n }\n\n /** @deprecated Use {@link AriaLabel}. */\n get ariaLabel(): string | undefined {\n return this.AriaLabel;\n }\n /** @deprecated Use {@link AriaLabel}. */\n @Input() set ariaLabel(value: string | null | undefined) {\n this.AriaLabel = value;\n }\n private _ariaLabel?: string;\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 /**\n * Dev-only guard: an icon-variant button with no accessible name (no `ariaLabel`/`aria-label`/\n * `aria-labelledby`/`title` and no visible text) is invisible-by-name to screen readers and DOM\n * agents. Warn so it gets a name. No-op in production builds.\n */\n ngAfterContentInit(): void {\n if (!isDevMode() || this.Variant !== 'icon') {\n return;\n }\n const el = this.host.nativeElement;\n const hasAccessibleName = !!(\n this._ariaLabel ||\n el.getAttribute('aria-label') ||\n el.getAttribute('aria-labelledby') ||\n el.getAttribute('title') ||\n (el.textContent ?? '').trim().length > 0\n );\n if (!hasAccessibleName) {\n console.warn(\n '[mjButton] icon-only button has no accessible name — add [ariaLabel]=\"…\" (or a title) so ' +\n 'screen readers and computer-use agents can identify it.',\n el\n );\n }\n }\n}\n"]}
|
|
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,EAGZ,SAAS,EACV,MAAM,eAAe,CAAC;;AAiBvB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,MAAM,OAAO,iBAAiB;IA+DC;IA9DpB,OAAO,GAAoB,WAAW,CAAC;IAEhD,uCAAuC;IACvC,IAAa,OAAO,CAAC,KAAsB;QACzC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IACD,uCAAuC;IACvC,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACQ,IAAI,GAAiB,IAAI,CAAC;IAEnC,oCAAoC;IACpC,IAAa,IAAI,CAAC,KAAmB;QACnC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;IACpB,CAAC;IACD,oCAAoC;IACpC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACM,KAAK,GAAkB,SAAS,CAAC;IAEjC,UAAU,GAAG,KAAK,CAAC;IAE5B,0CAA0C;IAC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W;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,sBAAsB;;kBAElC,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 ElementRef,\n AfterContentInit,\n isDevMode\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/** `default` is the rounded rectangle; `circle` is a circle for an icon-only button. */\nexport type MjButtonShape = 'default' | 'circle';\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 are PascalCase. The lowercase names (`variant`, `size`, `toggleable`, `selected`,\n * `ariaLabel`) are deprecated aliases.\n *\n * Accessibility: an **icon-only** button (`Variant=\"icon\"` or `Shape=\"circle\"`, no visible text) has\n * no accessible name unless you supply one — set `[AriaLabel]` (or a native `title`). Without a name,\n * screen readers announce it as an unlabeled \"button\" and DOM/accessibility-tree agents (e.g.\n * computer-use) can't identify it. In dev mode the directive logs a warning for an icon-only button\n * that ends up with no accessible name.\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=\"icon\" AriaLabel=\"Remove\" (click)=\"remove()\"><i class=\"fa-solid fa-xmark\"></i></button>\n * <button mjButton Variant=\"danger\" Shape=\"circle\" AriaLabel=\"Unmute microphone\"><i class=\"fa-solid fa-microphone-slash\"></i></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 implements AfterContentInit {\n @Input() Variant: MjButtonVariant = 'secondary';\n\n /** @deprecated Use {@link Variant}. */\n @Input() set variant(value: MjButtonVariant) {\n this.Variant = value;\n }\n /** @deprecated Use {@link Variant}. */\n get variant(): MjButtonVariant {\n return this.Variant;\n }\n @Input() Size: MjButtonSize = 'md';\n\n /** @deprecated Use {@link Size}. */\n @Input() set size(value: MjButtonSize) {\n this.Size = value;\n }\n /** @deprecated Use {@link Size}. */\n get size(): MjButtonSize {\n return this.Size;\n }\n\n /**\n * `circle` makes the button a circle, as wide as it is tall: 32, 44 or 52 px by {@link Size}. It suits call\n * controls (microphone, camera, share, leave) and combines with any {@link Variant}, such as `danger` for a muted\n * microphone. A circle has room for an icon only, so name it with {@link AriaLabel}; dev mode warns when it has no\n * name, as it does for the `icon` variant.\n */\n @Input() Shape: MjButtonShape = 'default';\n\n @Input() Toggleable = false;\n\n /** @deprecated Use {@link Toggleable}. */\n @Input() set toggleable(value: MJButtonDirective['Toggleable']) {\n this.Toggleable = value;\n }\n /** @deprecated Use {@link Toggleable}. */\n get toggleable(): MJButtonDirective['Toggleable'] {\n return this.Toggleable;\n }\n @Input() Selected = false;\n\n /** @deprecated Use {@link Selected}. */\n @Input() set selected(value: MJButtonDirective['Selected']) {\n this.Selected = value;\n }\n /** @deprecated Use {@link Selected}. */\n get selected(): MJButtonDirective['Selected'] {\n return this.Selected;\n }\n @Output() SelectedChange = new EventEmitter<boolean>();\n\n /**\n * @deprecated Use {@link SelectedChange}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (selectedChange) keeps working. Must stay AFTER SelectedChange: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() selectedChange = this.SelectedChange;\n\n // Constructor injection (not inject()) so the directive can be unit-tested via direct\n // instantiation with a stub ElementRef — the established pattern in this package's specs.\n constructor(private readonly host: ElementRef<HTMLElement>) {}\n\n /**\n * Accessible name for the button, surfaced as `aria-label`. Primarily for **icon-only** buttons\n * (which otherwise have no name). Applied via `setAttribute` only when set, so a directly-authored\n * `aria-label=\"...\"` on the element is never clobbered.\n */\n @Input()\n set AriaLabel(value: string | null | undefined) {\n this._ariaLabel = value ?? undefined;\n if (this._ariaLabel) {\n this.host.nativeElement.setAttribute('aria-label', this._ariaLabel);\n }\n }\n get AriaLabel(): string | undefined {\n return this._ariaLabel;\n }\n\n /** @deprecated Use {@link AriaLabel}. */\n get ariaLabel(): string | undefined {\n return this.AriaLabel;\n }\n /** @deprecated Use {@link AriaLabel}. */\n @Input() set ariaLabel(value: string | null | undefined) {\n this.AriaLabel = value;\n }\n private _ariaLabel?: string;\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--circle') get isCircle() { return this.Shape === 'circle'; }\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 /**\n * Dev-only guard: an icon-only button (the `icon` variant or the `circle` shape) with no accessible\n * name (no `ariaLabel`/`aria-label`/`aria-labelledby`/`title` and no visible text) is\n * invisible-by-name to screen readers and DOM agents. Warn so it gets a name. No-op in production\n * builds.\n */\n ngAfterContentInit(): void {\n if (!isDevMode() || (this.Variant !== 'icon' && this.Shape !== 'circle')) {\n return;\n }\n const el = this.host.nativeElement;\n const hasAccessibleName = !!(\n this._ariaLabel ||\n el.getAttribute('aria-label') ||\n el.getAttribute('aria-labelledby') ||\n el.getAttribute('title') ||\n (el.textContent ?? '').trim().length > 0\n );\n if (!hasAccessibleName) {\n console.warn(\n '[mjButton] icon-only button has no accessible name — add [AriaLabel]=\"…\" (or a title) so ' +\n 'screen readers and computer-use agents can identify it.',\n el\n );\n }\n }\n}\n"]}
|
|
@@ -212,6 +212,32 @@
|
|
|
212
212
|
gap: 10px;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
/* ========== Shapes ========== */
|
|
216
|
+
|
|
217
|
+
/* A circle for an icon-only button, such as a call control: as wide as it is tall at each size.
|
|
218
|
+
After the sizes and variants, so its zero padding wins over theirs. */
|
|
219
|
+
.mj-btn--circle {
|
|
220
|
+
box-sizing: border-box;
|
|
221
|
+
width: 44px;
|
|
222
|
+
height: 44px;
|
|
223
|
+
min-width: 44px;
|
|
224
|
+
padding: 0;
|
|
225
|
+
border-radius: var(--mj-radius-full);
|
|
226
|
+
|
|
227
|
+
&.mj-btn--sm {
|
|
228
|
+
width: 32px;
|
|
229
|
+
height: 32px;
|
|
230
|
+
min-width: 32px;
|
|
231
|
+
min-height: 32px;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
&.mj-btn--lg {
|
|
235
|
+
width: 52px;
|
|
236
|
+
height: 52px;
|
|
237
|
+
min-width: 52px;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
215
241
|
/* ========== Toggleable ========== */
|
|
216
242
|
.mj-btn--selected {
|
|
217
243
|
background: var(--mj-brand-primary);
|
|
@@ -251,4 +277,13 @@
|
|
|
251
277
|
min-height: 44px;
|
|
252
278
|
padding: 10px 12px;
|
|
253
279
|
}
|
|
280
|
+
|
|
281
|
+
/* A small circle grows to the same 44 px target and stays a circle. */
|
|
282
|
+
.mj-btn--circle.mj-btn--sm {
|
|
283
|
+
width: 44px;
|
|
284
|
+
height: 44px;
|
|
285
|
+
min-width: 44px;
|
|
286
|
+
min-height: 44px;
|
|
287
|
+
padding: 0;
|
|
288
|
+
}
|
|
254
289
|
}
|
|
@@ -12,6 +12,9 @@ import * as i0 from "@angular/core";
|
|
|
12
12
|
* what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —
|
|
13
13
|
* `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.
|
|
14
14
|
*
|
|
15
|
+
* Escape with the list open closes the list and goes no further, so a dialog or popover around the
|
|
16
|
+
* field stays open. With the list closed, Escape goes on to the host as usual.
|
|
17
|
+
*
|
|
15
18
|
* @example With a visible label (preferred)
|
|
16
19
|
* ```html
|
|
17
20
|
* <span id="persona-label">Interview persona</span>
|
|
@@ -132,7 +135,26 @@ export declare class MJDropdownComponent extends MJNamedControlBase implements C
|
|
|
132
135
|
SelectItem(item: unknown | null, event?: Event): void;
|
|
133
136
|
IsItemSelected(item: unknown): boolean;
|
|
134
137
|
OnFilterInput(event: Event): void;
|
|
138
|
+
/**
|
|
139
|
+
* Keys pressed in the field or in the filter box. Escape with the list open closes the list and
|
|
140
|
+
* stops the key there (see `closeListOnEscape`). With the list closed, Escape is cancelled as
|
|
141
|
+
* before and goes on to the host, so a dialog or popover around the field still closes on it.
|
|
142
|
+
*/
|
|
135
143
|
OnKeyDown(event: KeyboardEvent): void;
|
|
144
|
+
/**
|
|
145
|
+
* Keys the open list's overlay receives. The overlay listens on the page body, so this sees a
|
|
146
|
+
* key that did not go through the field or the filter box, for example after a click inside the
|
|
147
|
+
* panel moved focus to the page. Escape closes the list here too, by the same rule as
|
|
148
|
+
* {@link OnKeyDown}; other keys are left alone.
|
|
149
|
+
*/
|
|
150
|
+
OnOverlayKeyDown(event: KeyboardEvent): void;
|
|
151
|
+
/**
|
|
152
|
+
* Escape with the list open closes the list and nothing else (#5340). The key is cancelled and
|
|
153
|
+
* stopped here, so it never reaches the page, where a host that closes on Escape (a dialog, a
|
|
154
|
+
* popover) would close as well. Focus goes back to the field, since the filter box that may have
|
|
155
|
+
* held it goes away with the list.
|
|
156
|
+
*/
|
|
157
|
+
private closeListOnEscape;
|
|
136
158
|
OnBlur(): void;
|
|
137
159
|
ngAfterViewInit(): void;
|
|
138
160
|
GetItemText(item: unknown): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAIb,YAAY,EAMZ,WAAW,EACX,SAAS,EAGV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAiB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;;AAGhE
|
|
1
|
+
{"version":3,"file":"dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAIb,YAAY,EAMZ,WAAW,EACX,SAAS,EAGV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAiB,iBAAiB,E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IAOlC,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO;IAMpC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEnC,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAChC,gBAAgB,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI;IACpD,iBAAiB,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI;IACvC,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,IAAI;IAC3C,WAAW,IAAI,IAAI;IAEnB,OAAO,CAAC,gBAAgB;yCA5Rb,mBAAmB;2CAAnB,mBAAmB;CAgS/B"}
|
|
@@ -104,6 +104,9 @@ function MJDropdownComponent_ng_template_6_Template(rf, ctx) { if (rf & 1) {
|
|
|
104
104
|
* what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —
|
|
105
105
|
* `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.
|
|
106
106
|
*
|
|
107
|
+
* Escape with the list open closes the list and goes no further, so a dialog or popover around the
|
|
108
|
+
* field stays open. With the list closed, Escape goes on to the host as usual.
|
|
109
|
+
*
|
|
107
110
|
* @example With a visible label (preferred)
|
|
108
111
|
* ```html
|
|
109
112
|
* <span id="persona-label">Interview persona</span>
|
|
@@ -310,6 +313,11 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
310
313
|
this.HighlightedIndex = 0;
|
|
311
314
|
this.FilterChange.emit(this.filterText);
|
|
312
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Keys pressed in the field or in the filter box. Escape with the list open closes the list and
|
|
318
|
+
* stops the key there (see `closeListOnEscape`). With the list closed, Escape is cancelled as
|
|
319
|
+
* before and goes on to the host, so a dialog or popover around the field still closes on it.
|
|
320
|
+
*/
|
|
313
321
|
OnKeyDown(event) {
|
|
314
322
|
const items = this.FilteredItems;
|
|
315
323
|
switch (event.key) {
|
|
@@ -334,7 +342,8 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
334
342
|
break;
|
|
335
343
|
case 'Escape':
|
|
336
344
|
event.preventDefault();
|
|
337
|
-
this.
|
|
345
|
+
if (this.IsOpen)
|
|
346
|
+
this.closeListOnEscape(event);
|
|
338
347
|
break;
|
|
339
348
|
case 'Tab':
|
|
340
349
|
// The panel lives in the overlay, outside a parent dialog. Hand focus back to this
|
|
@@ -358,6 +367,28 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
358
367
|
break;
|
|
359
368
|
}
|
|
360
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Keys the open list's overlay receives. The overlay listens on the page body, so this sees a
|
|
372
|
+
* key that did not go through the field or the filter box, for example after a click inside the
|
|
373
|
+
* panel moved focus to the page. Escape closes the list here too, by the same rule as
|
|
374
|
+
* {@link OnKeyDown}; other keys are left alone.
|
|
375
|
+
*/
|
|
376
|
+
OnOverlayKeyDown(event) {
|
|
377
|
+
if (event.key === 'Escape' && this.IsOpen)
|
|
378
|
+
this.closeListOnEscape(event);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Escape with the list open closes the list and nothing else (#5340). The key is cancelled and
|
|
382
|
+
* stopped here, so it never reaches the page, where a host that closes on Escape (a dialog, a
|
|
383
|
+
* popover) would close as well. Focus goes back to the field, since the filter box that may have
|
|
384
|
+
* held it goes away with the list.
|
|
385
|
+
*/
|
|
386
|
+
closeListOnEscape(event) {
|
|
387
|
+
event.preventDefault();
|
|
388
|
+
event.stopPropagation();
|
|
389
|
+
this.triggerEl?.nativeElement.focus();
|
|
390
|
+
this.Close();
|
|
391
|
+
}
|
|
361
392
|
OnBlur() { this.onTouched(); }
|
|
362
393
|
ngAfterViewInit() { WarnIfUnnamed(this.triggerEl?.nativeElement, 'mj-dropdown'); }
|
|
363
394
|
GetItemText(item) {
|
|
@@ -405,7 +436,7 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
405
436
|
provide: NG_VALUE_ACCESSOR,
|
|
406
437
|
useExisting: forwardRef(() => MJDropdownComponent),
|
|
407
438
|
multi: true
|
|
408
|
-
}]), i0.ɵɵInheritDefinitionFeature], decls: 7, vars:
|
|
439
|
+
}]), i0.ɵɵInheritDefinitionFeature], decls: 7, vars: 21, consts: [["trigger", "", "overlayOrigin", "cdkOverlayOrigin"], ["filterInput", ""], ["cdkOverlayOrigin", "", "role", "combobox", "aria-haspopup", "listbox", 1, "mj-dropdown", 3, "click", "keydown", "blur"], [1, "mj-dropdown-value"], [1, "fa-solid", "fa-chevron-down", "mj-dropdown-arrow"], ["cdkConnectedOverlay", "", "cdkConnectedOverlayBackdropClass", "mj-dropdown-backdrop", 3, "backdropClick", "detach", "overlayKeydown", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayOpen", "cdkConnectedOverlayPositions", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayDisableClose"], ["role", "listbox", 1, "mj-dropdown-panel"], [1, "mj-dropdown-filter-wrap"], ["role", "option", 1, "mj-dropdown-option", "mj-dropdown-option--default", 3, "mj-dropdown-option--selected", "mj-dropdown-option--highlighted"], ["role", "option", 1, "mj-dropdown-option", 3, "mj-dropdown-option--selected", "mj-dropdown-option--highlighted"], [1, "mj-dropdown-no-data"], ["aria-hidden", "true", 1, "mj-dropdown-sr-only"], ["type", "text", "placeholder", "Filter...", 1, "mj-input", "mj-dropdown-filter", 3, "input", "keydown", "value"], ["role", "option", 1, "mj-dropdown-option", "mj-dropdown-option--default", 3, "click"], ["role", "option", 1, "mj-dropdown-option", 3, "click"], [4, "ngTemplateOutlet", "ngTemplateOutletContext"]], template: function MJDropdownComponent_Template(rf, ctx) { if (rf & 1) {
|
|
409
440
|
i0.ɵɵelementStart(0, "div", 2, 0);
|
|
410
441
|
i0.ɵɵlistener("click", function MJDropdownComponent_Template_div_click_0_listener() { return ctx.Toggle(); })("keydown", function MJDropdownComponent_Template_div_keydown_0_listener($event) { return ctx.OnKeyDown($event); })("blur", function MJDropdownComponent_Template_div_blur_0_listener() { return ctx.OnBlur(); });
|
|
411
442
|
i0.ɵɵelementStart(3, "span", 3);
|
|
@@ -414,7 +445,7 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
414
445
|
i0.ɵɵelement(5, "i", 4);
|
|
415
446
|
i0.ɵɵelementEnd();
|
|
416
447
|
i0.ɵɵtemplate(6, MJDropdownComponent_ng_template_6_Template, 6, 6, "ng-template", 5);
|
|
417
|
-
i0.ɵɵlistener("backdropClick", function MJDropdownComponent_Template_ng_template_backdropClick_6_listener() { return ctx.Close(); })("detach", function MJDropdownComponent_Template_ng_template_detach_6_listener() { return ctx.Close(); });
|
|
448
|
+
i0.ɵɵlistener("backdropClick", function MJDropdownComponent_Template_ng_template_backdropClick_6_listener() { return ctx.Close(); })("detach", function MJDropdownComponent_Template_ng_template_detach_6_listener() { return ctx.Close(); })("overlayKeydown", function MJDropdownComponent_Template_ng_template_overlayKeydown_6_listener($event) { return ctx.OnOverlayKeyDown($event); });
|
|
418
449
|
} if (rf & 2) {
|
|
419
450
|
const overlayOrigin_r7 = i0.ɵɵreference(2);
|
|
420
451
|
i0.ɵɵclassProp("mj-dropdown--open", ctx.IsOpen)("mj-dropdown--disabled", ctx.IsDisabled);
|
|
@@ -424,7 +455,7 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
424
455
|
i0.ɵɵadvance();
|
|
425
456
|
i0.ɵɵtextInterpolate1(" ", ctx.DisplayText, " ");
|
|
426
457
|
i0.ɵɵadvance(2);
|
|
427
|
-
i0.ɵɵproperty("cdkConnectedOverlayOrigin", overlayOrigin_r7)("cdkConnectedOverlayOpen", ctx.IsOpen)("cdkConnectedOverlayPositions", ctx.Positions)("cdkConnectedOverlayWidth", ctx.TriggerWidth)("cdkConnectedOverlayHasBackdrop", true);
|
|
458
|
+
i0.ɵɵproperty("cdkConnectedOverlayOrigin", overlayOrigin_r7)("cdkConnectedOverlayOpen", ctx.IsOpen)("cdkConnectedOverlayPositions", ctx.Positions)("cdkConnectedOverlayWidth", ctx.TriggerWidth)("cdkConnectedOverlayHasBackdrop", true)("cdkConnectedOverlayDisableClose", true);
|
|
428
459
|
} }, dependencies: [NgTemplateOutlet, OverlayModule, i1.CdkConnectedOverlay, i1.CdkOverlayOrigin], styles: ["\n\n\n\n\n\n\n\n\n .mj-dropdown-sr-only[_ngcontent-%COMP%] {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }"] });
|
|
429
460
|
}
|
|
430
461
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJDropdownComponent, [{
|
|
@@ -456,6 +487,10 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
456
487
|
<i class="fa-solid fa-chevron-down mj-dropdown-arrow"></i>
|
|
457
488
|
</div>
|
|
458
489
|
|
|
490
|
+
<!--
|
|
491
|
+
The overlay's own Escape close is off: it cancels the key but lets it go on to the page.
|
|
492
|
+
OnOverlayKeyDown closes the list on Escape instead and stops the key there.
|
|
493
|
+
-->
|
|
459
494
|
<ng-template
|
|
460
495
|
cdkConnectedOverlay
|
|
461
496
|
[cdkConnectedOverlayOrigin]="overlayOrigin"
|
|
@@ -463,9 +498,11 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
463
498
|
[cdkConnectedOverlayPositions]="Positions"
|
|
464
499
|
[cdkConnectedOverlayWidth]="TriggerWidth"
|
|
465
500
|
[cdkConnectedOverlayHasBackdrop]="true"
|
|
501
|
+
[cdkConnectedOverlayDisableClose]="true"
|
|
466
502
|
cdkConnectedOverlayBackdropClass="mj-dropdown-backdrop"
|
|
467
503
|
(backdropClick)="Close()"
|
|
468
|
-
(detach)="Close()"
|
|
504
|
+
(detach)="Close()"
|
|
505
|
+
(overlayKeydown)="OnOverlayKeyDown($event)">
|
|
469
506
|
<div class="mj-dropdown-panel" role="listbox"
|
|
470
507
|
[attr.id]="ListboxId"
|
|
471
508
|
[attr.aria-label]="AriaLabel || null"
|
|
@@ -566,5 +603,5 @@ export class MJDropdownComponent extends MJNamedControlBase {
|
|
|
566
603
|
type: HostBinding,
|
|
567
604
|
args: ['class.mj-dropdown-host']
|
|
568
605
|
}] }); })();
|
|
569
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDropdownComponent, { className: "MJDropdownComponent", filePath: "lib/dropdown/dropdown.component.ts", lineNumber:
|
|
606
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDropdownComponent, { className: "MJDropdownComponent", filePath: "lib/dropdown/dropdown.component.ts", lineNumber: 200 }); })();
|
|
570
607
|
//# sourceMappingURL=dropdown.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,WAAW,EAEX,SAAS,EACT,YAAY,EAGZ,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;IAiGlD,AAbF,8BAAqC,eAa2C;IAAA,sBAAM;IAAA,iBAAO;IAC3F,oCASkC;IAAhC,AADA,2MAAS,4BAAqB,KAAC,kMACpB,wBAAiB,KAAC;IACjC,AAVE,iBASkC,EAC9B;;;IAXiD,cAAwB;;IAQ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AS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,aAAa;;kBAEvB,WAAW;mBAAC,wBAAwB;;kFAxC1B,mBAAmB","sourcesContent":["import {\n AfterViewInit,\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n HostBinding,\n ElementRef,\n ViewChild,\n ContentChild,\n TemplateRef,\n OnDestroy,\n inject,\n ChangeDetectorRef\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-dropdown — Dropdown select component using CDK Overlay.\n *\n * Replaces `<kendo-dropdownlist>`.\n *\n * Every dropdown needs an ACCESSIBLE NAME, or it announces as \"combobox, collapsed\" with no hint of\n * what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —\n * `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.\n *\n * @example With a visible label (preferred)\n * ```html\n * <span id=\"persona-label\">Interview persona</span>\n * <mj-dropdown\n * AriaLabelledBy=\"persona-label\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\">\n * </mj-dropdown>\n * ```\n *\n * @example With no visible label\n * ```html\n * <mj-dropdown\n * AriaLabel=\"Interview persona\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\"\n * [Filterable]=\"true\"\n * (FilterChange)=\"onFilter($event)\">\n * </mj-dropdown>\n * ```\n */\n@Component({\n selector: 'mj-dropdown',\n standalone: true,\n imports: [NgTemplateOutlet, OverlayModule],\n template: `\n <div\n class=\"mj-dropdown\"\n #trigger\n cdkOverlayOrigin\n #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-dropdown--open]=\"IsOpen\"\n [class.mj-dropdown--disabled]=\"IsDisabled\"\n role=\"combobox\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [attr.aria-expanded]=\"IsOpen\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"IsOpen ? ListboxId : null\"\n [attr.aria-disabled]=\"IsDisabled ? 'true' : null\"\n [attr.tabindex]=\"IsDisabled ? -1 : 0\"\n (click)=\"Toggle()\"\n (keydown)=\"OnKeyDown($event)\"\n (blur)=\"OnBlur()\">\n <span class=\"mj-dropdown-value\" [class.mj-dropdown-placeholder]=\"!HasValue\">\n {{ DisplayText }}\n </span>\n <i class=\"fa-solid fa-chevron-down mj-dropdown-arrow\"></i>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\"\n [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayWidth]=\"TriggerWidth\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\"\n (detach)=\"Close()\">\n <div class=\"mj-dropdown-panel\" role=\"listbox\"\n [attr.id]=\"ListboxId\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\">\n @if (Filterable) {\n <div class=\"mj-dropdown-filter-wrap\">\n <!--\n The word \"Filter\" lives in a hidden span rather than in a concatenated string so the\n AriaLabelledBy path can NAME this box from the same visible label that names the\n dropdown: aria-labelledby takes an ID LIST, so \"Filter\" plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text.\n Without it, every filterable dropdown on a form named this way announces as an\n identical \"Filter options\".\n\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the\n name (accname §4.1), so aria-hidden keeps the word out of the reading order without\n costing the composed name.\n -->\n <span class=\"mj-dropdown-sr-only\" aria-hidden=\"true\" [attr.id]=\"FilterWordId\">Filter</span>\n <input\n #filterInput\n class=\"mj-input mj-dropdown-filter\"\n type=\"text\"\n placeholder=\"Filter...\"\n [attr.aria-labelledby]=\"FilterLabelledBy\"\n [attr.aria-label]=\"FilterLabelledBy ? null : FilterLabel\"\n [value]=\"filterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnKeyDown($event)\" />\n </div>\n }\n @if (DefaultItem != null) {\n <div\n class=\"mj-dropdown-option mj-dropdown-option--default\"\n [class.mj-dropdown-option--selected]=\"SelectedValue == null\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === -1\"\n role=\"option\"\n [attr.aria-selected]=\"SelectedValue == null\"\n (click)=\"SelectItem(null, $event)\">\n {{ GetItemText(DefaultItem) }}\n </div>\n }\n @for (item of FilteredItems; track TrackByIndex($index)) {\n <div\n class=\"mj-dropdown-option\"\n [class.mj-dropdown-option--selected]=\"IsItemSelected(item)\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === $index\"\n role=\"option\"\n [attr.aria-selected]=\"IsItemSelected(item)\"\n (click)=\"SelectItem(item, $event)\">\n @if (itemTemplate) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n } @else {\n {{ GetItemText(item) }}\n }\n </div>\n }\n @if (FilteredItems.length === 0) {\n <div class=\"mj-dropdown-no-data\">No data found</div>\n }\n </div>\n </ng-template>\n `,\n styles: [`\n /*\n * Component-scoped ON PURPOSE, unlike the rest of this control's styling, which ships as a global\n * stylesheet the host application imports. A host that skips that import gets unstyled chrome —\n * survivable — but a hidden-word span that is not hidden renders its word as literal text in the\n * middle of the field. The rule that hides it therefore has to travel with the component.\n *\n * Not display:none or visibility:hidden — both remove the element from the accessibility tree,\n * which is the one thing this element exists to be in.\n */\n .mj-dropdown-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MJDropdownComponent),\n multi: true\n }]\n})\nexport class MJDropdownComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Data: Record<string, unknown>[] | string[] | readonly unknown[] | null = [];\n @Input() TextField = '';\n @Input() ValueField = '';\n @Input() Filterable = false;\n @Input() ValuePrimitive = false;\n /**\n * Host-driven disable. Composed with Angular Forms' `setDisabledState()` into `IsDisabled`\n * (the actual gate) — see `syncDisabled`. A setter, not a bare field, because this input is\n * routinely bound to an expression that changes over the control's lifetime\n * (`[Disabled]=\"!draft.CompanyID\"`), and the gate has to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) {\n this.disabledInput = value;\n this.syncDisabled();\n }\n get Disabled(): boolean {\n return this.disabledInput;\n }\n @Input() Placeholder = 'Select...';\n @Input() DefaultItem: Record<string, unknown> | string | null = null;\n\n @Output() FilterChange = new EventEmitter<string>();\n @Output() ValueChange = new EventEmitter<unknown>();\n\n @ContentChild('mjDropdownItem') ItemTemplate: TemplateRef<{ $implicit: unknown }> | null = null;\n\n /** @deprecated Use {@link ItemTemplate}. */\n get itemTemplate(): TemplateRef<{ $implicit: unknown }> | null {\n return this.ItemTemplate;\n }\n /** @deprecated Use {@link ItemTemplate}. */\n set itemTemplate(value: TemplateRef<{ $implicit: unknown }> | null) {\n this.ItemTemplate = value;\n }\n\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('filterInput') private filterInputEl: ElementRef<HTMLInputElement> | undefined;\n\n @HostBinding('class.mj-dropdown-host') readonly hostClass = true;\n\n private cdr = inject(ChangeDetectorRef);\n\n /** This dropdown's id suffix — the shared named-control counter, kept under its own name. */\n readonly DropdownId = this.NamedControlId;\n\n /**\n * Id of the popup listbox, so the trigger can point `aria-controls` at it while open — the half of\n * the combobox pattern that makes \"collapsed/expanded\" refer to something a screen reader can\n * find. Generated per instance from the shared named-control counter.\n */\n get ListboxId(): string { return `mj-dropdown-listbox-${this.DropdownId}`; }\n\n /** Id of the hidden \"Filter\" word, composed into the filter box's name via an id list. */\n get FilterWordId(): string { return this.SecondaryWordId('filter-word'); }\n\n /** `aria-labelledby` for the filter box when a VISIBLE label names the dropdown. */\n get FilterLabelledBy(): string { return this.SecondaryLabelledBy('filter-word'); }\n\n /** `aria-label` for the filter box in the no-visible-label case. */\n get FilterLabel(): string { return this.SecondaryLabel('Filter', 'Filter options'); }\n\n IsOpen = false;\n /**\n * The single gate on `Toggle()` / `Open()` — true when EITHER the `Disabled` input or Angular\n * Forms says so. Never assign it directly; go through `syncDisabled()` so both sources are\n * always composed and a lock closes an open panel.\n */\n IsDisabled = false;\n HighlightedIndex = -1;\n SelectedValue: unknown = null;\n TriggerWidth = 0;\n\n filterText = '';\n\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n\n private onChange: (value: unknown) => void = () => {};\n private onTouched: () => void = () => {};\n\n /** Backing field for the `Disabled` input. */\n private disabledInput = false;\n /** The forms-driven disabled state, kept SEPARATE so neither source can stomp the other. */\n private formDisabled = false;\n\n /**\n * Recompute the gate from both of its sources. Called whenever either changes.\n *\n * `IsDisabled` is derived state, and the only thing that assigned it was `setDisabledState()`.\n * The forms-driven half was in fact fine — `setUpControl` also wires `registerOnDisabledChange`,\n * so that hook fires on every `control.disable()`/`enable()`, not just at registration. What had\n * no recompute path at all was the `Disabled` @Input: a plain field, so the gate froze at\n * whatever the first compose produced and every later change to the input was dropped.\n *\n * That is how a `[Disabled]=\"!draft.CompanyID\"` picker stayed dead for the life of the\n * component after the company was finally chosen.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n // Becoming disabled while the panel is open would otherwise leave an interactive list\n // hanging off a control the user can no longer operate.\n if (disabled) this.resetPanelState();\n this.cdr.markForCheck();\n }\n\n get FilteredItems(): unknown[] {\n const data = (this.Data ?? []) as unknown[];\n if (!this.Filterable || !this.filterText) return data;\n const search = this.filterText.toLowerCase();\n return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));\n }\n\n get HasValue(): boolean { return this.SelectedValue != null; }\n\n get DisplayText(): string {\n if (this.SelectedValue == null) {\n if (this.DefaultItem != null) return this.GetItemText(this.DefaultItem);\n return this.Placeholder;\n }\n if (this.ValuePrimitive && this.ValueField) {\n const found = ((this.Data ?? []) as unknown[]).find(item => this.GetItemValue(item) === this.SelectedValue);\n return found ? this.GetItemText(found) : String(this.SelectedValue);\n }\n return this.GetItemText(this.SelectedValue as Record<string, unknown> | string);\n }\n\n Toggle(): void {\n if (this.IsDisabled) return;\n this.IsOpen ? this.Close() : this.Open();\n }\n\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;\n this.IsOpen = true;\n this.HighlightedIndex = this.getSelectedIndex();\n this.cdr.detectChanges();\n if (this.Filterable) setTimeout(() => this.filterInputEl?.nativeElement.focus(), 0);\n }\n\n Close(): void {\n if (!this.IsOpen) return;\n this.resetPanelState();\n this.cdr.detectChanges();\n }\n\n /**\n * Panel state only — no change detection. Split out of `Close()` because `syncDisabled()` can\n * run from an @Input setter, i.e. DURING the parent's change-detection pass, where a nested\n * `detectChanges()` re-enters CD and trips NG0100 on the parent's own bindings.\n */\n private resetPanelState(): void {\n this.IsOpen = false;\n this.filterText = '';\n this.HighlightedIndex = -1;\n }\n\n SelectItem(item: unknown | null, event?: Event): void {\n event?.stopPropagation();\n if (item == null) {\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n } else if (this.ValuePrimitive && this.ValueField) {\n const value = this.GetItemValue(item);\n this.SelectedValue = value;\n this.onChange(value);\n this.ValueChange.emit(value);\n } else {\n this.SelectedValue = item;\n this.onChange(item);\n this.ValueChange.emit(item);\n }\n this.Close();\n }\n\n IsItemSelected(item: unknown): boolean {\n if (this.SelectedValue == null) return false;\n if (this.ValuePrimitive && this.ValueField) return this.GetItemValue(item) === this.SelectedValue;\n if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')\n return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);\n return item === this.SelectedValue;\n }\n\n OnFilterInput(event: Event): void {\n this.filterText = (event.target as HTMLInputElement).value;\n this.HighlightedIndex = 0;\n this.FilterChange.emit(this.filterText);\n }\n\n OnKeyDown(event: KeyboardEvent): void {\n const items = this.FilteredItems;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.IsOpen) this.Open();\n else this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (this.IsOpen) this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);\n break;\n case 'Enter':\n event.preventDefault();\n if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length)\n this.SelectItem(items[this.HighlightedIndex]);\n else if (!this.IsOpen) this.Open();\n break;\n case 'Escape': event.preventDefault(); this.Close(); break;\n case 'Tab':\n // The panel lives in the overlay, outside a parent dialog. Hand focus back to this\n // field and do not prevent the key, so the browser moves on from the field.\n if (this.IsOpen) {\n this.triggerEl?.nativeElement.focus();\n this.Close();\n }\n break;\n case 'Home': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = 0; } break;\n case 'End': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = items.length - 1; } break;\n }\n }\n\n OnBlur(): void { this.onTouched(); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.triggerEl?.nativeElement, 'mj-dropdown'); }\n\n GetItemText(item: unknown): string {\n if (item == null) return '';\n if (typeof item === 'string') return item;\n if (this.TextField && typeof item === 'object') return String((item as Record<string, unknown>)[this.TextField] ?? '');\n return String(item);\n }\n\n GetItemValue(item: unknown): unknown {\n if (typeof item === 'string') return item;\n if (this.ValueField && typeof item === 'object' && item != null) return (item as Record<string, unknown>)[this.ValueField];\n return item;\n }\n\n TrackByIndex(index: number): number { return index; }\n\n writeValue(value: unknown): void { this.SelectedValue = value; }\n registerOnChange(fn: (value: unknown) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.formDisabled = isDisabled; this.syncDisabled(); }\n ngOnDestroy(): void { this.Close(); }\n\n private getSelectedIndex(): number {\n if (this.SelectedValue == null) return -1;\n return this.FilteredItems.findIndex(item => this.IsItemSelected(item));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dropdown.component.js","sourceRoot":"","sources":["../../../src/lib/dropdown/dropdown.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,WAAW,EAEX,SAAS,EACT,YAAY,EAGZ,MAAM,EACN,iBAAiB,EAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,aAAa,EAAqB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;IA0GlD,AAbF,8BAAqC,eAa2C;IAAA,sBAAM;IAAA,iBAAO;IAC3F,oCASkC;IAAhC,AADA,2MAAS,4BAAqB,KAAC,kMACpB,wBAAiB,KAAC;IACjC,AAVE,iBASkC,EAC9B;;;IAXiD,cAAwB;;IAQ3E,eAAoB;IAApB,yCAAoB;;;;;I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E,aAAa,CAAC,YAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGT,aAuBU,CAAC;wBACV,OAAO,EAAE,iBAAiB;wBAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,oBAAoB,CAAC;wBAClD,KAAK,EAAE,IAAI;qBACZ,CAAC;;kBAGD,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAQL,KAAK;;kBACL,KAAK;;kBAEL,MAAM;;kBACN,MAAM;;kBAEN,YAAY;mBAAC,gBAAgB;;kBAW7B,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,aAAa;;kBAEvB,WAAW;mBAAC,wBAAwB;;kFAxC1B,mBAAmB","sourcesContent":["import {\n AfterViewInit,\n Component,\n Input,\n Output,\n EventEmitter,\n forwardRef,\n HostBinding,\n ElementRef,\n ViewChild,\n ContentChild,\n TemplateRef,\n OnDestroy,\n inject,\n ChangeDetectorRef\n} from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-dropdown — Dropdown select component using CDK Overlay.\n *\n * Replaces `<kendo-dropdownlist>`.\n *\n * Every dropdown needs an ACCESSIBLE NAME, or it announces as \"combobox, collapsed\" with no hint of\n * what it selects (WCAG 2.1 4.1.2). Use {@link AriaLabelledBy} when a visible label already exists —\n * `<label for>` cannot name a `div[role=combobox]` — and {@link AriaLabel} when none does.\n *\n * Escape with the list open closes the list and goes no further, so a dialog or popover around the\n * field stays open. With the list closed, Escape goes on to the host as usual.\n *\n * @example With a visible label (preferred)\n * ```html\n * <span id=\"persona-label\">Interview persona</span>\n * <mj-dropdown\n * AriaLabelledBy=\"persona-label\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\">\n * </mj-dropdown>\n * ```\n *\n * @example With no visible label\n * ```html\n * <mj-dropdown\n * AriaLabel=\"Interview persona\"\n * [Data]=\"items\"\n * TextField=\"name\"\n * ValueField=\"id\"\n * [(ngModel)]=\"selectedId\"\n * [ValuePrimitive]=\"true\"\n * [Filterable]=\"true\"\n * (FilterChange)=\"onFilter($event)\">\n * </mj-dropdown>\n * ```\n */\n@Component({\n selector: 'mj-dropdown',\n standalone: true,\n imports: [NgTemplateOutlet, OverlayModule],\n template: `\n <div\n class=\"mj-dropdown\"\n #trigger\n cdkOverlayOrigin\n #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-dropdown--open]=\"IsOpen\"\n [class.mj-dropdown--disabled]=\"IsDisabled\"\n role=\"combobox\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [attr.aria-expanded]=\"IsOpen\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"IsOpen ? ListboxId : null\"\n [attr.aria-disabled]=\"IsDisabled ? 'true' : null\"\n [attr.tabindex]=\"IsDisabled ? -1 : 0\"\n (click)=\"Toggle()\"\n (keydown)=\"OnKeyDown($event)\"\n (blur)=\"OnBlur()\">\n <span class=\"mj-dropdown-value\" [class.mj-dropdown-placeholder]=\"!HasValue\">\n {{ DisplayText }}\n </span>\n <i class=\"fa-solid fa-chevron-down mj-dropdown-arrow\"></i>\n </div>\n\n <!--\n The overlay's own Escape close is off: it cancels the key but lets it go on to the page.\n OnOverlayKeyDown closes the list on Escape instead and stops the key there.\n -->\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\"\n [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayWidth]=\"TriggerWidth\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n [cdkConnectedOverlayDisableClose]=\"true\"\n cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\"\n (detach)=\"Close()\"\n (overlayKeydown)=\"OnOverlayKeyDown($event)\">\n <div class=\"mj-dropdown-panel\" role=\"listbox\"\n [attr.id]=\"ListboxId\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\">\n @if (Filterable) {\n <div class=\"mj-dropdown-filter-wrap\">\n <!--\n The word \"Filter\" lives in a hidden span rather than in a concatenated string so the\n AriaLabelledBy path can NAME this box from the same visible label that names the\n dropdown: aria-labelledby takes an ID LIST, so \"Filter\" plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text.\n Without it, every filterable dropdown on a form named this way announces as an\n identical \"Filter options\".\n\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the\n name (accname §4.1), so aria-hidden keeps the word out of the reading order without\n costing the composed name.\n -->\n <span class=\"mj-dropdown-sr-only\" aria-hidden=\"true\" [attr.id]=\"FilterWordId\">Filter</span>\n <input\n #filterInput\n class=\"mj-input mj-dropdown-filter\"\n type=\"text\"\n placeholder=\"Filter...\"\n [attr.aria-labelledby]=\"FilterLabelledBy\"\n [attr.aria-label]=\"FilterLabelledBy ? null : FilterLabel\"\n [value]=\"filterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnKeyDown($event)\" />\n </div>\n }\n @if (DefaultItem != null) {\n <div\n class=\"mj-dropdown-option mj-dropdown-option--default\"\n [class.mj-dropdown-option--selected]=\"SelectedValue == null\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === -1\"\n role=\"option\"\n [attr.aria-selected]=\"SelectedValue == null\"\n (click)=\"SelectItem(null, $event)\">\n {{ GetItemText(DefaultItem) }}\n </div>\n }\n @for (item of FilteredItems; track TrackByIndex($index)) {\n <div\n class=\"mj-dropdown-option\"\n [class.mj-dropdown-option--selected]=\"IsItemSelected(item)\"\n [class.mj-dropdown-option--highlighted]=\"HighlightedIndex === $index\"\n role=\"option\"\n [attr.aria-selected]=\"IsItemSelected(item)\"\n (click)=\"SelectItem(item, $event)\">\n @if (itemTemplate) {\n <ng-container *ngTemplateOutlet=\"itemTemplate; context: { $implicit: item }\"></ng-container>\n } @else {\n {{ GetItemText(item) }}\n }\n </div>\n }\n @if (FilteredItems.length === 0) {\n <div class=\"mj-dropdown-no-data\">No data found</div>\n }\n </div>\n </ng-template>\n `,\n styles: [`\n /*\n * Component-scoped ON PURPOSE, unlike the rest of this control's styling, which ships as a global\n * stylesheet the host application imports. A host that skips that import gets unstyled chrome —\n * survivable — but a hidden-word span that is not hidden renders its word as literal text in the\n * middle of the field. The rule that hides it therefore has to travel with the component.\n *\n * Not display:none or visibility:hidden — both remove the element from the accessibility tree,\n * which is the one thing this element exists to be in.\n */\n .mj-dropdown-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MJDropdownComponent),\n multi: true\n }]\n})\nexport class MJDropdownComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Data: Record<string, unknown>[] | string[] | readonly unknown[] | null = [];\n @Input() TextField = '';\n @Input() ValueField = '';\n @Input() Filterable = false;\n @Input() ValuePrimitive = false;\n /**\n * Host-driven disable. Composed with Angular Forms' `setDisabledState()` into `IsDisabled`\n * (the actual gate) — see `syncDisabled`. A setter, not a bare field, because this input is\n * routinely bound to an expression that changes over the control's lifetime\n * (`[Disabled]=\"!draft.CompanyID\"`), and the gate has to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) {\n this.disabledInput = value;\n this.syncDisabled();\n }\n get Disabled(): boolean {\n return this.disabledInput;\n }\n @Input() Placeholder = 'Select...';\n @Input() DefaultItem: Record<string, unknown> | string | null = null;\n\n @Output() FilterChange = new EventEmitter<string>();\n @Output() ValueChange = new EventEmitter<unknown>();\n\n @ContentChild('mjDropdownItem') ItemTemplate: TemplateRef<{ $implicit: unknown }> | null = null;\n\n /** @deprecated Use {@link ItemTemplate}. */\n get itemTemplate(): TemplateRef<{ $implicit: unknown }> | null {\n return this.ItemTemplate;\n }\n /** @deprecated Use {@link ItemTemplate}. */\n set itemTemplate(value: TemplateRef<{ $implicit: unknown }> | null) {\n this.ItemTemplate = value;\n }\n\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('filterInput') private filterInputEl: ElementRef<HTMLInputElement> | undefined;\n\n @HostBinding('class.mj-dropdown-host') readonly hostClass = true;\n\n private cdr = inject(ChangeDetectorRef);\n\n /** This dropdown's id suffix — the shared named-control counter, kept under its own name. */\n readonly DropdownId = this.NamedControlId;\n\n /**\n * Id of the popup listbox, so the trigger can point `aria-controls` at it while open — the half of\n * the combobox pattern that makes \"collapsed/expanded\" refer to something a screen reader can\n * find. Generated per instance from the shared named-control counter.\n */\n get ListboxId(): string { return `mj-dropdown-listbox-${this.DropdownId}`; }\n\n /** Id of the hidden \"Filter\" word, composed into the filter box's name via an id list. */\n get FilterWordId(): string { return this.SecondaryWordId('filter-word'); }\n\n /** `aria-labelledby` for the filter box when a VISIBLE label names the dropdown. */\n get FilterLabelledBy(): string { return this.SecondaryLabelledBy('filter-word'); }\n\n /** `aria-label` for the filter box in the no-visible-label case. */\n get FilterLabel(): string { return this.SecondaryLabel('Filter', 'Filter options'); }\n\n IsOpen = false;\n /**\n * The single gate on `Toggle()` / `Open()` — true when EITHER the `Disabled` input or Angular\n * Forms says so. Never assign it directly; go through `syncDisabled()` so both sources are\n * always composed and a lock closes an open panel.\n */\n IsDisabled = false;\n HighlightedIndex = -1;\n SelectedValue: unknown = null;\n TriggerWidth = 0;\n\n filterText = '';\n\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n\n private onChange: (value: unknown) => void = () => {};\n private onTouched: () => void = () => {};\n\n /** Backing field for the `Disabled` input. */\n private disabledInput = false;\n /** The forms-driven disabled state, kept SEPARATE so neither source can stomp the other. */\n private formDisabled = false;\n\n /**\n * Recompute the gate from both of its sources. Called whenever either changes.\n *\n * `IsDisabled` is derived state, and the only thing that assigned it was `setDisabledState()`.\n * The forms-driven half was in fact fine — `setUpControl` also wires `registerOnDisabledChange`,\n * so that hook fires on every `control.disable()`/`enable()`, not just at registration. What had\n * no recompute path at all was the `Disabled` @Input: a plain field, so the gate froze at\n * whatever the first compose produced and every later change to the input was dropped.\n *\n * That is how a `[Disabled]=\"!draft.CompanyID\"` picker stayed dead for the life of the\n * component after the company was finally chosen.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n // Becoming disabled while the panel is open would otherwise leave an interactive list\n // hanging off a control the user can no longer operate.\n if (disabled) this.resetPanelState();\n this.cdr.markForCheck();\n }\n\n get FilteredItems(): unknown[] {\n const data = (this.Data ?? []) as unknown[];\n if (!this.Filterable || !this.filterText) return data;\n const search = this.filterText.toLowerCase();\n return data.filter(item => this.GetItemText(item).toLowerCase().includes(search));\n }\n\n get HasValue(): boolean { return this.SelectedValue != null; }\n\n get DisplayText(): string {\n if (this.SelectedValue == null) {\n if (this.DefaultItem != null) return this.GetItemText(this.DefaultItem);\n return this.Placeholder;\n }\n if (this.ValuePrimitive && this.ValueField) {\n const found = ((this.Data ?? []) as unknown[]).find(item => this.GetItemValue(item) === this.SelectedValue);\n return found ? this.GetItemText(found) : String(this.SelectedValue);\n }\n return this.GetItemText(this.SelectedValue as Record<string, unknown> | string);\n }\n\n Toggle(): void {\n if (this.IsDisabled) return;\n this.IsOpen ? this.Close() : this.Open();\n }\n\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.TriggerWidth = this.triggerEl?.nativeElement.offsetWidth ?? 200;\n this.IsOpen = true;\n this.HighlightedIndex = this.getSelectedIndex();\n this.cdr.detectChanges();\n if (this.Filterable) setTimeout(() => this.filterInputEl?.nativeElement.focus(), 0);\n }\n\n Close(): void {\n if (!this.IsOpen) return;\n this.resetPanelState();\n this.cdr.detectChanges();\n }\n\n /**\n * Panel state only — no change detection. Split out of `Close()` because `syncDisabled()` can\n * run from an @Input setter, i.e. DURING the parent's change-detection pass, where a nested\n * `detectChanges()` re-enters CD and trips NG0100 on the parent's own bindings.\n */\n private resetPanelState(): void {\n this.IsOpen = false;\n this.filterText = '';\n this.HighlightedIndex = -1;\n }\n\n SelectItem(item: unknown | null, event?: Event): void {\n event?.stopPropagation();\n if (item == null) {\n this.SelectedValue = null;\n this.onChange(null);\n this.ValueChange.emit(null);\n } else if (this.ValuePrimitive && this.ValueField) {\n const value = this.GetItemValue(item);\n this.SelectedValue = value;\n this.onChange(value);\n this.ValueChange.emit(value);\n } else {\n this.SelectedValue = item;\n this.onChange(item);\n this.ValueChange.emit(item);\n }\n this.Close();\n }\n\n IsItemSelected(item: unknown): boolean {\n if (this.SelectedValue == null) return false;\n if (this.ValuePrimitive && this.ValueField) return this.GetItemValue(item) === this.SelectedValue;\n if (this.ValueField && typeof item === 'object' && typeof this.SelectedValue === 'object')\n return this.GetItemValue(item) === this.GetItemValue(this.SelectedValue);\n return item === this.SelectedValue;\n }\n\n OnFilterInput(event: Event): void {\n this.filterText = (event.target as HTMLInputElement).value;\n this.HighlightedIndex = 0;\n this.FilterChange.emit(this.filterText);\n }\n\n /**\n * Keys pressed in the field or in the filter box. Escape with the list open closes the list and\n * stops the key there (see `closeListOnEscape`). With the list closed, Escape is cancelled as\n * before and goes on to the host, so a dialog or popover around the field still closes on it.\n */\n OnKeyDown(event: KeyboardEvent): void {\n const items = this.FilteredItems;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n if (!this.IsOpen) this.Open();\n else this.HighlightedIndex = Math.min(this.HighlightedIndex + 1, items.length - 1);\n break;\n case 'ArrowUp':\n event.preventDefault();\n if (this.IsOpen) this.HighlightedIndex = Math.max(this.HighlightedIndex - 1, 0);\n break;\n case 'Enter':\n event.preventDefault();\n if (this.IsOpen && this.HighlightedIndex >= 0 && this.HighlightedIndex < items.length)\n this.SelectItem(items[this.HighlightedIndex]);\n else if (!this.IsOpen) this.Open();\n break;\n case 'Escape':\n event.preventDefault();\n if (this.IsOpen) this.closeListOnEscape(event);\n break;\n case 'Tab':\n // The panel lives in the overlay, outside a parent dialog. Hand focus back to this\n // field and do not prevent the key, so the browser moves on from the field.\n if (this.IsOpen) {\n this.triggerEl?.nativeElement.focus();\n this.Close();\n }\n break;\n case 'Home': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = 0; } break;\n case 'End': if (this.IsOpen) { event.preventDefault(); this.HighlightedIndex = items.length - 1; } break;\n }\n }\n\n /**\n * Keys the open list's overlay receives. The overlay listens on the page body, so this sees a\n * key that did not go through the field or the filter box, for example after a click inside the\n * panel moved focus to the page. Escape closes the list here too, by the same rule as\n * {@link OnKeyDown}; other keys are left alone.\n */\n OnOverlayKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape' && this.IsOpen) this.closeListOnEscape(event);\n }\n\n /**\n * Escape with the list open closes the list and nothing else (#5340). The key is cancelled and\n * stopped here, so it never reaches the page, where a host that closes on Escape (a dialog, a\n * popover) would close as well. Focus goes back to the field, since the filter box that may have\n * held it goes away with the list.\n */\n private closeListOnEscape(event: KeyboardEvent): void {\n event.preventDefault();\n event.stopPropagation();\n this.triggerEl?.nativeElement.focus();\n this.Close();\n }\n\n OnBlur(): void { this.onTouched(); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.triggerEl?.nativeElement, 'mj-dropdown'); }\n\n GetItemText(item: unknown): string {\n if (item == null) return '';\n if (typeof item === 'string') return item;\n if (this.TextField && typeof item === 'object') return String((item as Record<string, unknown>)[this.TextField] ?? '');\n return String(item);\n }\n\n GetItemValue(item: unknown): unknown {\n if (typeof item === 'string') return item;\n if (this.ValueField && typeof item === 'object' && item != null) return (item as Record<string, unknown>)[this.ValueField];\n return item;\n }\n\n TrackByIndex(index: number): number { return index; }\n\n writeValue(value: unknown): void { this.SelectedValue = value; }\n registerOnChange(fn: (value: unknown) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.formDisabled = isDisabled; this.syncDisabled(); }\n ngOnDestroy(): void { this.Close(); }\n\n private getSelectedIndex(): number {\n if (this.SelectedValue == null) return -1;\n return this.FilteredItems.findIndex(item => this.IsItemSelected(item));\n }\n}\n"]}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import * as i1 from "@angular/cdk/menu";
|
|
4
|
+
/**
|
|
5
|
+
* `[mjMenuTriggerFor]`: opens an `mj-menu` from the element it sits on, usually a `mjButton`. Built on the CDK
|
|
6
|
+
* menu: the trigger carries `aria-haspopup`, `aria-expanded` and `aria-controls`, a click or the arrow keys open the
|
|
7
|
+
* menu, Escape and a click outside close it, and focus returns to the trigger.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```html
|
|
11
|
+
* <button mjButton Variant="icon" AriaLabel="Move to" [mjMenuTriggerFor]="moveMenu">
|
|
12
|
+
* <i class="fa-solid fa-ellipsis-vertical"></i>
|
|
13
|
+
* </button>
|
|
14
|
+
* <ng-template #moveMenu>
|
|
15
|
+
* <mj-menu AriaLabel="Move to">
|
|
16
|
+
* <mj-menu-item Icon="fa-solid fa-expand" (Triggered)="Move('stage')">Stage</mj-menu-item>
|
|
17
|
+
* <mj-menu-item Icon="fa-regular fa-window-restore" (Triggered)="Move('pip')">Picture-in-picture</mj-menu-item>
|
|
18
|
+
* <mj-menu-divider></mj-menu-divider>
|
|
19
|
+
* <mj-menu-item Icon="fa-solid fa-eye-slash" (Triggered)="Move('hidden')">Hide</mj-menu-item>
|
|
20
|
+
* </mj-menu>
|
|
21
|
+
* </ng-template>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class MJMenuTriggerDirective {
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJMenuTriggerDirective, never>;
|
|
26
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<MJMenuTriggerDirective, "[mjMenuTriggerFor]", never, {}, {}, never, never, true, [{ directive: typeof i1.CdkMenuTrigger; inputs: { "cdkMenuTriggerFor": "mjMenuTriggerFor"; }; outputs: { "cdkMenuOpened": "MenuOpened"; "cdkMenuClosed": "MenuClosed"; }; }]>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `mj-menu`: a menu panel, placed in an `ng-template` that a `[mjMenuTriggerFor]` opens. The arrow keys, Home, End
|
|
30
|
+
* and typing a label move between its items. Name it with `AriaLabel` (or `AriaLabelledBy`): a menu announces its
|
|
31
|
+
* name when it opens, and an unnamed one warns in dev mode.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MJMenuComponent implements AfterViewInit {
|
|
34
|
+
private readonly host;
|
|
35
|
+
/** The menu's name, when no visible label names it. */
|
|
36
|
+
AriaLabel: string | null;
|
|
37
|
+
/** The id of a visible element that names the menu. */
|
|
38
|
+
AriaLabelledBy: string | null;
|
|
39
|
+
ngAfterViewInit(): void;
|
|
40
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJMenuComponent, never>;
|
|
41
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MJMenuComponent, "mj-menu", never, { "AriaLabel": { "alias": "AriaLabel"; "required": false; }; "AriaLabelledBy": { "alias": "AriaLabelledBy"; "required": false; }; }, {}, never, ["*"], true, [{ directive: typeof i1.CdkMenu; inputs: {}; outputs: {}; }]>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* `mj-menu-item`: one action in an `mj-menu`. `Triggered` fires on a click, Enter or Space, and then the menu
|
|
45
|
+
* closes. A `Disabled` item stays focusable, so it is announced, but cannot be triggered.
|
|
46
|
+
*
|
|
47
|
+
* An item with `[mjMenuTriggerFor]` opens a submenu instead: a click, Enter, Space or ArrowRight opens it,
|
|
48
|
+
* ArrowLeft or Escape closes it, and an arrow after the label shows that it has one.
|
|
49
|
+
*/
|
|
50
|
+
export declare class MJMenuItemComponent {
|
|
51
|
+
private readonly item;
|
|
52
|
+
/** A Font Awesome class list for the icon before the label, e.g. `fa-solid fa-expand`. */
|
|
53
|
+
Icon: string | null;
|
|
54
|
+
/** Whether the item opens a submenu: it also carries `[mjMenuTriggerFor]`, and shows an arrow after its label. */
|
|
55
|
+
get HasSubmenu(): boolean;
|
|
56
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJMenuItemComponent, never>;
|
|
57
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MJMenuItemComponent, "mj-menu-item", never, { "Icon": { "alias": "Icon"; "required": false; }; }, {}, never, ["*"], true, [{ directive: typeof i1.CdkMenuItem; inputs: { "cdkMenuItemDisabled": "Disabled"; }; outputs: { "cdkMenuItemTriggered": "Triggered"; }; }]>;
|
|
58
|
+
}
|
|
59
|
+
/** `mj-menu-divider`: a line between groups of items in an `mj-menu`. */
|
|
60
|
+
export declare class MJMenuDividerComponent {
|
|
61
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJMenuDividerComponent, never>;
|
|
62
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MJMenuDividerComponent, "mj-menu-divider", never, {}, {}, never, never, true, never>;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=menu.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu.component.d.ts","sourceRoot":"","sources":["../../../src/lib/menu/menu.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4E,MAAM,eAAe,CAAC;;;AAIxH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAWa,sBAAsB;yCAAtB,sBAAsB;2CAAtB,sBAAsB;CAAG;AAEtC;;;;GAIG;AACH,qBA6Ba,eAAgB,YAAW,aAAa;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA+C;IAEpE,uDAAuD;IAC9C,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEzC,uDAAuD;IAC9C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEvC,eAAe,IAAI,IAAI;yCATnB,eAAe;2CAAf,eAAe;CAY3B;AAED;;;;;;GAMG;AACH,qBAwEa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAuC;IAE5D,0FAA0F;IACjF,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEpC,kHAAkH;IAClH,IAAW,UAAU,IAAI,OAAO,CAE/B;yCATU,mBAAmB;2CAAnB,mBAAmB;CAU/B;AAED,yEAAyE;AACzE,qBAiBa,sBAAsB;yCAAtB,sBAAsB;2CAAtB,sBAAsB;CAAG"}
|