@memberjunction/ng-ui-components 6.2.0-edge.1 → 6.2.0-edge.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -98,7 +98,7 @@ Editable text-input combobox (CDK overlay): type-to-filter, keyboard nav, option
98
98
  ```
99
99
 
100
100
  ### `mj-dropdown` — MJDropdownComponent
101
- Non-editable select (CDK overlay) with optional in-panel filter (`[Filterable]`, default false) and `DefaultItem` clear option. Same `Data`/`TextField`/`ValueField`/`ValuePrimitive` contract as combobox. Custom item template via `<ng-template #mjDropdownItem>`.
101
+ Non-editable select (CDK overlay) with optional in-panel filter (`[Filterable]`, default false) and `DefaultItem` clear option. Same `Data`/`TextField`/`ValueField`/`ValuePrimitive` contract as combobox. Custom item template via `<ng-template #mjDropdownItem>`. Tab in an open panel closes it, puts focus back on the field, and leaves the key to the browser, so Tab moves on from the field.
102
102
 
103
103
  **Give every dropdown an accessible name** — see [Accessible names](#accessible-names--one-contract-across-every-control). The trigger is a `div[role=combobox]`, so `<label for>` neither names nor focuses it: the visible-label path here is `AriaLabelledBy`, not `InputId`. The name is applied to the popup listbox as well as the trigger, and a filterable panel's filter box takes its name from the same source.
104
104
 
@@ -114,7 +114,7 @@ Non-editable select (CDK overlay) with optional in-panel filter (`[Filterable]`,
114
114
  ```
115
115
 
116
116
  ### `mj-datepicker` — MJDatepickerComponent
117
- Text input + calendar popup with `Min`/`Max` range disabling and typed-input parsing. Accepts `Date | string | null` through forms; emits `ValueChange: Date | null`. (Display format is currently fixed at `MM/dd/yyyy`.) The toggle button and the calendar grid take their names from the field's own name, so two pickers on one form do not present two grids both called "Calendar".
117
+ Text input + calendar popup with `Min`/`Max` range disabling and typed-input parsing. Accepts `Date | string | null` through forms; emits `ValueChange: Date | null`. (Display format is currently fixed at `MM/dd/yyyy`.) The toggle button and the calendar grid take their names from the field's own name, so two pickers on one form do not present two grids both called "Calendar". Tab in an open calendar closes it, puts focus back on the field, and leaves the key to the browser, so Tab moves on from the field.
118
118
 
119
119
  ```html
120
120
  <mj-datepicker AriaLabel="Due date" [(ngModel)]="dueDate" [Min]="minDate" [Max]="maxDate" Placeholder="Select a date" />
@@ -269,6 +269,13 @@ Collapsible panel replacing Kendo panelbar/expansion panel. Inputs: `Title`, `Ex
269
269
  ### `mj-dialog` — MJDialogComponent
270
270
  Modal with backdrop, Esc/backdrop close (`Closeable`), body scroll lock. Inputs: `Visible`, `Title`, `Size: 'sm'|'md'|'lg'|'xl'|'auto'` (400/600/800/1000px), `Width`/`Height`/`MinWidth`, `Role: 'dialog'|'alertdialog'`. Output: `Close`. **`Visible` is not two-way** — set it false in your `(Close)` handler. Slots: default body, `mj-dialog-titlebar`, `mj-dialog-actions`.
271
271
 
272
+ Focus inputs, each on by default:
273
+
274
+ - `AutoFocus` (default `true`) moves focus into the dialog on open: `[data-autofocus]`, else the first field, else the first body or actions button (never the close button), else the container.
275
+ - `TrapFocus` (default `true`) wraps only. The browser moves Tab between stops. Tab on the last stop wraps to the first, and Shift+Tab on the first stop or the container wraps to the last. Only the topmost visible dialog brings a Tab in, and only when it traps focus. Focus in another modal, or in an overlay panel, keeps its Tab. When a dropdown or calendar on the first or last stop hands focus back to its field, the dialog wraps. Stops skip `display: none`, `[hidden]`, `visibility: hidden`, disabled controls, hidden inputs, and `tabindex="-1"`. A `contenteditable` region is a stop unless `contenteditable="false"`. A nested dialog handles its own Tab first.
276
+ - `RestoreFocus` (default `true`) returns focus to the element that opened the dialog.
277
+ - `AriaLabel` names the dialog when `Title` is empty. A title uses `aria-labelledby` and does not also set `aria-label`.
278
+
272
279
  ```html
273
280
  <mj-dialog [Visible]="show" Title="Confirm" Size="md" (Close)="show = false">
274
281
  <p>Are you sure?</p>
@@ -86,6 +86,9 @@ export declare class MJDatepickerComponent extends MJNamedControlBase implements
86
86
  OnInputChange(event: Event): void;
87
87
  OnBlur(): void;
88
88
  OnKeyDown(event: KeyboardEvent): void;
89
+ /** Tab in the calendar closes it and returns to the field. The key is not cancelled, so the browser moves on from that field. */
90
+ OnCalendarKeyDown(event: KeyboardEvent): void;
91
+ private returnTabToField;
89
92
  writeValue(value: Date | string | null): void;
90
93
  registerOnChange(fn: (value: Date | null) => void): void;
91
94
  registerOnTouched(fn: () => void): void;
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker.component.d.ts","sourceRoot":"","sources":["../../../src/lib/datepicker/datepicker.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA4B,YAAY,EAAkD,SAAS,EAA6B,MAAM,eAAe,CAAC;AAC5K,OAAO,EAAqB,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAiB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAgE,MAAM,4BAA4B,CAAC;AACvH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;;AAGhE;;;;;;;;;;;;;;GAcG;AACH,qBA4Fa,qBAAsB,SAAQ,kBAAmB,YAAW,oBAAoB,EAAE,aAAa,EAAE,SAAS;IAC5G,GAAG,EAAE,IAAI,GAAG,IAAI,CAAQ;IACxB,GAAG,EAAE,IAAI,GAAG,IAAI,CAAQ;IACxB,MAAM,SAAgB;IACtB,WAAW,SAAM;IAC1B;;;;;OAKG;IACH,IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAsD;IACjF,IAAI,QAAQ,IAAI,OAAO,CAA+B;IAC5C,WAAW,4BAAmC;IAClC,OAAO,CAAC,SAAS,CAA2B;IAC1C,OAAO,CAAC,WAAW,CAA2C;IAC7C,QAAQ,CAAC,SAAS,QAAQ;IACnE,OAAO,CAAC,GAAG,CAA6B;IAExC,MAAM,UAAS;IAAC,UAAU,UAAS;IAAC,YAAY,SAAM;IACtD,KAAK,EAAE,WAAW,EAAE,EAAE,CAAM;IAAC,QAAQ,WAAa;IAClD,SAAS,EAAE,iBAAiB,EAAE,CAG5B;IACF,OAAO,CAAC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AArB,qBAAqB;CAmIjC"}
@@ -44,7 +44,9 @@ function MJDatepickerComponent_ng_template_11_For_12_Template(rf, ctx) { if (rf
44
44
  } }
45
45
  function MJDatepickerComponent_ng_template_11_Template(rf, ctx) { if (rf & 1) {
46
46
  const _r1 = i0.ɵɵgetCurrentView();
47
- i0.ɵɵelementStart(0, "div", 8)(1, "div", 9)(2, "button", 10);
47
+ i0.ɵɵelementStart(0, "div", 8);
48
+ i0.ɵɵlistener("keydown", function MJDatepickerComponent_ng_template_11_Template_div_keydown_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnCalendarKeyDown($event)); });
49
+ i0.ɵɵelementStart(1, "div", 9)(2, "button", 10);
48
50
  i0.ɵɵlistener("click", function MJDatepickerComponent_ng_template_11_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.PreviousMonth()); });
49
51
  i0.ɵɵelement(3, "i", 11);
50
52
  i0.ɵɵelementEnd();
@@ -214,6 +216,19 @@ export class MJDatepickerComponent extends MJNamedControlBase {
214
216
  this.Close();
215
217
  else if (event.key === 'Enter' && !this.IsOpen)
216
218
  this.Open();
219
+ else if (event.key === 'Tab')
220
+ this.returnTabToField();
221
+ }
222
+ /** Tab in the calendar closes it and returns to the field. The key is not cancelled, so the browser moves on from that field. */
223
+ OnCalendarKeyDown(event) {
224
+ if (event.key === 'Tab')
225
+ this.returnTabToField();
226
+ }
227
+ returnTabToField() {
228
+ if (!this.IsOpen)
229
+ return;
230
+ this.dateInputEl?.nativeElement.focus();
231
+ this.Close();
217
232
  }
218
233
  writeValue(value) {
219
234
  if (value == null) {
@@ -241,7 +256,7 @@ export class MJDatepickerComponent extends MJNamedControlBase {
241
256
  i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.dateInputEl = _t.first);
242
257
  } }, hostVars: 2, hostBindings: function MJDatepickerComponent_HostBindings(rf, ctx) { if (rf & 2) {
243
258
  i0.ɵɵclassProp("mj-datepicker-host", ctx.hostClass);
244
- } }, inputs: { Min: "Min", Max: "Max", Format: "Format", Placeholder: "Placeholder", Disabled: "Disabled" }, outputs: { ValueChange: "ValueChange" }, features: [i0.ɵɵProvidersFeature([{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MJDatepickerComponent), multi: true }]), i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 18, consts: [["trigger", "", "overlayOrigin", "cdkOverlayOrigin"], ["dateInput", ""], ["cdkOverlayOrigin", "", 1, "mj-datepicker"], ["type", "text", 1, "mj-input", "mj-datepicker-input", 3, "input", "blur", "keydown", "placeholder", "disabled", "value"], ["aria-hidden", "true", 1, "mj-datepicker-sr-only"], ["type", "button", "tabindex", "-1", 1, "mj-datepicker-toggle", 3, "click", "disabled"], [1, "fa-solid", "fa-calendar"], ["cdkConnectedOverlay", "", "cdkConnectedOverlayBackdropClass", "mj-dropdown-backdrop", 3, "backdropClick", "detach", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayOpen", "cdkConnectedOverlayPositions", "cdkConnectedOverlayHasBackdrop"], ["role", "grid", 1, "mj-calendar"], [1, "mj-calendar-header"], ["type", "button", "aria-label", "Previous month", 1, "mj-calendar-nav", 3, "click"], [1, "fa-solid", "fa-chevron-left"], [1, "mj-calendar-title"], ["type", "button", "aria-label", "Next month", 1, "mj-calendar-nav", 3, "click"], [1, "fa-solid", "fa-chevron-right"], ["role", "row", 1, "mj-calendar-weekdays"], ["role", "columnheader", 1, "mj-calendar-weekday"], ["role", "row", 1, "mj-calendar-row"], [1, "mj-calendar-footer"], ["type", "button", 1, "mj-calendar-today", 3, "click"], ["type", "button", "role", "gridcell", 1, "mj-calendar-day", 3, "mj-calendar-day--selected", "mj-calendar-day--today", "mj-calendar-day--other-month", "disabled"], ["type", "button", "role", "gridcell", 1, "mj-calendar-day", 3, "click", "disabled"]], template: function MJDatepickerComponent_Template(rf, ctx) { if (rf & 1) {
259
+ } }, inputs: { Min: "Min", Max: "Max", Format: "Format", Placeholder: "Placeholder", Disabled: "Disabled" }, outputs: { ValueChange: "ValueChange" }, features: [i0.ɵɵProvidersFeature([{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MJDatepickerComponent), multi: true }]), i0.ɵɵInheritDefinitionFeature], decls: 12, vars: 18, consts: [["trigger", "", "overlayOrigin", "cdkOverlayOrigin"], ["dateInput", ""], ["cdkOverlayOrigin", "", 1, "mj-datepicker"], ["type", "text", 1, "mj-input", "mj-datepicker-input", 3, "input", "blur", "keydown", "placeholder", "disabled", "value"], ["aria-hidden", "true", 1, "mj-datepicker-sr-only"], ["type", "button", "tabindex", "-1", 1, "mj-datepicker-toggle", 3, "click", "disabled"], [1, "fa-solid", "fa-calendar"], ["cdkConnectedOverlay", "", "cdkConnectedOverlayBackdropClass", "mj-dropdown-backdrop", 3, "backdropClick", "detach", "cdkConnectedOverlayOrigin", "cdkConnectedOverlayOpen", "cdkConnectedOverlayPositions", "cdkConnectedOverlayHasBackdrop"], ["role", "grid", 1, "mj-calendar", 3, "keydown"], [1, "mj-calendar-header"], ["type", "button", "aria-label", "Previous month", 1, "mj-calendar-nav", 3, "click"], [1, "fa-solid", "fa-chevron-left"], [1, "mj-calendar-title"], ["type", "button", "aria-label", "Next month", 1, "mj-calendar-nav", 3, "click"], [1, "fa-solid", "fa-chevron-right"], ["role", "row", 1, "mj-calendar-weekdays"], ["role", "columnheader", 1, "mj-calendar-weekday"], ["role", "row", 1, "mj-calendar-row"], [1, "mj-calendar-footer"], ["type", "button", 1, "mj-calendar-today", 3, "click"], ["type", "button", "role", "gridcell", 1, "mj-calendar-day", 3, "mj-calendar-day--selected", "mj-calendar-day--today", "mj-calendar-day--other-month", "disabled"], ["type", "button", "role", "gridcell", 1, "mj-calendar-day", 3, "click", "disabled"]], template: function MJDatepickerComponent_Template(rf, ctx) { if (rf & 1) {
245
260
  i0.ɵɵelementStart(0, "div", 2, 0)(3, "input", 3, 1);
246
261
  i0.ɵɵlistener("input", function MJDatepickerComponent_Template_input_input_3_listener($event) { return ctx.OnInputChange($event); })("blur", function MJDatepickerComponent_Template_input_blur_3_listener() { return ctx.OnBlur(); })("keydown", function MJDatepickerComponent_Template_input_keydown_3_listener($event) { return ctx.OnKeyDown($event); });
247
262
  i0.ɵɵelementEnd();
@@ -311,7 +326,8 @@ export class MJDatepickerComponent extends MJNamedControlBase {
311
326
  (backdropClick)="Close()" (detach)="Close()">
312
327
  <div class="mj-calendar" role="grid"
313
328
  [attr.aria-labelledby]="CalendarLabelledBy || null"
314
- [attr.aria-label]="CalendarLabelledBy ? null : CalendarLabel">
329
+ [attr.aria-label]="CalendarLabelledBy ? null : CalendarLabel"
330
+ (keydown)="OnCalendarKeyDown($event)">
315
331
  <div class="mj-calendar-header">
316
332
  <button type="button" (click)="PreviousMonth()" aria-label="Previous month" class="mj-calendar-nav">
317
333
  <i class="fa-solid fa-chevron-left"></i></button>
@@ -362,5 +378,5 @@ export class MJDatepickerComponent extends MJNamedControlBase {
362
378
  type: HostBinding,
363
379
  args: ['class.mj-datepicker-host']
364
380
  }] }); })();
365
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDatepickerComponent, { className: "MJDatepickerComponent", filePath: "lib/datepicker/datepicker.component.ts", lineNumber: 115 }); })();
381
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDatepickerComponent, { className: "MJDatepickerComponent", filePath: "lib/datepicker/datepicker.component.ts", lineNumber: 116 }); })();
366
382
  //# sourceMappingURL=datepicker.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datepicker.component.js","sourceRoot":"","sources":["../../../src/lib/datepicker/datepicker.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAc,SAAS,EAAa,MAA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OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,sBAAsB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;kBAG7G,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAGL,MAAM;;kBACN,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,WAAW;;kBACrB,WAAW;mBAAC,0BAA0B;;kFAjB5B,qBAAqB","sourcesContent":["import { AfterViewInit, Component, Input, Output, EventEmitter, forwardRef, HostBinding, ElementRef, ViewChild, OnDestroy, inject, ChangeDetectorRef } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { CalendarDay, WEEK_DAYS, BuildCalendarWeeks, FormatDate, GetMonthYearLabel } from '../calendar/calendar-utils';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-datepicker — Date picker with calendar popup. Replaces `<kendo-datepicker>`.\n *\n * Without an accessible name the date field announces as \"edit, blank\" and its calendar popup as a\n * generic \"Calendar\" — so a form with a start date and an end date presents two identical grids\n * (WCAG 2.1 4.1.2). Use {@link MJNamedControlBase.AriaLabelledBy} when a visible label exists,\n * {@link MJNamedControlBase.AriaLabel} when none does; the toggle button and the calendar take\n * their names from the same source. The field is a real `<input>`, so\n * {@link MJNamedControlBase.InputId} IS a valid `<label for>` target.\n *\n * @example\n * ```html\n * <mj-datepicker AriaLabel=\"Due date\" [(ngModel)]=\"dueDate\" [Min]=\"minDate\" />\n * ```\n */\n@Component({\n selector: 'mj-datepicker',\n standalone: true,\n imports: [OverlayModule],\n template: `\n <div class=\"mj-datepicker\" #trigger cdkOverlayOrigin #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-datepicker--disabled]=\"IsDisabled\">\n <input #dateInput class=\"mj-input mj-datepicker-input\" type=\"text\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [placeholder]=\"Placeholder\" [disabled]=\"IsDisabled\" [value]=\"DisplayValue\"\n (input)=\"OnInputChange($event)\" (blur)=\"OnBlur()\" (keydown)=\"OnKeyDown($event)\" />\n <!--\n The fixed words live in hidden spans rather than in concatenated strings so the\n AriaLabelledBy path can name the toggle and the calendar from the same visible label that\n names the field: aria-labelledby takes an ID LIST, so the word plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text. The\n calendar's word sits here, outside the overlay, because ids resolve document-wide.\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the name\n (accname §4.1), so aria-hidden keeps the word out of the reading order without costing the\n composed name.\n -->\n <span class=\"mj-datepicker-sr-only\" aria-hidden=\"true\" [attr.id]=\"SecondaryWordId('toggle-word')\">Open calendar for</span>\n <span class=\"mj-datepicker-sr-only\" aria-hidden=\"true\" [attr.id]=\"SecondaryWordId('calendar-word')\">Calendar for</span>\n <button type=\"button\" class=\"mj-datepicker-toggle\" tabindex=\"-1\" [disabled]=\"IsDisabled\"\n (click)=\"Toggle()\"\n [attr.aria-labelledby]=\"ToggleLabelledBy || null\"\n [attr.aria-label]=\"ToggleLabelledBy ? null : ToggleLabel\">\n <i class=\"fa-solid fa-calendar\"></i>\n </button>\n </div>\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\" [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\" cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\" (detach)=\"Close()\">\n <div class=\"mj-calendar\" role=\"grid\"\n [attr.aria-labelledby]=\"CalendarLabelledBy || null\"\n [attr.aria-label]=\"CalendarLabelledBy ? null : CalendarLabel\">\n <div class=\"mj-calendar-header\">\n <button type=\"button\" (click)=\"PreviousMonth()\" aria-label=\"Previous month\" class=\"mj-calendar-nav\">\n <i class=\"fa-solid fa-chevron-left\"></i></button>\n <span class=\"mj-calendar-title\">{{ MonthYearLabel }}</span>\n <button type=\"button\" (click)=\"NextMonth()\" aria-label=\"Next month\" class=\"mj-calendar-nav\">\n <i class=\"fa-solid fa-chevron-right\"></i></button>\n </div>\n <div class=\"mj-calendar-weekdays\" role=\"row\">\n @for (day of WeekDays; track day) { <span class=\"mj-calendar-weekday\" role=\"columnheader\">{{ day }}</span> }\n </div>\n @for (week of Weeks; track $index) {\n <div class=\"mj-calendar-row\" role=\"row\">\n @for (day of week; track day.date.getTime()) {\n <button type=\"button\" class=\"mj-calendar-day\" role=\"gridcell\"\n [class.mj-calendar-day--selected]=\"IsSelectedDay(day)\"\n [class.mj-calendar-day--today]=\"day.isToday\"\n [class.mj-calendar-day--other-month]=\"!day.isCurrentMonth\"\n [disabled]=\"IsOutOfRange(day)\" [attr.aria-selected]=\"IsSelectedDay(day)\"\n (click)=\"SelectDate(day)\">{{ day.dayNumber }}</button>\n }\n </div>\n }\n <div class=\"mj-calendar-footer\">\n <button type=\"button\" class=\"mj-calendar-today\" (click)=\"SelectToday()\">Today</button>\n </div>\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-datepicker-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: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MJDatepickerComponent), multi: true }]\n})\nexport class MJDatepickerComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Min: Date | null = null;\n @Input() Max: Date | null = null;\n @Input() Format = 'MM/dd/yyyy';\n @Input() Placeholder = '';\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, and the gate has\n * to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) { this.disabledInput = value; this.syncDisabled(); }\n get Disabled(): boolean { return this.disabledInput; }\n @Output() ValueChange = new EventEmitter<Date | null>();\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('dateInput') private dateInputEl: ElementRef<HTMLInputElement> | undefined;\n @HostBinding('class.mj-datepicker-host') readonly hostClass = true;\n private cdr = inject(ChangeDetectorRef);\n\n IsOpen = false; IsDisabled = false; DisplayValue = '';\n Weeks: CalendarDay[][] = []; WeekDays = WEEK_DAYS;\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n private viewDate = new Date();\n private selectedDate: Date | null = null;\n private onChange: (value: Date | null) => void = () => {};\n private onTouched: () => void = () => {};\n\n get MonthYearLabel(): string { return GetMonthYearLabel(this.viewDate); }\n\n /** `aria-labelledby` id list for the toggle button when a VISIBLE label names the field. */\n get ToggleLabelledBy(): string { return this.SecondaryLabelledBy('toggle-word'); }\n\n /** `aria-label` for the toggle button in the no-visible-label case. */\n get ToggleLabel(): string { return this.SecondaryLabel('Open calendar for', 'Open calendar'); }\n\n /** `aria-labelledby` id list for the calendar grid when a VISIBLE label names the field. */\n get CalendarLabelledBy(): string { return this.SecondaryLabelledBy('calendar-word'); }\n\n /** `aria-label` for the calendar grid in the no-visible-label case. */\n get CalendarLabel(): string { return this.SecondaryLabel('Calendar for', 'Calendar'); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.dateInputEl?.nativeElement, 'mj-datepicker'); }\n\n Toggle(): void { if (this.IsDisabled) return; this.IsOpen ? this.Close() : this.Open(); }\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.viewDate = this.selectedDate ? new Date(this.selectedDate) : new Date();\n this.Weeks = BuildCalendarWeeks(this.viewDate); this.IsOpen = true; this.cdr.detectChanges();\n }\n Close(): void { if (!this.IsOpen) return; this.IsOpen = false; this.cdr.detectChanges(); }\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 * Closes the calendar directly rather than via `Close()`: this can run from an @Input setter,\n * i.e. DURING the parent's CD pass, where a nested `detectChanges()` trips NG0100.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n if (disabled) this.IsOpen = false;\n this.cdr.markForCheck();\n }\n PreviousMonth(): void { this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() - 1, 1); this.Weeks = BuildCalendarWeeks(this.viewDate); }\n NextMonth(): void { this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() + 1, 1); this.Weeks = BuildCalendarWeeks(this.viewDate); }\n\n SelectDate(day: CalendarDay): void {\n if (this.IsOutOfRange(day)) return;\n this.selectedDate = day.date; this.DisplayValue = FormatDate(day.date);\n this.onChange(day.date); this.ValueChange.emit(day.date); this.Close();\n }\n SelectToday(): void {\n const today = new Date(); today.setHours(0, 0, 0, 0);\n this.selectedDate = today; this.DisplayValue = FormatDate(today);\n this.onChange(today); this.ValueChange.emit(today); this.Close();\n }\n IsSelectedDay(day: CalendarDay): boolean {\n if (!this.selectedDate) return false;\n return day.date.getFullYear() === this.selectedDate.getFullYear() && day.date.getMonth() === this.selectedDate.getMonth() && day.date.getDate() === this.selectedDate.getDate();\n }\n IsOutOfRange(day: CalendarDay): boolean {\n if (this.Min && day.date < this.Min) return true;\n if (this.Max && day.date > this.Max) return true;\n return false;\n }\n OnInputChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value; this.DisplayValue = value;\n const parsed = new Date(value);\n if (!isNaN(parsed.getTime())) { this.selectedDate = parsed; this.onChange(parsed); this.ValueChange.emit(parsed); }\n }\n OnBlur(): void { this.onTouched(); }\n OnKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape') this.Close();\n else if (event.key === 'Enter' && !this.IsOpen) this.Open();\n }\n writeValue(value: Date | string | null): void {\n if (value == null) { this.selectedDate = null; this.DisplayValue = ''; }\n else { const d = typeof value === 'string' ? new Date(value) : value; if (!isNaN(d.getTime())) { this.selectedDate = d; this.DisplayValue = FormatDate(d); } }\n }\n registerOnChange(fn: (value: Date | null) => 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"]}
1
+ {"version":3,"file":"datepicker.component.js","sourceRoot":"","sources":["../../../src/lib/datepicker/datepicker.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAc,SAAS,EAAa,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5K,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AACzE,O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4C;;YAClC,eAAuB;YAAvB,yCAAuB;;YAOzD,eAA2C;YAE1E,AADmC,AAAnC,AAD+B,4DAA2C,uCACxC,+CAA2C,wCACtC;4BAhCjC,aAAa;;iFA0FZ,qBAAqB;cA7FjC,SAAS;2BACE,eAAe,cACb,IAAI,WACP,CAAC,aAAa,CAAC,YACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgET,aAuBU,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,sBAAsB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;kBAG7G,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAOL,KAAK;;kBAGL,MAAM;;kBACN,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,WAAW;;kBACrB,WAAW;mBAAC,0BAA0B;;kFAjB5B,qBAAqB","sourcesContent":["import { AfterViewInit, Component, Input, Output, EventEmitter, forwardRef, HostBinding, ElementRef, ViewChild, OnDestroy, inject, ChangeDetectorRef } from '@angular/core';\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms';\nimport { OverlayModule, ConnectedPosition } from '@angular/cdk/overlay';\nimport { CalendarDay, WEEK_DAYS, BuildCalendarWeeks, FormatDate, GetMonthYearLabel } from '../calendar/calendar-utils';\nimport { MJNamedControlBase } from '../a11y/named-control.base';\nimport { WarnIfUnnamed } from '../a11y/unnamed-control-guard';\n\n/**\n * mj-datepicker — Date picker with calendar popup. Replaces `<kendo-datepicker>`.\n *\n * Without an accessible name the date field announces as \"edit, blank\" and its calendar popup as a\n * generic \"Calendar\" — so a form with a start date and an end date presents two identical grids\n * (WCAG 2.1 4.1.2). Use {@link MJNamedControlBase.AriaLabelledBy} when a visible label exists,\n * {@link MJNamedControlBase.AriaLabel} when none does; the toggle button and the calendar take\n * their names from the same source. The field is a real `<input>`, so\n * {@link MJNamedControlBase.InputId} IS a valid `<label for>` target.\n *\n * @example\n * ```html\n * <mj-datepicker AriaLabel=\"Due date\" [(ngModel)]=\"dueDate\" [Min]=\"minDate\" />\n * ```\n */\n@Component({\n selector: 'mj-datepicker',\n standalone: true,\n imports: [OverlayModule],\n template: `\n <div class=\"mj-datepicker\" #trigger cdkOverlayOrigin #overlayOrigin=\"cdkOverlayOrigin\"\n [class.mj-datepicker--disabled]=\"IsDisabled\">\n <input #dateInput class=\"mj-input mj-datepicker-input\" type=\"text\"\n [attr.id]=\"InputId || null\"\n [attr.aria-label]=\"AriaLabel || null\"\n [attr.aria-labelledby]=\"AriaLabelledBy || null\"\n [attr.aria-describedby]=\"AriaDescribedBy || null\"\n [placeholder]=\"Placeholder\" [disabled]=\"IsDisabled\" [value]=\"DisplayValue\"\n (input)=\"OnInputChange($event)\" (blur)=\"OnBlur()\" (keydown)=\"OnKeyDown($event)\" />\n <!--\n The fixed words live in hidden spans rather than in concatenated strings so the\n AriaLabelledBy path can name the toggle and the calendar from the same visible label that\n names the field: aria-labelledby takes an ID LIST, so the word plus the label's own text is\n composed by the accessibility tree without this component ever seeing that text. The\n calendar's word sits here, outside the overlay, because ids resolve document-wide.\n A hidden node that is DIRECTLY referenced by aria-labelledby is still included in the name\n (accname §4.1), so aria-hidden keeps the word out of the reading order without costing the\n composed name.\n -->\n <span class=\"mj-datepicker-sr-only\" aria-hidden=\"true\" [attr.id]=\"SecondaryWordId('toggle-word')\">Open calendar for</span>\n <span class=\"mj-datepicker-sr-only\" aria-hidden=\"true\" [attr.id]=\"SecondaryWordId('calendar-word')\">Calendar for</span>\n <button type=\"button\" class=\"mj-datepicker-toggle\" tabindex=\"-1\" [disabled]=\"IsDisabled\"\n (click)=\"Toggle()\"\n [attr.aria-labelledby]=\"ToggleLabelledBy || null\"\n [attr.aria-label]=\"ToggleLabelledBy ? null : ToggleLabel\">\n <i class=\"fa-solid fa-calendar\"></i>\n </button>\n </div>\n <ng-template cdkConnectedOverlay [cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n [cdkConnectedOverlayOpen]=\"IsOpen\" [cdkConnectedOverlayPositions]=\"Positions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\" cdkConnectedOverlayBackdropClass=\"mj-dropdown-backdrop\"\n (backdropClick)=\"Close()\" (detach)=\"Close()\">\n <div class=\"mj-calendar\" role=\"grid\"\n [attr.aria-labelledby]=\"CalendarLabelledBy || null\"\n [attr.aria-label]=\"CalendarLabelledBy ? null : CalendarLabel\"\n (keydown)=\"OnCalendarKeyDown($event)\">\n <div class=\"mj-calendar-header\">\n <button type=\"button\" (click)=\"PreviousMonth()\" aria-label=\"Previous month\" class=\"mj-calendar-nav\">\n <i class=\"fa-solid fa-chevron-left\"></i></button>\n <span class=\"mj-calendar-title\">{{ MonthYearLabel }}</span>\n <button type=\"button\" (click)=\"NextMonth()\" aria-label=\"Next month\" class=\"mj-calendar-nav\">\n <i class=\"fa-solid fa-chevron-right\"></i></button>\n </div>\n <div class=\"mj-calendar-weekdays\" role=\"row\">\n @for (day of WeekDays; track day) { <span class=\"mj-calendar-weekday\" role=\"columnheader\">{{ day }}</span> }\n </div>\n @for (week of Weeks; track $index) {\n <div class=\"mj-calendar-row\" role=\"row\">\n @for (day of week; track day.date.getTime()) {\n <button type=\"button\" class=\"mj-calendar-day\" role=\"gridcell\"\n [class.mj-calendar-day--selected]=\"IsSelectedDay(day)\"\n [class.mj-calendar-day--today]=\"day.isToday\"\n [class.mj-calendar-day--other-month]=\"!day.isCurrentMonth\"\n [disabled]=\"IsOutOfRange(day)\" [attr.aria-selected]=\"IsSelectedDay(day)\"\n (click)=\"SelectDate(day)\">{{ day.dayNumber }}</button>\n }\n </div>\n }\n <div class=\"mj-calendar-footer\">\n <button type=\"button\" class=\"mj-calendar-today\" (click)=\"SelectToday()\">Today</button>\n </div>\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-datepicker-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: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => MJDatepickerComponent), multi: true }]\n})\nexport class MJDatepickerComponent extends MJNamedControlBase implements ControlValueAccessor, AfterViewInit, OnDestroy {\n @Input() Min: Date | null = null;\n @Input() Max: Date | null = null;\n @Input() Format = 'MM/dd/yyyy';\n @Input() Placeholder = '';\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, and the gate has\n * to follow it every time.\n */\n @Input()\n set Disabled(value: boolean) { this.disabledInput = value; this.syncDisabled(); }\n get Disabled(): boolean { return this.disabledInput; }\n @Output() ValueChange = new EventEmitter<Date | null>();\n @ViewChild('trigger') private triggerEl!: ElementRef<HTMLElement>;\n @ViewChild('dateInput') private dateInputEl: ElementRef<HTMLInputElement> | undefined;\n @HostBinding('class.mj-datepicker-host') readonly hostClass = true;\n private cdr = inject(ChangeDetectorRef);\n\n IsOpen = false; IsDisabled = false; DisplayValue = '';\n Weeks: CalendarDay[][] = []; WeekDays = WEEK_DAYS;\n Positions: ConnectedPosition[] = [\n { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },\n { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' }\n ];\n private viewDate = new Date();\n private selectedDate: Date | null = null;\n private onChange: (value: Date | null) => void = () => {};\n private onTouched: () => void = () => {};\n\n get MonthYearLabel(): string { return GetMonthYearLabel(this.viewDate); }\n\n /** `aria-labelledby` id list for the toggle button when a VISIBLE label names the field. */\n get ToggleLabelledBy(): string { return this.SecondaryLabelledBy('toggle-word'); }\n\n /** `aria-label` for the toggle button in the no-visible-label case. */\n get ToggleLabel(): string { return this.SecondaryLabel('Open calendar for', 'Open calendar'); }\n\n /** `aria-labelledby` id list for the calendar grid when a VISIBLE label names the field. */\n get CalendarLabelledBy(): string { return this.SecondaryLabelledBy('calendar-word'); }\n\n /** `aria-label` for the calendar grid in the no-visible-label case. */\n get CalendarLabel(): string { return this.SecondaryLabel('Calendar for', 'Calendar'); }\n\n ngAfterViewInit(): void { WarnIfUnnamed(this.dateInputEl?.nativeElement, 'mj-datepicker'); }\n\n Toggle(): void { if (this.IsDisabled) return; this.IsOpen ? this.Close() : this.Open(); }\n Open(): void {\n if (this.IsDisabled || this.IsOpen) return;\n this.viewDate = this.selectedDate ? new Date(this.selectedDate) : new Date();\n this.Weeks = BuildCalendarWeeks(this.viewDate); this.IsOpen = true; this.cdr.detectChanges();\n }\n Close(): void { if (!this.IsOpen) return; this.IsOpen = false; this.cdr.detectChanges(); }\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 * Closes the calendar directly rather than via `Close()`: this can run from an @Input setter,\n * i.e. DURING the parent's CD pass, where a nested `detectChanges()` trips NG0100.\n */\n private syncDisabled(): void {\n const disabled = this.disabledInput || this.formDisabled;\n if (disabled === this.IsDisabled) return;\n this.IsDisabled = disabled;\n if (disabled) this.IsOpen = false;\n this.cdr.markForCheck();\n }\n PreviousMonth(): void { this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() - 1, 1); this.Weeks = BuildCalendarWeeks(this.viewDate); }\n NextMonth(): void { this.viewDate = new Date(this.viewDate.getFullYear(), this.viewDate.getMonth() + 1, 1); this.Weeks = BuildCalendarWeeks(this.viewDate); }\n\n SelectDate(day: CalendarDay): void {\n if (this.IsOutOfRange(day)) return;\n this.selectedDate = day.date; this.DisplayValue = FormatDate(day.date);\n this.onChange(day.date); this.ValueChange.emit(day.date); this.Close();\n }\n SelectToday(): void {\n const today = new Date(); today.setHours(0, 0, 0, 0);\n this.selectedDate = today; this.DisplayValue = FormatDate(today);\n this.onChange(today); this.ValueChange.emit(today); this.Close();\n }\n IsSelectedDay(day: CalendarDay): boolean {\n if (!this.selectedDate) return false;\n return day.date.getFullYear() === this.selectedDate.getFullYear() && day.date.getMonth() === this.selectedDate.getMonth() && day.date.getDate() === this.selectedDate.getDate();\n }\n IsOutOfRange(day: CalendarDay): boolean {\n if (this.Min && day.date < this.Min) return true;\n if (this.Max && day.date > this.Max) return true;\n return false;\n }\n OnInputChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value; this.DisplayValue = value;\n const parsed = new Date(value);\n if (!isNaN(parsed.getTime())) { this.selectedDate = parsed; this.onChange(parsed); this.ValueChange.emit(parsed); }\n }\n OnBlur(): void { this.onTouched(); }\n OnKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Escape') this.Close();\n else if (event.key === 'Enter' && !this.IsOpen) this.Open();\n else if (event.key === 'Tab') this.returnTabToField();\n }\n\n /** Tab in the calendar closes it and returns to the field. The key is not cancelled, so the browser moves on from that field. */\n OnCalendarKeyDown(event: KeyboardEvent): void {\n if (event.key === 'Tab') this.returnTabToField();\n }\n\n private returnTabToField(): void {\n if (!this.IsOpen) return;\n this.dateInputEl?.nativeElement.focus();\n this.Close();\n }\n writeValue(value: Date | string | null): void {\n if (value == null) { this.selectedDate = null; this.DisplayValue = ''; }\n else { const d = typeof value === 'string' ? new Date(value) : value; if (!isNaN(d.getTime())) { this.selectedDate = d; this.DisplayValue = FormatDate(d); } }\n }\n registerOnChange(fn: (value: Date | null) => 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"]}
@@ -9,6 +9,19 @@ export type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';
9
9
  * Supports both explicit width/height and size presets.
10
10
  * Content is projected, with an optional `<mj-dialog-actions>` for the footer.
11
11
  *
12
+ * On open, focus moves to `[data-autofocus]`, else the first field in the body,
13
+ * else the first button in the body or actions (never the ✕), else the container.
14
+ * Tab between stops is left to the browser. Tab on the last stop wraps to the
15
+ * first, and Shift+Tab on the first stop or the container wraps to the last.
16
+ * A Tab that arrives from outside is taken only by the topmost visible dialog,
17
+ * and only when that dialog traps focus and focus is on the page behind it:
18
+ * not in another modal, and not in an overlay panel rendered on the body.
19
+ * A dropdown or calendar that hands focus back to its field is wrapped when
20
+ * that field is the first or last stop, because the key started in the overlay.
21
+ * Focus returns to the trigger on close.
22
+ * `AutoFocus`, `TrapFocus`, and `RestoreFocus` each default on so a dialog that
23
+ * manages focus itself can turn that one behavior off.
24
+ *
12
25
  * @example
13
26
  * ```html
14
27
  * <mj-dialog [Visible]="showDialog" Title="Confirm" (Close)="onClose()">
@@ -21,8 +34,17 @@ export type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';
21
34
  * ```
22
35
  */
23
36
  export declare class MJDialogComponent implements OnDestroy {
37
+ private readonly host;
24
38
  private _visible;
39
+ /** Element that held focus when the dialog opened; restored on close. */
40
+ private previouslyFocused;
41
+ /** Set while the open focus is waiting for the `@if (Visible)` container. */
42
+ private initialFocusPending;
43
+ /** Open dialogs, oldest first. The last visible one decides whether an outside Tab is taken. */
44
+ private static readonly openDialogs;
25
45
  private static nextId;
46
+ private static readonly TAB_STOP_SELECTOR;
47
+ private readonly onDocumentKeyDown;
26
48
  set Visible(value: boolean);
27
49
  get Visible(): boolean;
28
50
  Title: string;
@@ -38,6 +60,23 @@ export declare class MJDialogComponent implements OnDestroy {
38
60
  * response). Backward compatible — existing callers keep `'dialog'`.
39
61
  */
40
62
  Role: 'dialog' | 'alertdialog';
63
+ /** Move focus into the dialog when it opens. Off when the dialog focuses itself. */
64
+ AutoFocus: boolean;
65
+ /**
66
+ * Keep focus in the dialog. The browser moves Tab between stops. Tab on the last
67
+ * stop wraps to the first, and Shift+Tab on the first stop or the container wraps
68
+ * to the last. A Tab from outside is brought in only when this dialog is the topmost
69
+ * visible one and it traps focus, and not while focus is already inside another
70
+ * modal or an overlay panel.
71
+ */
72
+ TrapFocus: boolean;
73
+ /** Return focus to the element that was focused when the dialog opened. */
74
+ RestoreFocus: boolean;
75
+ /**
76
+ * Accessible name (`aria-label`) used only when {@link Title} is empty.
77
+ * A set Title keeps `aria-labelledby` and does not also set `aria-label`.
78
+ */
79
+ AriaLabel: string | null;
41
80
  Close: EventEmitter<void>;
42
81
  DialogId: number;
43
82
  get dialogId(): number;
@@ -50,11 +89,48 @@ export declare class MJDialogComponent implements OnDestroy {
50
89
  OnEscapeKey(): void;
51
90
  OnBackdropClick(event: Event): void;
52
91
  OnCloseClick(): void;
92
+ /**
93
+ * Wraps Tab at the ends of the dialog. A Tab that is already handled, including
94
+ * by a dialog nested inside this one, is left alone. With no enabled control,
95
+ * focus stays on the container (it is `tabindex="-1"`, so it is not itself a tab stop).
96
+ */
97
+ OnTabKey(event: KeyboardEvent): void;
98
+ /**
99
+ * Tab on the last stop wraps to the first. Shift+Tab on the first stop or the
100
+ * container wraps to the last. A Tab in the middle is left for the browser.
101
+ */
102
+ private wrapTabAtEnds;
103
+ ngOnDestroy(): void;
53
104
  private onOpen;
54
105
  private onCloseInternal;
55
- ngOnDestroy(): void;
106
+ private rememberOpen;
107
+ private forgetOpen;
108
+ /**
109
+ * The last visible dialog decides. When that dialog does not trap focus, nobody
110
+ * takes the Tab, including a trapping dialog underneath it.
111
+ */
112
+ private isTopmostOpenDialog;
113
+ private scheduleInitialFocus;
114
+ private cancelPendingInitialFocus;
115
+ private focusInitial;
116
+ private initialFocusTarget;
117
+ /** First element that can take focus. The ✕ is skipped only for the button fallback. */
118
+ private firstEnabled;
119
+ private restoreFocus;
120
+ /** `document.body.focus()` is a no-op unless body is a focusable area; blur lands on body. */
121
+ private focusDocumentBody;
122
+ private containerElement;
123
+ private tabStops;
124
+ /** Real controls only. `tabindex="-1"` (including the container) is the fallback, not a stop. */
125
+ private isTabStop;
126
+ /**
127
+ * display:none and [hidden] hide the whole subtree. visibility is inherited, and a child
128
+ * can set visible again, so that check is only on the element itself.
129
+ */
130
+ private isVisibleStop;
131
+ private isDisabled;
56
132
  static ɵfac: i0.ɵɵFactoryDeclaration<MJDialogComponent, never>;
57
- static ɵcmp: i0.ɵɵComponentDeclaration<MJDialogComponent, "mj-dialog", never, { "Visible": { "alias": "Visible"; "required": false; }; "Title": { "alias": "Title"; "required": false; }; "Width": { "alias": "Width"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "Size": { "alias": "Size"; "required": false; }; "Closeable": { "alias": "Closeable"; "required": false; }; "MinWidth": { "alias": "MinWidth"; "required": false; }; "Role": { "alias": "Role"; "required": false; }; }, { "Close": "Close"; }, never, ["mj-dialog-titlebar", "*", "mj-dialog-actions"], true, never>;
133
+ static ɵcmp: i0.ɵɵComponentDeclaration<MJDialogComponent, "mj-dialog", never, { "Visible": { "alias": "Visible"; "required": false; }; "Title": { "alias": "Title"; "required": false; }; "Width": { "alias": "Width"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "Size": { "alias": "Size"; "required": false; }; "Closeable": { "alias": "Closeable"; "required": false; }; "MinWidth": { "alias": "MinWidth"; "required": false; }; "Role": { "alias": "Role"; "required": false; }; "AutoFocus": { "alias": "AutoFocus"; "required": false; }; "TrapFocus": { "alias": "TrapFocus"; "required": false; }; "RestoreFocus": { "alias": "RestoreFocus"; "required": false; }; "AriaLabel": { "alias": "AriaLabel"; "required": false; }; }, { "Close": "Close"; }, never, ["mj-dialog-titlebar", "*", "mj-dialog-actions"], true, never>;
58
134
  }
59
135
  /**
60
136
  * mj-dialog-titlebar — Custom titlebar content for mj-dialog.
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.component.d.ts","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,YAAY,EAKZ,SAAS,EAEV,MAAM,eAAe,CAAC;;AAEvB,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAU9D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBA2Ca,iBAAkB,YAAW,SAAS;IACjD,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAE1B,IACI,OAAO,CAAC,KAAK,EAAE,OAAO,EASzB;IACD,IAAI,OAAO,IAAI,OAAO,CAErB;IAEQ,KAAK,SAAM;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAQ;IACrC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAQ;IACtC,IAAI,EAAE,YAAY,CAAU;IAC5B,SAAS,UAAQ;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAQ;IAExC;;;;;OAKG;IACM,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAY;IAEzC,KAAK,qBAA4B;IAE3C,QAAQ,SAA8B;IAEtC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,aAAa,IAAI,MAAM,CAK1B;IAED,6CAA6C;IAC7C,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,IAAI,cAAc,IAAI,MAAM,CAK3B;IAED,8CAA8C;IAC9C,IAAI,cAAc,IAAI,MAAM,CAE3B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OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,QAAQ;IAMhB,iGAAiG;IACjG,OAAO,CAAC,SAAS;IAQjB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,UAAU;yCA3VP,iBAAiB;2CAAjB,iBAAiB;CAyW7B;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAKa,yBAAyB;yCAAzB,yBAAyB;2CAAzB,yBAAyB;CAAG;AAEzC;;;;;;;;;;;;GAYG;AACH,qBASa,wBAAwB;yCAAxB,wBAAwB;2CAAxB,wBAAwB;CAAG"}
@@ -1,4 +1,4 @@
1
- import { Component, Input, Output, EventEmitter, HostListener } from '@angular/core';
1
+ import { Component, Input, Output, EventEmitter, HostListener, ElementRef, inject } from '@angular/core';
2
2
  import * as i0 from "@angular/core";
3
3
  const _c0 = ["*", [["mj-dialog-actions"]], [["mj-dialog-titlebar"]]];
4
4
  const _c1 = ["*", "mj-dialog-actions", "mj-dialog-titlebar"];
@@ -37,7 +37,7 @@ function MJDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
37
37
  i0.ɵɵdomElementStart(0, "div", 1);
38
38
  i0.ɵɵdomListener("click", function MJDialogComponent_Conditional_0_Template_div_click_0_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnBackdropClick($event)); });
39
39
  i0.ɵɵdomElementStart(1, "div", 2);
40
- i0.ɵɵdomListener("click", function MJDialogComponent_Conditional_0_Template_div_click_1_listener($event) { return $event.stopPropagation(); });
40
+ i0.ɵɵdomListener("keydown", function MJDialogComponent_Conditional_0_Template_div_keydown_1_listener($event) { i0.ɵɵrestoreView(_r1); const ctx_r1 = i0.ɵɵnextContext(); return i0.ɵɵresetView(ctx_r1.OnTabKey($event)); })("click", function MJDialogComponent_Conditional_0_Template_div_click_1_listener($event) { return $event.stopPropagation(); });
41
41
  i0.ɵɵconditionalCreate(2, MJDialogComponent_Conditional_0_Conditional_2_Template, 4, 2, "div", 3);
42
42
  i0.ɵɵdomElementStart(3, "div", 4);
43
43
  i0.ɵɵprojection(4);
@@ -48,7 +48,7 @@ function MJDialogComponent_Conditional_0_Template(rf, ctx) { if (rf & 1) {
48
48
  const ctx_r1 = i0.ɵɵnextContext();
49
49
  i0.ɵɵadvance();
50
50
  i0.ɵɵstyleProp("width", ctx_r1.resolvedWidth)("height", ctx_r1.resolvedHeight)("max-width", "90vw")("max-height", "90vh");
51
- i0.ɵɵattribute("role", ctx_r1.Role)("aria-labelledby", ctx_r1.Title ? "mj-dialog-title-" + ctx_r1.dialogId : null);
51
+ i0.ɵɵattribute("role", ctx_r1.Role)("aria-labelledby", ctx_r1.Title ? "mj-dialog-title-" + ctx_r1.dialogId : null)("aria-label", ctx_r1.Title ? null : ctx_r1.AriaLabel || null);
52
52
  i0.ɵɵadvance();
53
53
  i0.ɵɵconditional(ctx_r1.Title || ctx_r1.Closeable ? 2 : -1);
54
54
  } }
@@ -68,6 +68,19 @@ const SIZE_MAP = {
68
68
  * Supports both explicit width/height and size presets.
69
69
  * Content is projected, with an optional `<mj-dialog-actions>` for the footer.
70
70
  *
71
+ * On open, focus moves to `[data-autofocus]`, else the first field in the body,
72
+ * else the first button in the body or actions (never the ✕), else the container.
73
+ * Tab between stops is left to the browser. Tab on the last stop wraps to the
74
+ * first, and Shift+Tab on the first stop or the container wraps to the last.
75
+ * A Tab that arrives from outside is taken only by the topmost visible dialog,
76
+ * and only when that dialog traps focus and focus is on the page behind it:
77
+ * not in another modal, and not in an overlay panel rendered on the body.
78
+ * A dropdown or calendar that hands focus back to its field is wrapped when
79
+ * that field is the first or last stop, because the key started in the overlay.
80
+ * Focus returns to the trigger on close.
81
+ * `AutoFocus`, `TrapFocus`, and `RestoreFocus` each default on so a dialog that
82
+ * manages focus itself can turn that one behavior off.
83
+ *
71
84
  * @example
72
85
  * ```html
73
86
  * <mj-dialog [Visible]="showDialog" Title="Confirm" (Close)="onClose()">
@@ -80,8 +93,51 @@ const SIZE_MAP = {
80
93
  * ```
81
94
  */
82
95
  export class MJDialogComponent {
96
+ host = inject(ElementRef);
83
97
  _visible = false;
98
+ /** Element that held focus when the dialog opened; restored on close. */
99
+ previouslyFocused = null;
100
+ /** Set while the open focus is waiting for the `@if (Visible)` container. */
101
+ initialFocusPending = false;
102
+ /** Open dialogs, oldest first. The last visible one decides whether an outside Tab is taken. */
103
+ static openDialogs = [];
84
104
  static nextId = 0;
105
+ static TAB_STOP_SELECTOR = 'a[href], button, input, select, textarea, [contenteditable]:not([contenteditable="false"]), [tabindex]';
106
+ onDocumentKeyDown = (event) => {
107
+ if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this._visible)
108
+ return;
109
+ if (event.altKey || event.ctrlKey || event.metaKey)
110
+ return;
111
+ if (!this.isTopmostOpenDialog())
112
+ return;
113
+ const container = this.containerElement();
114
+ if (!container)
115
+ return;
116
+ const active = document.activeElement;
117
+ // Another modal keeps its Tab. An overlay panel that still holds focus (a filter
118
+ // popover, or any panel that does not move focus itself) keeps it too.
119
+ if (active instanceof Element) {
120
+ const modal = active.closest('[aria-modal="true"]');
121
+ if (modal && modal !== container)
122
+ return;
123
+ if (active.closest('.cdk-overlay-container'))
124
+ return;
125
+ }
126
+ const focusInside = active instanceof Node && container.contains(active);
127
+ const startedOutside = !(event.target instanceof Node && container.contains(event.target));
128
+ // A dropdown or calendar focuses its field and leaves the key alone. The key
129
+ // started in the overlay, so the container never saw it. Wrap at the ends.
130
+ if (focusInside && startedOutside) {
131
+ this.wrapTabAtEnds(event, container);
132
+ return;
133
+ }
134
+ if (focusInside)
135
+ return;
136
+ const stops = this.tabStops(container);
137
+ event.preventDefault();
138
+ const target = stops.length === 0 ? container : (event.shiftKey ? stops[stops.length - 1] : stops[0]);
139
+ target.focus();
140
+ };
85
141
  set Visible(value) {
86
142
  const wasVisible = this._visible;
87
143
  this._visible = value;
@@ -108,6 +164,23 @@ export class MJDialogComponent {
108
164
  * response). Backward compatible — existing callers keep `'dialog'`.
109
165
  */
110
166
  Role = 'dialog';
167
+ /** Move focus into the dialog when it opens. Off when the dialog focuses itself. */
168
+ AutoFocus = true;
169
+ /**
170
+ * Keep focus in the dialog. The browser moves Tab between stops. Tab on the last
171
+ * stop wraps to the first, and Shift+Tab on the first stop or the container wraps
172
+ * to the last. A Tab from outside is brought in only when this dialog is the topmost
173
+ * visible one and it traps focus, and not while focus is already inside another
174
+ * modal or an overlay panel.
175
+ */
176
+ TrapFocus = true;
177
+ /** Return focus to the element that was focused when the dialog opened. */
178
+ RestoreFocus = true;
179
+ /**
180
+ * Accessible name (`aria-label`) used only when {@link Title} is empty.
181
+ * A set Title keeps `aria-labelledby` and does not also set `aria-label`.
182
+ */
183
+ AriaLabel = null;
111
184
  Close = new EventEmitter();
112
185
  DialogId = MJDialogComponent.nextId++;
113
186
  get dialogId() {
@@ -146,21 +219,219 @@ export class MJDialogComponent {
146
219
  OnCloseClick() {
147
220
  this.Close.emit();
148
221
  }
222
+ /**
223
+ * Wraps Tab at the ends of the dialog. A Tab that is already handled, including
224
+ * by a dialog nested inside this one, is left alone. With no enabled control,
225
+ * focus stays on the container (it is `tabindex="-1"`, so it is not itself a tab stop).
226
+ */
227
+ OnTabKey(event) {
228
+ if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this.Visible)
229
+ return;
230
+ if (event.altKey || event.ctrlKey || event.metaKey)
231
+ return;
232
+ const container = event.currentTarget;
233
+ if (!(container instanceof HTMLElement))
234
+ return;
235
+ this.wrapTabAtEnds(event, container);
236
+ }
237
+ /**
238
+ * Tab on the last stop wraps to the first. Shift+Tab on the first stop or the
239
+ * container wraps to the last. A Tab in the middle is left for the browser.
240
+ */
241
+ wrapTabAtEnds(event, container) {
242
+ const stops = this.tabStops(container);
243
+ if (stops.length === 0) {
244
+ event.preventDefault();
245
+ container.focus();
246
+ return;
247
+ }
248
+ const active = document.activeElement;
249
+ const index = active instanceof HTMLElement ? stops.indexOf(active) : -1;
250
+ const onContainer = active === container;
251
+ if (event.shiftKey) {
252
+ if (index === 0 || onContainer) {
253
+ event.preventDefault();
254
+ stops[stops.length - 1].focus();
255
+ }
256
+ return;
257
+ }
258
+ if (index === stops.length - 1) {
259
+ event.preventDefault();
260
+ stops[0].focus();
261
+ }
262
+ }
263
+ ngOnDestroy() {
264
+ this.cancelPendingInitialFocus();
265
+ this.forgetOpen();
266
+ document.removeEventListener('keydown', this.onDocumentKeyDown);
267
+ if (this._visible) {
268
+ this.restoreFocus();
269
+ }
270
+ document.body.style.overflow = '';
271
+ }
149
272
  onOpen() {
273
+ this.rememberOpen();
150
274
  document.body.style.overflow = 'hidden';
275
+ document.addEventListener('keydown', this.onDocumentKeyDown);
276
+ const active = document.activeElement;
277
+ this.previouslyFocused = active instanceof HTMLElement ? active : null;
278
+ if (this.AutoFocus) {
279
+ this.scheduleInitialFocus();
280
+ }
151
281
  }
152
282
  onCloseInternal() {
153
283
  document.body.style.overflow = '';
284
+ document.removeEventListener('keydown', this.onDocumentKeyDown);
285
+ this.cancelPendingInitialFocus();
286
+ this.forgetOpen();
287
+ this.restoreFocus();
154
288
  }
155
- ngOnDestroy() {
156
- document.body.style.overflow = '';
289
+ rememberOpen() {
290
+ if (!MJDialogComponent.openDialogs.includes(this)) {
291
+ MJDialogComponent.openDialogs.push(this);
292
+ }
293
+ }
294
+ forgetOpen() {
295
+ const index = MJDialogComponent.openDialogs.indexOf(this);
296
+ if (index >= 0) {
297
+ MJDialogComponent.openDialogs.splice(index, 1);
298
+ }
299
+ }
300
+ /**
301
+ * The last visible dialog decides. When that dialog does not trap focus, nobody
302
+ * takes the Tab, including a trapping dialog underneath it.
303
+ */
304
+ isTopmostOpenDialog() {
305
+ for (let i = MJDialogComponent.openDialogs.length - 1; i >= 0; i--) {
306
+ const dialog = MJDialogComponent.openDialogs[i];
307
+ if (!dialog._visible)
308
+ continue;
309
+ return dialog === this && dialog.TrapFocus;
310
+ }
311
+ return false;
312
+ }
313
+ scheduleInitialFocus() {
314
+ this.initialFocusPending = true;
315
+ // The Visible setter runs before `@if` inserts `.mj-dialog-container`.
316
+ Promise.resolve().then(() => {
317
+ if (!this.initialFocusPending)
318
+ return;
319
+ this.initialFocusPending = false;
320
+ this.focusInitial();
321
+ });
322
+ }
323
+ cancelPendingInitialFocus() {
324
+ this.initialFocusPending = false;
325
+ }
326
+ focusInitial() {
327
+ if (!this._visible || !this.AutoFocus)
328
+ return;
329
+ const container = this.containerElement();
330
+ if (!container)
331
+ return;
332
+ this.initialFocusTarget(container).focus();
333
+ }
334
+ initialFocusTarget(container) {
335
+ const marked = this.firstEnabled(container.querySelectorAll('[data-autofocus]'));
336
+ if (marked)
337
+ return marked;
338
+ const field = this.firstEnabled(container.querySelectorAll('.mj-dialog-body input, .mj-dialog-body select, .mj-dialog-body textarea'));
339
+ if (field)
340
+ return field;
341
+ const button = this.firstEnabled(container.querySelectorAll('.mj-dialog-body button, .mj-dialog-actions button'), true);
342
+ if (button)
343
+ return button;
344
+ return container;
345
+ }
346
+ /** First element that can take focus. The ✕ is skipped only for the button fallback. */
347
+ firstEnabled(nodes, skipClose = false) {
348
+ for (const el of Array.from(nodes)) {
349
+ if (skipClose && el.classList.contains('mj-dialog-close'))
350
+ continue;
351
+ if (this.isDisabled(el))
352
+ continue;
353
+ if (el instanceof HTMLInputElement && el.type === 'hidden')
354
+ continue;
355
+ return el;
356
+ }
357
+ return null;
358
+ }
359
+ restoreFocus() {
360
+ const target = this.previouslyFocused;
361
+ this.previouslyFocused = null;
362
+ if (!this.RestoreFocus)
363
+ return;
364
+ // The trigger is outside the dialog. An element inside this host is about to be removed.
365
+ if (target && target !== document.body && document.contains(target) && !this.host.nativeElement.contains(target)) {
366
+ target.focus();
367
+ return;
368
+ }
369
+ this.focusDocumentBody();
370
+ }
371
+ /** `document.body.focus()` is a no-op unless body is a focusable area; blur lands on body. */
372
+ focusDocumentBody() {
373
+ const active = document.activeElement;
374
+ if (active instanceof HTMLElement && active !== document.body) {
375
+ active.blur();
376
+ }
377
+ if (document.activeElement !== document.body) {
378
+ document.body.focus();
379
+ }
380
+ }
381
+ containerElement() {
382
+ const found = this.host.nativeElement.querySelector('.mj-dialog-container');
383
+ return found instanceof HTMLElement ? found : null;
384
+ }
385
+ tabStops(container) {
386
+ return Array.from(container.querySelectorAll(MJDialogComponent.TAB_STOP_SELECTOR)).filter((el) => this.isTabStop(el));
387
+ }
388
+ /** Real controls only. `tabindex="-1"` (including the container) is the fallback, not a stop. */
389
+ isTabStop(el) {
390
+ if (el.getAttribute('tabindex') === '-1')
391
+ return false;
392
+ if (this.isDisabled(el))
393
+ return false;
394
+ if (el instanceof HTMLInputElement && el.type === 'hidden')
395
+ return false;
396
+ if (!this.isVisibleStop(el))
397
+ return false;
398
+ return true;
399
+ }
400
+ /**
401
+ * display:none and [hidden] hide the whole subtree. visibility is inherited, and a child
402
+ * can set visible again, so that check is only on the element itself.
403
+ */
404
+ isVisibleStop(el) {
405
+ if (getComputedStyle(el).visibility === 'hidden')
406
+ return false;
407
+ let current = el;
408
+ while (current) {
409
+ if (current.hasAttribute('hidden'))
410
+ return false;
411
+ if (getComputedStyle(current).display === 'none')
412
+ return false;
413
+ current = current.parentElement;
414
+ }
415
+ return true;
416
+ }
417
+ isDisabled(el) {
418
+ if (el instanceof HTMLButtonElement ||
419
+ el instanceof HTMLInputElement ||
420
+ el instanceof HTMLSelectElement ||
421
+ el instanceof HTMLTextAreaElement ||
422
+ el instanceof HTMLFieldSetElement ||
423
+ el instanceof HTMLOptGroupElement ||
424
+ el instanceof HTMLOptionElement) {
425
+ return el.disabled;
426
+ }
427
+ return el.hasAttribute('disabled');
157
428
  }
158
429
  static ɵfac = function MJDialogComponent_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || MJDialogComponent)(); };
159
430
  static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJDialogComponent, selectors: [["mj-dialog"]], hostBindings: function MJDialogComponent_HostBindings(rf, ctx) { if (rf & 1) {
160
431
  i0.ɵɵlistener("keydown.escape", function MJDialogComponent_keydown_escape_HostBindingHandler() { return ctx.OnEscapeKey(); }, i0.ɵɵresolveDocument);
161
- } }, inputs: { Visible: "Visible", Title: "Title", Width: "Width", Height: "Height", Size: "Size", Closeable: "Closeable", MinWidth: "MinWidth", Role: "Role" }, outputs: { Close: "Close" }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[1, "mj-dialog-backdrop"], [1, "mj-dialog-backdrop", 3, "click"], ["aria-modal", "true", 1, "mj-dialog-container", 3, "click"], [1, "mj-dialog-titlebar"], [1, "mj-dialog-body"], [1, "mj-dialog-title", 3, "id"], ["aria-label", "Close dialog", 1, "mj-dialog-close"], ["aria-label", "Close dialog", 1, "mj-dialog-close", 3, "click"], [1, "fa-solid", "fa-times"]], template: function MJDialogComponent_Template(rf, ctx) { if (rf & 1) {
432
+ } }, inputs: { Visible: "Visible", Title: "Title", Width: "Width", Height: "Height", Size: "Size", Closeable: "Closeable", MinWidth: "MinWidth", Role: "Role", AutoFocus: "AutoFocus", TrapFocus: "TrapFocus", RestoreFocus: "RestoreFocus", AriaLabel: "AriaLabel" }, outputs: { Close: "Close" }, ngContentSelectors: _c1, decls: 1, vars: 1, consts: [[1, "mj-dialog-backdrop"], [1, "mj-dialog-backdrop", 3, "click"], ["aria-modal", "true", "tabindex", "-1", 1, "mj-dialog-container", 3, "keydown", "click"], [1, "mj-dialog-titlebar"], [1, "mj-dialog-body"], [1, "mj-dialog-title", 3, "id"], ["aria-label", "Close dialog", 1, "mj-dialog-close"], ["aria-label", "Close dialog", 1, "mj-dialog-close", 3, "click"], [1, "fa-solid", "fa-times"]], template: function MJDialogComponent_Template(rf, ctx) { if (rf & 1) {
162
433
  i0.ɵɵprojectionDef(_c0);
163
- i0.ɵɵconditionalCreate(0, MJDialogComponent_Conditional_0_Template, 6, 11, "div", 0);
434
+ i0.ɵɵconditionalCreate(0, MJDialogComponent_Conditional_0_Template, 6, 12, "div", 0);
164
435
  } if (rf & 2) {
165
436
  i0.ɵɵconditional(ctx.Visible ? 0 : -1);
166
437
  } }, encapsulation: 2 });
@@ -176,11 +447,14 @@ export class MJDialogComponent {
176
447
  <div class="mj-dialog-container"
177
448
  [attr.role]="Role"
178
449
  aria-modal="true"
450
+ tabindex="-1"
179
451
  [attr.aria-labelledby]="Title ? 'mj-dialog-title-' + dialogId : null"
452
+ [attr.aria-label]="Title ? null : (AriaLabel || null)"
180
453
  [style.width]="resolvedWidth"
181
454
  [style.height]="resolvedHeight"
182
455
  [style.max-width]="'90vw'"
183
456
  [style.max-height]="'90vh'"
457
+ (keydown)="OnTabKey($event)"
184
458
  (click)="$event.stopPropagation()">
185
459
 
186
460
  <!-- Title bar -->
@@ -226,13 +500,21 @@ export class MJDialogComponent {
226
500
  type: Input
227
501
  }], Role: [{
228
502
  type: Input
503
+ }], AutoFocus: [{
504
+ type: Input
505
+ }], TrapFocus: [{
506
+ type: Input
507
+ }], RestoreFocus: [{
508
+ type: Input
509
+ }], AriaLabel: [{
510
+ type: Input
229
511
  }], Close: [{
230
512
  type: Output
231
513
  }], OnEscapeKey: [{
232
514
  type: HostListener,
233
515
  args: ['document:keydown.escape']
234
516
  }] }); })();
235
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogComponent, { className: "MJDialogComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 86 }); })();
517
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogComponent, { className: "MJDialogComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 100 }); })();
236
518
  /**
237
519
  * mj-dialog-titlebar — Custom titlebar content for mj-dialog.
238
520
  *
@@ -263,7 +545,7 @@ export class MJDialogTitlebarComponent {
263
545
  template: `<ng-content></ng-content>`
264
546
  }]
265
547
  }], null, null); })();
266
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogTitlebarComponent, { className: "MJDialogTitlebarComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 202 }); })();
548
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogTitlebarComponent, { className: "MJDialogTitlebarComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 483 }); })();
267
549
  /**
268
550
  * mj-dialog-actions — Footer action bar for mj-dialog.
269
551
  *
@@ -298,5 +580,5 @@ export class MJDialogActionsComponent {
298
580
  `
299
581
  }]
300
582
  }], null, null); })();
301
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogActionsComponent, { className: "MJDialogActionsComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 226 }); })();
583
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJDialogActionsComponent, { className: "MJDialogActionsComponent", filePath: "lib/dialog/dialog.component.ts", lineNumber: 507 }); })();
302
584
  //# sourceMappingURL=dialog.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EAMb,MAAM,eAAe,CAAC;;;;;IAmDP,gCAAiE;IAAA,YAAW;IAAA,oBAAK;;;IAArD,4DAAoC;IAAC,cAAW;IAAX,kCAAW;;;;IAI5E,oCAAmF;IAAnD,qNAAS,qBAAc,KAAC;IACtD,0BAAiC;IACnC,oBAAS;;;IARb,iCAAgC;IAC9B,8GAAa;IAGb,qBAAqD;IACrD,kHAAiB;IAKnB,oBAAM;;;IATJ,cAEC;IAFD,uCAEC;IAED,eAIC;IAJD,2CAIC;;;;IAtBT,iCAAkE;IAAlC,2LAAS,8BAAuB,KAAC;IAC/D,iCAQqC;IAAnC,kHAAS,wBAAwB,IAAC;IAGlC,iGAA0B;IAe1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,CAAC;IAED,WAAW;QACT,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpC,CAAC;2GA7FU,iBAAiB;6DAAjB,iBAAiB;YAAjB,wGAAA,iBAAa,0BAAI;;;YAvC1B,oFAAe;;YAAf,sCAoCC;;;iFAGQ,iBAAiB;cA3C7B,SAAS;eAAC;gBACT,QAAQ,EAAE,WAAW;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCT;aACF;;kBAKE,KAAK;;kBAeL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBACL,KAAK;;kBAQL,KAAK;;kBAEL,MAAM;;kBAgCN,YAAY;mBAAC,yBAAyB;;kFAlE5B,iBAAiB;AAgG9B;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,yBAAyB;mHAAzB,yBAAyB;6DAAzB,yBAAyB;;YAFzB,kBAAyB;;;iFAEzB,yBAAyB;cALrC,SAAS;eAAC;gBACT,QAAQ,EAAE,oBAAoB;gBAC9B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,2BAA2B;aACtC;;kFACY,yBAAyB;AAEtC;;;;;;;;;;;;GAYG;AAUH,MAAM,OAAO,wBAAwB;kHAAxB,wBAAwB;6DAAxB,wBAAwB;;YALjC,iCAA+B;YAC7B,kBAAyB;YAC3B,oBAAM;;;iFAGG,wBAAwB;cATpC,SAAS;eAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;GAIT;aACF;;kFACY,wBAAwB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n HostListener,\n ElementRef,\n ViewChild,\n AfterViewInit,\n OnDestroy,\n inject\n} from '@angular/core';\n\nexport type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';\n\nconst SIZE_MAP: Record<MjDialogSize, string> = {\n sm: '400px',\n md: '600px',\n lg: '800px',\n xl: '1000px',\n auto: 'auto'\n};\n\n/**\n * mj-dialog — Modal dialog component using native `<dialog>` element.\n *\n * Replaces `<kendo-dialog>`.\n *\n * Supports both explicit width/height and size presets.\n * Content is projected, with an optional `<mj-dialog-actions>` for the footer.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"showDialog\" Title=\"Confirm\" (Close)=\"onClose()\">\n * <p>Are you sure?</p>\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\" (click)=\"onConfirm()\">Yes</button>\n * <button mjButton (click)=\"onClose()\">No</button>\n * </mj-dialog-actions>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog',\n standalone: true,\n template: `\n @if (Visible) {\n <div class=\"mj-dialog-backdrop\" (click)=\"OnBackdropClick($event)\">\n <div class=\"mj-dialog-container\"\n [attr.role]=\"Role\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"Title ? 'mj-dialog-title-' + dialogId : null\"\n [style.width]=\"resolvedWidth\"\n [style.height]=\"resolvedHeight\"\n [style.max-width]=\"'90vw'\"\n [style.max-height]=\"'90vh'\"\n (click)=\"$event.stopPropagation()\">\n\n <!-- Title bar -->\n @if (Title || Closeable) {\n <div class=\"mj-dialog-titlebar\">\n @if (Title) {\n <h2 class=\"mj-dialog-title\" [id]=\"'mj-dialog-title-' + dialogId\">{{ Title }}</h2>\n }\n <ng-content select=\"mj-dialog-titlebar\"></ng-content>\n @if (Closeable) {\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close dialog\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n }\n </div>\n }\n\n <!-- Body -->\n <div class=\"mj-dialog-body\">\n <ng-content></ng-content>\n </div>\n\n <!-- Actions (projected) -->\n <ng-content select=\"mj-dialog-actions\"></ng-content>\n </div>\n </div>\n }\n `\n})\nexport class MJDialogComponent implements OnDestroy {\n private _visible = false;\n private static nextId = 0;\n\n @Input()\n set Visible(value: boolean) {\n const wasVisible = this._visible;\n this._visible = value;\n if (value && !wasVisible) {\n this.onOpen();\n }\n if (!value && wasVisible) {\n this.onCloseInternal();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n @Input() Title = '';\n @Input() Width: number | string | null = null;\n @Input() Height: number | string | null = null;\n @Input() Size: MjDialogSize = 'auto';\n @Input() Closeable = true;\n @Input() MinWidth: number | null = null;\n\n /**\n * ARIA role for the dialog container. Defaults to `'dialog'`; pass\n * `'alertdialog'` for confirmation / destructive prompts that interrupt the\n * user (per WAI-ARIA, an alertdialog conveys an urgent message requiring a\n * response). Backward compatible — existing callers keep `'dialog'`.\n */\n @Input() Role: 'dialog' | 'alertdialog' = 'dialog';\n\n @Output() Close = new EventEmitter<void>();\n\n DialogId = MJDialogComponent.nextId++;\n\n get dialogId(): number { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.DialogId;\n }\n\n get ResolvedWidth(): string {\n if (this.Width) {\n return typeof this.Width === 'number' ? `${this.Width}px` : this.Width;\n }\n return SIZE_MAP[this.Size] ?? 'auto';\n }\n\n /** @deprecated Use {@link ResolvedWidth}. */\n get resolvedWidth(): string {\n return this.ResolvedWidth;\n }\n\n get ResolvedHeight(): string {\n if (this.Height) {\n return typeof this.Height === 'number' ? `${this.Height}px` : this.Height;\n }\n return 'auto';\n }\n\n /** @deprecated Use {@link ResolvedHeight}. */\n get resolvedHeight(): string {\n return this.ResolvedHeight;\n }\n\n @HostListener('document:keydown.escape')\n OnEscapeKey(): void {\n if (this.Visible && this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnBackdropClick(event: Event): void {\n if (this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnCloseClick(): void {\n this.Close.emit();\n }\n\n private onOpen(): void {\n document.body.style.overflow = 'hidden';\n }\n\n private onCloseInternal(): void {\n document.body.style.overflow = '';\n }\n\n ngOnDestroy(): void {\n document.body.style.overflow = '';\n }\n}\n\n/**\n * mj-dialog-titlebar — Custom titlebar content for mj-dialog.\n *\n * Replaces `<kendo-dialog-titlebar>`.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"show\" (Close)=\"onClose()\">\n * <mj-dialog-titlebar>\n * <i class=\"fa-solid fa-save\"></i> Custom Title\n * </mj-dialog-titlebar>\n * <p>Dialog content</p>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog-titlebar',\n standalone: true,\n template: `<ng-content></ng-content>`\n})\nexport class MJDialogTitlebarComponent {}\n\n/**\n * mj-dialog-actions — Footer action bar for mj-dialog.\n *\n * Replaces `<kendo-dialog-actions>`.\n *\n * @example\n * ```html\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\">Save</button>\n * <button mjButton>Cancel</button>\n * </mj-dialog-actions>\n * ```\n */\n@Component({\n selector: 'mj-dialog-actions',\n standalone: true,\n template: `\n <div class=\"mj-dialog-actions\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class MJDialogActionsComponent {}\n"]}
1
+ {"version":3,"file":"dialog.component.js","sourceRoot":"","sources":["../../../src/lib/dialog/dialog.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,EACL,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,UAAU,EAEV,MAAM,EACP,MAAM,eAAe,CAAC;;;;;IAmEP,gCAAiE;IAAA,YAAW;IAAA,oBAAK;;;IAArD,4DAAoC;IAAC,cAAW;IAAX,kCAAW;;;;IAI5E,oCAAmF;IAAnD,qNAAS,qBAAc,KAAC;IACtD,0BAAiC;IACnC,oBAAS;;;IARb,iCAAgC;IAC9B,8GAAa;IAGb,qBAAqD;IACrD,kHAAiB;IAKnB,oBAAM;;;IATJ,cAEC;IAFD,uCAEC;IAED,eAIC;IAJD,2CAIC;;;;IAzBT,iCAAkE;IAAlC,2LAAS,8BAAuB,KAAC;IAC/D,iCAWqC;IAAnC,AADA,+LAAW,uBAAgB,KAAC,kGACnB,wBAAwB,IA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,2BAA2B;aACtC;;kFACY,yBAAyB;AAEtC;;;;;;;;;;;;GAYG;AAUH,MAAM,OAAO,wBAAwB;kHAAxB,wBAAwB;6DAAxB,wBAAwB;;YALjC,iCAA+B;YAC7B,kBAAyB;YAC3B,oBAAM;;;iFAGG,wBAAwB;cATpC,SAAS;eAAC;gBACT,QAAQ,EAAE,mBAAmB;gBAC7B,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE;;;;GAIT;aACF;;kFACY,wBAAwB","sourcesContent":["import {\n Component,\n Input,\n Output,\n EventEmitter,\n HostListener,\n ElementRef,\n OnDestroy,\n inject\n} from '@angular/core';\n\nexport type MjDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'auto';\n\nconst SIZE_MAP: Record<MjDialogSize, string> = {\n sm: '400px',\n md: '600px',\n lg: '800px',\n xl: '1000px',\n auto: 'auto'\n};\n\n/**\n * mj-dialog — Modal dialog component using native `<dialog>` element.\n *\n * Replaces `<kendo-dialog>`.\n *\n * Supports both explicit width/height and size presets.\n * Content is projected, with an optional `<mj-dialog-actions>` for the footer.\n *\n * On open, focus moves to `[data-autofocus]`, else the first field in the body,\n * else the first button in the body or actions (never the ✕), else the container.\n * Tab between stops is left to the browser. Tab on the last stop wraps to the\n * first, and Shift+Tab on the first stop or the container wraps to the last.\n * A Tab that arrives from outside is taken only by the topmost visible dialog,\n * and only when that dialog traps focus and focus is on the page behind it:\n * not in another modal, and not in an overlay panel rendered on the body.\n * A dropdown or calendar that hands focus back to its field is wrapped when\n * that field is the first or last stop, because the key started in the overlay.\n * Focus returns to the trigger on close.\n * `AutoFocus`, `TrapFocus`, and `RestoreFocus` each default on so a dialog that\n * manages focus itself can turn that one behavior off.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"showDialog\" Title=\"Confirm\" (Close)=\"onClose()\">\n * <p>Are you sure?</p>\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\" (click)=\"onConfirm()\">Yes</button>\n * <button mjButton (click)=\"onClose()\">No</button>\n * </mj-dialog-actions>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog',\n standalone: true,\n template: `\n @if (Visible) {\n <div class=\"mj-dialog-backdrop\" (click)=\"OnBackdropClick($event)\">\n <div class=\"mj-dialog-container\"\n [attr.role]=\"Role\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"Title ? 'mj-dialog-title-' + dialogId : null\"\n [attr.aria-label]=\"Title ? null : (AriaLabel || null)\"\n [style.width]=\"resolvedWidth\"\n [style.height]=\"resolvedHeight\"\n [style.max-width]=\"'90vw'\"\n [style.max-height]=\"'90vh'\"\n (keydown)=\"OnTabKey($event)\"\n (click)=\"$event.stopPropagation()\">\n\n <!-- Title bar -->\n @if (Title || Closeable) {\n <div class=\"mj-dialog-titlebar\">\n @if (Title) {\n <h2 class=\"mj-dialog-title\" [id]=\"'mj-dialog-title-' + dialogId\">{{ Title }}</h2>\n }\n <ng-content select=\"mj-dialog-titlebar\"></ng-content>\n @if (Closeable) {\n <button class=\"mj-dialog-close\" (click)=\"OnCloseClick()\" aria-label=\"Close dialog\">\n <i class=\"fa-solid fa-times\"></i>\n </button>\n }\n </div>\n }\n\n <!-- Body -->\n <div class=\"mj-dialog-body\">\n <ng-content></ng-content>\n </div>\n\n <!-- Actions (projected) -->\n <ng-content select=\"mj-dialog-actions\"></ng-content>\n </div>\n </div>\n }\n `\n})\nexport class MJDialogComponent implements OnDestroy {\n private readonly host = inject(ElementRef) as ElementRef<HTMLElement>;\n private _visible = false;\n /** Element that held focus when the dialog opened; restored on close. */\n private previouslyFocused: HTMLElement | null = null;\n /** Set while the open focus is waiting for the `@if (Visible)` container. */\n private initialFocusPending = false;\n /** Open dialogs, oldest first. The last visible one decides whether an outside Tab is taken. */\n private static readonly openDialogs: MJDialogComponent[] = [];\n private static nextId = 0;\n\n private static readonly TAB_STOP_SELECTOR =\n 'a[href], button, input, select, textarea, [contenteditable]:not([contenteditable=\"false\"]), [tabindex]';\n\n private readonly onDocumentKeyDown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this._visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n if (!this.isTopmostOpenDialog()) return;\n const container = this.containerElement();\n if (!container) return;\n const active = document.activeElement;\n // Another modal keeps its Tab. An overlay panel that still holds focus (a filter\n // popover, or any panel that does not move focus itself) keeps it too.\n if (active instanceof Element) {\n const modal = active.closest('[aria-modal=\"true\"]');\n if (modal && modal !== container) return;\n if (active.closest('.cdk-overlay-container')) return;\n }\n const focusInside = active instanceof Node && container.contains(active);\n const startedOutside = !(event.target instanceof Node && container.contains(event.target));\n // A dropdown or calendar focuses its field and leaves the key alone. The key\n // started in the overlay, so the container never saw it. Wrap at the ends.\n if (focusInside && startedOutside) {\n this.wrapTabAtEnds(event, container);\n return;\n }\n if (focusInside) return;\n const stops = this.tabStops(container);\n event.preventDefault();\n const target = stops.length === 0 ? container : (event.shiftKey ? stops[stops.length - 1] : stops[0]);\n target.focus();\n };\n\n @Input()\n set Visible(value: boolean) {\n const wasVisible = this._visible;\n this._visible = value;\n if (value && !wasVisible) {\n this.onOpen();\n }\n if (!value && wasVisible) {\n this.onCloseInternal();\n }\n }\n get Visible(): boolean {\n return this._visible;\n }\n\n @Input() Title = '';\n @Input() Width: number | string | null = null;\n @Input() Height: number | string | null = null;\n @Input() Size: MjDialogSize = 'auto';\n @Input() Closeable = true;\n @Input() MinWidth: number | null = null;\n\n /**\n * ARIA role for the dialog container. Defaults to `'dialog'`; pass\n * `'alertdialog'` for confirmation / destructive prompts that interrupt the\n * user (per WAI-ARIA, an alertdialog conveys an urgent message requiring a\n * response). Backward compatible — existing callers keep `'dialog'`.\n */\n @Input() Role: 'dialog' | 'alertdialog' = 'dialog';\n\n /** Move focus into the dialog when it opens. Off when the dialog focuses itself. */\n @Input() AutoFocus = true;\n\n /**\n * Keep focus in the dialog. The browser moves Tab between stops. Tab on the last\n * stop wraps to the first, and Shift+Tab on the first stop or the container wraps\n * to the last. A Tab from outside is brought in only when this dialog is the topmost\n * visible one and it traps focus, and not while focus is already inside another\n * modal or an overlay panel.\n */\n @Input() TrapFocus = true;\n\n /** Return focus to the element that was focused when the dialog opened. */\n @Input() RestoreFocus = true;\n\n /**\n * Accessible name (`aria-label`) used only when {@link Title} is empty.\n * A set Title keeps `aria-labelledby` and does not also set `aria-label`.\n */\n @Input() AriaLabel: string | null = null;\n\n @Output() Close = new EventEmitter<void>();\n\n DialogId = MJDialogComponent.nextId++;\n\n get dialogId(): number { // case-violation-ok-legacy-back-compat: the PascalCase name is already taken in this scope\n return this.DialogId;\n }\n\n get ResolvedWidth(): string {\n if (this.Width) {\n return typeof this.Width === 'number' ? `${this.Width}px` : this.Width;\n }\n return SIZE_MAP[this.Size] ?? 'auto';\n }\n\n /** @deprecated Use {@link ResolvedWidth}. */\n get resolvedWidth(): string {\n return this.ResolvedWidth;\n }\n\n get ResolvedHeight(): string {\n if (this.Height) {\n return typeof this.Height === 'number' ? `${this.Height}px` : this.Height;\n }\n return 'auto';\n }\n\n /** @deprecated Use {@link ResolvedHeight}. */\n get resolvedHeight(): string {\n return this.ResolvedHeight;\n }\n\n @HostListener('document:keydown.escape')\n OnEscapeKey(): void {\n if (this.Visible && this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnBackdropClick(event: Event): void {\n if (this.Closeable) {\n this.OnCloseClick();\n }\n }\n\n OnCloseClick(): void {\n this.Close.emit();\n }\n\n /**\n * Wraps Tab at the ends of the dialog. A Tab that is already handled, including\n * by a dialog nested inside this one, is left alone. With no enabled control,\n * focus stays on the container (it is `tabindex=\"-1\"`, so it is not itself a tab stop).\n */\n OnTabKey(event: KeyboardEvent): void {\n if (event.defaultPrevented || event.key !== 'Tab' || !this.TrapFocus || !this.Visible) return;\n if (event.altKey || event.ctrlKey || event.metaKey) return;\n const container = event.currentTarget;\n if (!(container instanceof HTMLElement)) return;\n this.wrapTabAtEnds(event, container);\n }\n\n /**\n * Tab on the last stop wraps to the first. Shift+Tab on the first stop or the\n * container wraps to the last. A Tab in the middle is left for the browser.\n */\n private wrapTabAtEnds(event: KeyboardEvent, container: HTMLElement): void {\n const stops = this.tabStops(container);\n if (stops.length === 0) {\n event.preventDefault();\n container.focus();\n return;\n }\n\n const active = document.activeElement;\n const index = active instanceof HTMLElement ? stops.indexOf(active) : -1;\n const onContainer = active === container;\n if (event.shiftKey) {\n if (index === 0 || onContainer) {\n event.preventDefault();\n stops[stops.length - 1].focus();\n }\n return;\n }\n if (index === stops.length - 1) {\n event.preventDefault();\n stops[0].focus();\n }\n }\n\n ngOnDestroy(): void {\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n if (this._visible) {\n this.restoreFocus();\n }\n document.body.style.overflow = '';\n }\n\n private onOpen(): void {\n this.rememberOpen();\n document.body.style.overflow = 'hidden';\n document.addEventListener('keydown', this.onDocumentKeyDown);\n const active = document.activeElement;\n this.previouslyFocused = active instanceof HTMLElement ? active : null;\n if (this.AutoFocus) {\n this.scheduleInitialFocus();\n }\n }\n\n private onCloseInternal(): void {\n document.body.style.overflow = '';\n document.removeEventListener('keydown', this.onDocumentKeyDown);\n this.cancelPendingInitialFocus();\n this.forgetOpen();\n this.restoreFocus();\n }\n\n private rememberOpen(): void {\n if (!MJDialogComponent.openDialogs.includes(this)) {\n MJDialogComponent.openDialogs.push(this);\n }\n }\n\n private forgetOpen(): void {\n const index = MJDialogComponent.openDialogs.indexOf(this);\n if (index >= 0) {\n MJDialogComponent.openDialogs.splice(index, 1);\n }\n }\n\n /**\n * The last visible dialog decides. When that dialog does not trap focus, nobody\n * takes the Tab, including a trapping dialog underneath it.\n */\n private isTopmostOpenDialog(): boolean {\n for (let i = MJDialogComponent.openDialogs.length - 1; i >= 0; i--) {\n const dialog = MJDialogComponent.openDialogs[i];\n if (!dialog._visible) continue;\n return dialog === this && dialog.TrapFocus;\n }\n return false;\n }\n\n private scheduleInitialFocus(): void {\n this.initialFocusPending = true;\n // The Visible setter runs before `@if` inserts `.mj-dialog-container`.\n Promise.resolve().then(() => {\n if (!this.initialFocusPending) return;\n this.initialFocusPending = false;\n this.focusInitial();\n });\n }\n\n private cancelPendingInitialFocus(): void {\n this.initialFocusPending = false;\n }\n\n private focusInitial(): void {\n if (!this._visible || !this.AutoFocus) return;\n const container = this.containerElement();\n if (!container) return;\n this.initialFocusTarget(container).focus();\n }\n\n private initialFocusTarget(container: HTMLElement): HTMLElement {\n const marked = this.firstEnabled(container.querySelectorAll<HTMLElement>('[data-autofocus]'));\n if (marked) return marked;\n\n const field = this.firstEnabled(container.querySelectorAll<HTMLElement>(\n '.mj-dialog-body input, .mj-dialog-body select, .mj-dialog-body textarea',\n ));\n if (field) return field;\n\n const button = this.firstEnabled(\n container.querySelectorAll<HTMLElement>('.mj-dialog-body button, .mj-dialog-actions button'),\n true,\n );\n if (button) return button;\n\n return container;\n }\n\n /** First element that can take focus. The ✕ is skipped only for the button fallback. */\n private firstEnabled(nodes: NodeListOf<HTMLElement>, skipClose = false): HTMLElement | null {\n for (const el of Array.from(nodes)) {\n if (skipClose && el.classList.contains('mj-dialog-close')) continue;\n if (this.isDisabled(el)) continue;\n if (el instanceof HTMLInputElement && el.type === 'hidden') continue;\n return el;\n }\n return null;\n }\n\n private restoreFocus(): void {\n const target = this.previouslyFocused;\n this.previouslyFocused = null;\n if (!this.RestoreFocus) return;\n // The trigger is outside the dialog. An element inside this host is about to be removed.\n if (target && target !== document.body && document.contains(target) && !this.host.nativeElement.contains(target)) {\n target.focus();\n return;\n }\n this.focusDocumentBody();\n }\n\n /** `document.body.focus()` is a no-op unless body is a focusable area; blur lands on body. */\n private focusDocumentBody(): void {\n const active = document.activeElement;\n if (active instanceof HTMLElement && active !== document.body) {\n active.blur();\n }\n if (document.activeElement !== document.body) {\n document.body.focus();\n }\n }\n\n private containerElement(): HTMLElement | null {\n const found = this.host.nativeElement.querySelector('.mj-dialog-container');\n return found instanceof HTMLElement ? found : null;\n }\n\n private tabStops(container: HTMLElement): HTMLElement[] {\n return Array.from(container.querySelectorAll<HTMLElement>(MJDialogComponent.TAB_STOP_SELECTOR)).filter((el) =>\n this.isTabStop(el),\n );\n }\n\n /** Real controls only. `tabindex=\"-1\"` (including the container) is the fallback, not a stop. */\n private isTabStop(el: HTMLElement): boolean {\n if (el.getAttribute('tabindex') === '-1') return false;\n if (this.isDisabled(el)) return false;\n if (el instanceof HTMLInputElement && el.type === 'hidden') return false;\n if (!this.isVisibleStop(el)) return false;\n return true;\n }\n\n /**\n * display:none and [hidden] hide the whole subtree. visibility is inherited, and a child\n * can set visible again, so that check is only on the element itself.\n */\n private isVisibleStop(el: HTMLElement): boolean {\n if (getComputedStyle(el).visibility === 'hidden') return false;\n let current: HTMLElement | null = el;\n while (current) {\n if (current.hasAttribute('hidden')) return false;\n if (getComputedStyle(current).display === 'none') return false;\n current = current.parentElement;\n }\n return true;\n }\n\n private isDisabled(el: HTMLElement): boolean {\n if (\n el instanceof HTMLButtonElement ||\n el instanceof HTMLInputElement ||\n el instanceof HTMLSelectElement ||\n el instanceof HTMLTextAreaElement ||\n el instanceof HTMLFieldSetElement ||\n el instanceof HTMLOptGroupElement ||\n el instanceof HTMLOptionElement\n ) {\n return el.disabled;\n }\n return el.hasAttribute('disabled');\n }\n}\n\n/**\n * mj-dialog-titlebar — Custom titlebar content for mj-dialog.\n *\n * Replaces `<kendo-dialog-titlebar>`.\n *\n * @example\n * ```html\n * <mj-dialog [Visible]=\"show\" (Close)=\"onClose()\">\n * <mj-dialog-titlebar>\n * <i class=\"fa-solid fa-save\"></i> Custom Title\n * </mj-dialog-titlebar>\n * <p>Dialog content</p>\n * </mj-dialog>\n * ```\n */\n@Component({\n selector: 'mj-dialog-titlebar',\n standalone: true,\n template: `<ng-content></ng-content>`\n})\nexport class MJDialogTitlebarComponent {}\n\n/**\n * mj-dialog-actions — Footer action bar for mj-dialog.\n *\n * Replaces `<kendo-dialog-actions>`.\n *\n * @example\n * ```html\n * <mj-dialog-actions>\n * <button mjButton variant=\"primary\">Save</button>\n * <button mjButton>Cancel</button>\n * </mj-dialog-actions>\n * ```\n */\n@Component({\n selector: 'mj-dialog-actions',\n standalone: true,\n template: `\n <div class=\"mj-dialog-actions\">\n <ng-content></ng-content>\n </div>\n `\n})\nexport class MJDialogActionsComponent {}\n"]}
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAoIa,mBAAoB,SAAQ,kBAAmB,YAAW,oBAAoB,EAAE,aAAa,EAAE,SAAS;IAC1G,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,OAAO,EAAE,GAAG,IAAI,CAAM;IAC5E,SAAS,SAAM;IACf,UAAU,SAAM;IAChB,UAAU,UAAS;IACnB,cAAc,UAAS;IAChC;;;;;OAKG;IACH,IACI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAG1B;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACQ,WAAW,SAAe;IAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,CAAQ;IAE3D,YAAY,uBAA8B;IAC1C,WAAW,wBAA+B;IAEpB,YAAY,EAAE,WAAW,CAAC;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG,IAAI,CAAQ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OAAO,GAAG,IAAI;IAC3C,WAAW,IAAI,IAAI;IAEnB,OAAO,CAAC,gBAAgB;yCA7Pb,mBAAmB;2CAAnB,mBAAmB;CAiQ/B"}
@@ -336,6 +336,14 @@ export class MJDropdownComponent extends MJNamedControlBase {
336
336
  event.preventDefault();
337
337
  this.Close();
338
338
  break;
339
+ case 'Tab':
340
+ // The panel lives in the overlay, outside a parent dialog. Hand focus back to this
341
+ // field and do not prevent the key, so the browser moves on from the field.
342
+ if (this.IsOpen) {
343
+ this.triggerEl?.nativeElement.focus();
344
+ this.Close();
345
+ }
346
+ break;
339
347
  case 'Home':
340
348
  if (this.IsOpen) {
341
349
  event.preventDefault();
@@ -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;;IAQ3E,eAAoB;IAApB,yCAAoB;;;;;IAMxB,+BAMqC;IAAnC,yMAAS,kBAAW,IAAI,SAAS,KAAC;IAClC,YACF;IAAA,iBAAM;;;I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AAC,0FACP,qBAAiB,IAAC,8EACrB,YAAQ,IAAC;YACjB,+BAA4E;YAC1E,YACF;YAAA,iBAAO;YACP,uBAA0D;YAC5D,iBAAM;YAEN,oFASqB;YAAnB,AADA,qHAAiB,WAAO,IAAC,0FACf,WAAO,IAAC;;;YA7BlB,AADA,+CAAkC,yCACQ;;YAcV,eAA2C;YAA3C,wDAA2C;YACzE,cACF;YADE,gDACF;YAMA,eAA2C;YAI3C,AADA,AADA,AADA,AADA,4DAA2C,uCACT,+CACQ,8CACD,wCACF;4BAlCjC,gBAAgB,EAAE,aAAa;;iFAiI9B,mBAAmB;cApI/B,SAAS;2BACE,aAAa,cACX,IAAI,WACP,CAAC,gBAAgB,EAAE,aAAa,CAAC,YAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGT,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 * @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 '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;;;;;;;;;IAiGlD,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;;;;;IAMxB,+BAMqC;IAAnC,yMAAS,kBAAW,IAAI,SAAS,KAAC;IAClC,YACF;IAAA,iBAAM;;;IALJ,AADA,4EAA4D,mEACK;;IAIjE,cACF;IADE,uEACF;;;IAWI,wBAA4F;;;IAA5F,yHAA6E;;;;IAA9B,AAAhC,sDAAgC,gEAA4B;;;IAE3E,YACF;;;;IADE,4DACF;;;;IAXF,+BAMqC;IAAnC,2NAAS,kCAAwB,KAAC;IAGhC,AAFF,+GAAoB,yEAEX;IAGX,iBAAM;;;;;IATJ,AADA,8EAA2D,0EACU;;IAIrE,cAIC;IAJD,6CAIC;;;IAIH,+BAAiC;IAAA,6BAAa;IAAA,iBAAM;;;IA1DxD,8BAGkD;IAChD,mGAAkB;IA2BlB,mGAA2B;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AC;;;YA7BlB,AADA,+CAAkC,yCACQ;;YAcV,eAA2C;YAA3C,wDAA2C;YACzE,cACF;YADE,gDACF;YAMA,eAA2C;YAI3C,AADA,AADA,AADA,AADA,4DAA2C,uCACT,+CACQ,8CACD,wCACF;4BAlCjC,gBAAgB,EAAE,aAAa;;iFAiI9B,mBAAmB;cApI/B,SAAS;2BACE,aAAa,cACX,IAAI,WACP,CAAC,gBAAgB,EAAE,aAAa,CAAC,YAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGT,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 * @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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-ui-components",
3
- "version": "6.2.0-edge.1",
3
+ "version": "6.2.0-edge.2",
4
4
  "description": "MemberJunction: Angular UI Components - reusable standalone components replacing Kendo UI dependencies.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -16,7 +16,7 @@
16
16
  "devDependencies": {
17
17
  "@angular/compiler": "21.2.22",
18
18
  "@angular/compiler-cli": "21.2.22",
19
- "@memberjunction/ng-test-utils": "6.2.0-edge.1",
19
+ "@memberjunction/ng-test-utils": "6.2.0-edge.2",
20
20
  "vitest": "^4.0.18"
21
21
  },
22
22
  "peerDependencies": {