@forgeroute/ui 0.5.18 → 0.5.20
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/fesm2022/forgeroute-ui-boards.mjs +2 -2
- package/fesm2022/forgeroute-ui-boards.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-chip.mjs +25 -6
- package/fesm2022/forgeroute-ui-chip.mjs.map +1 -1
- package/fesm2022/{forgeroute-ui-core-ui-labels.es-Woi3az70.mjs → forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs} +37 -10
- package/fesm2022/forgeroute-ui-core-ui-labels.es-ChTmqFlw.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-core.mjs +94 -19
- package/fesm2022/forgeroute-ui-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-data-table-core.mjs +217 -26
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-messaging.mjs +19 -2
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-more-menu.mjs +61 -8
- package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs +2 -1
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-payments.mjs +870 -57
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stripe.mjs +815 -49
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -1
- package/package.json +2 -6
- package/types/forgeroute-ui-chip.d.ts +11 -1
- package/types/forgeroute-ui-core.d.ts +65 -12
- package/types/forgeroute-ui-data-table-core.d.ts +60 -1
- package/types/forgeroute-ui-messaging.d.ts +15 -5
- package/types/forgeroute-ui-more-menu.d.ts +7 -0
- package/types/forgeroute-ui-payments.d.ts +332 -8
- package/types/forgeroute-ui-quickbooks.d.ts +2 -2
- package/types/forgeroute-ui-square.d.ts +1 -1
- package/types/forgeroute-ui-stripe.d.ts +293 -20
- package/types/forgeroute-ui-table-types.d.ts +29 -0
- package/fesm2022/forgeroute-ui-core-ui-labels.es-Woi3az70.mjs.map +0 -1
|
@@ -44,12 +44,14 @@ const BUILT_IN_ICONS = {
|
|
|
44
44
|
function builtInActionIcon(type) {
|
|
45
45
|
return Object.prototype.hasOwnProperty.call(BUILT_IN_ICONS, type) ? BUILT_IN_ICONS[type] : void 0;
|
|
46
46
|
}
|
|
47
|
+
let nextMenuId = 0;
|
|
47
48
|
var MoreMenuComponent = class MoreMenuComponent {
|
|
48
49
|
constructor() {
|
|
49
50
|
this.labels = inject(UiLabelsService);
|
|
50
51
|
this.ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
51
52
|
this.actions = input([], ...ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []);
|
|
52
53
|
this.actionClick = output();
|
|
54
|
+
this.opened = output();
|
|
53
55
|
this.open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
54
56
|
this.openUp = signal(false, ...ngDevMode ? [{ debugName: "openUp" }] : /* istanbul ignore next */ []);
|
|
55
57
|
this.maxHeight = signal(null, ...ngDevMode ? [{ debugName: "maxHeight" }] : /* istanbul ignore next */ []);
|
|
@@ -59,6 +61,7 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
59
61
|
this._cdr = inject(ChangeDetectorRef);
|
|
60
62
|
this._openWidth = 0;
|
|
61
63
|
this.visibleActions = () => this.actions().filter((a) => !a.hidden?.(null));
|
|
64
|
+
this._uid = nextMenuId++;
|
|
62
65
|
effect((onCleanup) => {
|
|
63
66
|
if (!this.open()) return;
|
|
64
67
|
const onPointerDown = (event) => this.onDocumentPointerDown(event);
|
|
@@ -92,7 +95,26 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
92
95
|
return action.icon ?? builtInActionIcon(action.type) ?? "M5 12h14 M12 5l7 7-7 7";
|
|
93
96
|
}
|
|
94
97
|
isDisabled(action) {
|
|
95
|
-
|
|
98
|
+
if (typeof action.disabled !== "function") return !!action.disabled;
|
|
99
|
+
try {
|
|
100
|
+
return !!action.disabled(null);
|
|
101
|
+
} catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
reasonFor(action) {
|
|
106
|
+
if (!this.isDisabled(action)) return "";
|
|
107
|
+
const raw = action.disabledReason;
|
|
108
|
+
let value;
|
|
109
|
+
try {
|
|
110
|
+
value = typeof raw === "function" ? raw(null) : raw;
|
|
111
|
+
} catch {
|
|
112
|
+
value = null;
|
|
113
|
+
}
|
|
114
|
+
return typeof value === "string" ? value.trim() : "";
|
|
115
|
+
}
|
|
116
|
+
reasonId(action) {
|
|
117
|
+
return `mm-${this._uid}-reason-${action.type.replace(/[^A-Za-z0-9_-]/g, "-")}`;
|
|
96
118
|
}
|
|
97
119
|
toggle(event) {
|
|
98
120
|
event.stopPropagation();
|
|
@@ -117,6 +139,7 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
117
139
|
this._place(triggerRect, fixed);
|
|
118
140
|
this._cdr.detectChanges();
|
|
119
141
|
setTimeout(() => this._menuItems()[0]?.focus({ preventScroll: true }), 30);
|
|
142
|
+
this.opened.emit();
|
|
120
143
|
}
|
|
121
144
|
_place(rect, fixed) {
|
|
122
145
|
const dropdown = this._dropdownEl();
|
|
@@ -186,6 +209,7 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
186
209
|
}
|
|
187
210
|
onActionClick(action, event) {
|
|
188
211
|
event.stopPropagation();
|
|
212
|
+
if (this.isDisabled(action)) return;
|
|
189
213
|
this.actionClick.emit(action.type);
|
|
190
214
|
this.open.set(false);
|
|
191
215
|
this._trigger()?.focus();
|
|
@@ -285,7 +309,10 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
285
309
|
transformFunction: null
|
|
286
310
|
}
|
|
287
311
|
},
|
|
288
|
-
outputs: {
|
|
312
|
+
outputs: {
|
|
313
|
+
actionClick: "actionClick",
|
|
314
|
+
opened: "opened"
|
|
315
|
+
},
|
|
289
316
|
host: { listeners: {
|
|
290
317
|
"document:click": "onDocumentClick()",
|
|
291
318
|
"keydown.arrowdown": "onArrow($event, 1)",
|
|
@@ -311,17 +338,28 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
311
338
|
[style.top.px]="placement()?.top ?? null" [style.bottom.px]="placement()?.bottom ?? null" [style.right.px]="placement()?.right ?? null"
|
|
312
339
|
[style.max-height.px]="maxHeight()" [style.max-width.px]="maxWidth()" role="menu">
|
|
313
340
|
@for (action of visibleActions(); track action.type) {
|
|
341
|
+
@let reason = reasonFor(action);
|
|
314
342
|
<button
|
|
315
343
|
class="mm-item"
|
|
316
344
|
data-testid="more-menu-item"
|
|
317
345
|
[class.mm-danger]="action.variant === 'danger'"
|
|
318
|
-
[
|
|
346
|
+
[class.mm-has-reason]="!!reason"
|
|
347
|
+
[disabled]="isDisabled(action) && !reason"
|
|
348
|
+
[attr.aria-disabled]="isDisabled(action) && reason ? 'true' : null"
|
|
349
|
+
[attr.aria-describedby]="reason ? reasonId(action) : null"
|
|
319
350
|
role="menuitem"
|
|
320
351
|
(click)="onActionClick(action, $event)">
|
|
321
352
|
<svg class="mm-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
322
353
|
<path [attr.d]="resolveIcon(action)" />
|
|
323
354
|
</svg>
|
|
324
|
-
|
|
355
|
+
@if (reason) {
|
|
356
|
+
<span class="mm-text">
|
|
357
|
+
<span class="mm-label">{{ action.label }}</span>
|
|
358
|
+
<span class="mm-reason" [id]="reasonId(action)" data-testid="more-menu-reason">{{ reason }}</span>
|
|
359
|
+
</span>
|
|
360
|
+
} @else {
|
|
361
|
+
{{ action.label }}
|
|
362
|
+
}
|
|
325
363
|
</button>
|
|
326
364
|
}
|
|
327
365
|
</div>
|
|
@@ -329,7 +367,7 @@ var MoreMenuComponent = class MoreMenuComponent {
|
|
|
329
367
|
</div>
|
|
330
368
|
`,
|
|
331
369
|
isInline: true,
|
|
332
|
-
styles: [":host{display:inline-block;position:relative}.mm-wrapper{position:relative}.mm-trigger{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;border:none;background:transparent;color:#64748b;cursor:pointer;transition:background .1s,color .1s}.mm-trigger:hover{background:#f1f5f9;color:#334155}.mm-trigger:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.mm-dropdown{position:absolute;right:0;top:calc(100% + 4px);z-index:200;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 4px 16px #0000001a;min-width:160px;width:max-content;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;padding:4px;max-width:calc(100vw - 16px);overscroll-behavior:contain;background:linear-gradient(#fff 30%,#fff0) center top / 100% 16px no-repeat local,linear-gradient(#fff0,#fff 70%) center bottom / 100% 16px no-repeat local,radial-gradient(farthest-side at 50% 0,#0f172a38,#0f172a00) center top / 100% 8px no-repeat scroll,radial-gradient(farthest-side at 50% 100%,#0f172a38,#0f172a00) center bottom / 100% 8px no-repeat scroll,#fff}.mm-dropdown.mm-up{top:auto;bottom:calc(100% + 4px)}.mm-dropdown.mm-fixed{position:fixed;left:auto}.mm-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;background:none;border:none;cursor:pointer;font-size:.875rem;color:#334155;font-family:inherit;text-align:left;border-radius:5px;transition:background .1s;min-height:40px}.mm-item:hover:not(:disabled){background:#f8fafc}.mm-item:disabled{opacity:.4;cursor:default}.mm-item.mm-danger{color:#dc2626}.mm-item.mm-danger:hover:not(:disabled){background:#fef2f2}.mm-item:focus-visible{outline:2px solid #60a5fa;outline-offset:-2px}.mm-icon{flex-shrink:0}@media(max-width:1024px){.mm-trigger{width:36px;height:36px}.mm-item{padding:11px 14px;min-height:40px}}@media(pointer:coarse){.mm-trigger{width:44px;height:44px}.mm-item{min-height:44px}}@media(max-width:640px){.mm-trigger{width:44px;height:44px}.mm-item{padding:12px 14px;font-size:.9375rem;min-height:44px}.mm-dropdown{max-height:60vh;overflow-y:auto}}\n"],
|
|
370
|
+
styles: [":host{display:inline-block;position:relative}.mm-wrapper{position:relative}.mm-trigger{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;border:none;background:transparent;color:#64748b;cursor:pointer;transition:background .1s,color .1s}.mm-trigger:hover{background:#f1f5f9;color:#334155}.mm-trigger:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.mm-dropdown{position:absolute;right:0;top:calc(100% + 4px);z-index:200;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 4px 16px #0000001a;min-width:160px;width:max-content;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;padding:4px;max-width:calc(100vw - 16px);overscroll-behavior:contain;background:linear-gradient(#fff 30%,#fff0) center top / 100% 16px no-repeat local,linear-gradient(#fff0,#fff 70%) center bottom / 100% 16px no-repeat local,radial-gradient(farthest-side at 50% 0,#0f172a38,#0f172a00) center top / 100% 8px no-repeat scroll,radial-gradient(farthest-side at 50% 100%,#0f172a38,#0f172a00) center bottom / 100% 8px no-repeat scroll,#fff}.mm-dropdown.mm-up{top:auto;bottom:calc(100% + 4px)}.mm-dropdown.mm-fixed{position:fixed;left:auto}.mm-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;background:none;border:none;cursor:pointer;font-size:.875rem;color:#334155;font-family:inherit;text-align:left;border-radius:5px;transition:background .1s;min-height:40px}.mm-item:hover:not(:disabled){background:#f8fafc}.mm-item:disabled{opacity:.4;cursor:default}.mm-item.mm-has-reason{cursor:default;align-items:flex-start}.mm-item.mm-has-reason .mm-icon{margin-top:2px;color:#64748b}.mm-item.mm-has-reason .mm-label{color:#64748b}.mm-item.mm-has-reason:hover{background:none}.mm-item.mm-danger{color:#dc2626}.mm-item.mm-danger:hover:not(:disabled){background:#fef2f2}.mm-item:focus-visible{outline:2px solid #60a5fa;outline-offset:-2px}.mm-icon{flex-shrink:0}.mm-text{display:flex;flex-direction:column;gap:2px;min-width:0}.mm-reason{font-size:.75rem;line-height:1.3;color:#475569;white-space:normal}@media(max-width:1024px){.mm-trigger{width:36px;height:36px}.mm-item{padding:11px 14px;min-height:40px}}@media(pointer:coarse){.mm-trigger{width:44px;height:44px}.mm-item{min-height:44px}}@media(max-width:640px){.mm-trigger{width:44px;height:44px}.mm-item{padding:12px 14px;font-size:.9375rem;min-height:44px}.mm-dropdown{max-height:60vh;overflow-y:auto}}\n"],
|
|
333
371
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
334
372
|
});
|
|
335
373
|
}
|
|
@@ -369,24 +407,35 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
369
407
|
[style.top.px]="placement()?.top ?? null" [style.bottom.px]="placement()?.bottom ?? null" [style.right.px]="placement()?.right ?? null"
|
|
370
408
|
[style.max-height.px]="maxHeight()" [style.max-width.px]="maxWidth()" role="menu">
|
|
371
409
|
@for (action of visibleActions(); track action.type) {
|
|
410
|
+
@let reason = reasonFor(action);
|
|
372
411
|
<button
|
|
373
412
|
class="mm-item"
|
|
374
413
|
data-testid="more-menu-item"
|
|
375
414
|
[class.mm-danger]="action.variant === 'danger'"
|
|
376
|
-
[
|
|
415
|
+
[class.mm-has-reason]="!!reason"
|
|
416
|
+
[disabled]="isDisabled(action) && !reason"
|
|
417
|
+
[attr.aria-disabled]="isDisabled(action) && reason ? 'true' : null"
|
|
418
|
+
[attr.aria-describedby]="reason ? reasonId(action) : null"
|
|
377
419
|
role="menuitem"
|
|
378
420
|
(click)="onActionClick(action, $event)">
|
|
379
421
|
<svg class="mm-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
380
422
|
<path [attr.d]="resolveIcon(action)" />
|
|
381
423
|
</svg>
|
|
382
|
-
|
|
424
|
+
@if (reason) {
|
|
425
|
+
<span class="mm-text">
|
|
426
|
+
<span class="mm-label">{{ action.label }}</span>
|
|
427
|
+
<span class="mm-reason" [id]="reasonId(action)" data-testid="more-menu-reason">{{ reason }}</span>
|
|
428
|
+
</span>
|
|
429
|
+
} @else {
|
|
430
|
+
{{ action.label }}
|
|
431
|
+
}
|
|
383
432
|
</button>
|
|
384
433
|
}
|
|
385
434
|
</div>
|
|
386
435
|
}
|
|
387
436
|
</div>
|
|
388
437
|
`,
|
|
389
|
-
styles: [":host{display:inline-block;position:relative}.mm-wrapper{position:relative}.mm-trigger{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;border:none;background:transparent;color:#64748b;cursor:pointer;transition:background .1s,color .1s}.mm-trigger:hover{background:#f1f5f9;color:#334155}.mm-trigger:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.mm-dropdown{position:absolute;right:0;top:calc(100% + 4px);z-index:200;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 4px 16px #0000001a;min-width:160px;width:max-content;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;padding:4px;max-width:calc(100vw - 16px);overscroll-behavior:contain;background:linear-gradient(#fff 30%,#fff0) center top / 100% 16px no-repeat local,linear-gradient(#fff0,#fff 70%) center bottom / 100% 16px no-repeat local,radial-gradient(farthest-side at 50% 0,#0f172a38,#0f172a00) center top / 100% 8px no-repeat scroll,radial-gradient(farthest-side at 50% 100%,#0f172a38,#0f172a00) center bottom / 100% 8px no-repeat scroll,#fff}.mm-dropdown.mm-up{top:auto;bottom:calc(100% + 4px)}.mm-dropdown.mm-fixed{position:fixed;left:auto}.mm-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;background:none;border:none;cursor:pointer;font-size:.875rem;color:#334155;font-family:inherit;text-align:left;border-radius:5px;transition:background .1s;min-height:40px}.mm-item:hover:not(:disabled){background:#f8fafc}.mm-item:disabled{opacity:.4;cursor:default}.mm-item.mm-danger{color:#dc2626}.mm-item.mm-danger:hover:not(:disabled){background:#fef2f2}.mm-item:focus-visible{outline:2px solid #60a5fa;outline-offset:-2px}.mm-icon{flex-shrink:0}@media(max-width:1024px){.mm-trigger{width:36px;height:36px}.mm-item{padding:11px 14px;min-height:40px}}@media(pointer:coarse){.mm-trigger{width:44px;height:44px}.mm-item{min-height:44px}}@media(max-width:640px){.mm-trigger{width:44px;height:44px}.mm-item{padding:12px 14px;font-size:.9375rem;min-height:44px}.mm-dropdown{max-height:60vh;overflow-y:auto}}\n"]
|
|
438
|
+
styles: [":host{display:inline-block;position:relative}.mm-wrapper{position:relative}.mm-trigger{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:8px;border:none;background:transparent;color:#64748b;cursor:pointer;transition:background .1s,color .1s}.mm-trigger:hover{background:#f1f5f9;color:#334155}.mm-trigger:focus-visible{outline:2px solid #3b82f6;outline-offset:2px}.mm-dropdown{position:absolute;right:0;top:calc(100% + 4px);z-index:200;border:1px solid #e2e8f0;border-radius:8px;box-shadow:0 4px 16px #0000001a;min-width:160px;width:max-content;box-sizing:border-box;overflow-x:hidden;overflow-y:auto;padding:4px;max-width:calc(100vw - 16px);overscroll-behavior:contain;background:linear-gradient(#fff 30%,#fff0) center top / 100% 16px no-repeat local,linear-gradient(#fff0,#fff 70%) center bottom / 100% 16px no-repeat local,radial-gradient(farthest-side at 50% 0,#0f172a38,#0f172a00) center top / 100% 8px no-repeat scroll,radial-gradient(farthest-side at 50% 100%,#0f172a38,#0f172a00) center bottom / 100% 8px no-repeat scroll,#fff}.mm-dropdown.mm-up{top:auto;bottom:calc(100% + 4px)}.mm-dropdown.mm-fixed{position:fixed;left:auto}.mm-item{display:flex;align-items:center;gap:10px;width:100%;padding:10px 12px;background:none;border:none;cursor:pointer;font-size:.875rem;color:#334155;font-family:inherit;text-align:left;border-radius:5px;transition:background .1s;min-height:40px}.mm-item:hover:not(:disabled){background:#f8fafc}.mm-item:disabled{opacity:.4;cursor:default}.mm-item.mm-has-reason{cursor:default;align-items:flex-start}.mm-item.mm-has-reason .mm-icon{margin-top:2px;color:#64748b}.mm-item.mm-has-reason .mm-label{color:#64748b}.mm-item.mm-has-reason:hover{background:none}.mm-item.mm-danger{color:#dc2626}.mm-item.mm-danger:hover:not(:disabled){background:#fef2f2}.mm-item:focus-visible{outline:2px solid #60a5fa;outline-offset:-2px}.mm-icon{flex-shrink:0}.mm-text{display:flex;flex-direction:column;gap:2px;min-width:0}.mm-reason{font-size:.75rem;line-height:1.3;color:#475569;white-space:normal}@media(max-width:1024px){.mm-trigger{width:36px;height:36px}.mm-item{padding:11px 14px;min-height:40px}}@media(pointer:coarse){.mm-trigger{width:44px;height:44px}.mm-item{min-height:44px}}@media(max-width:640px){.mm-trigger{width:44px;height:44px}.mm-item{padding:12px 14px;font-size:.9375rem;min-height:44px}.mm-dropdown{max-height:60vh;overflow-y:auto}}\n"]
|
|
390
439
|
}]
|
|
391
440
|
}],
|
|
392
441
|
ctorParameters: () => [],
|
|
@@ -410,6 +459,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
410
459
|
actionClick: [{
|
|
411
460
|
type: i0.Output,
|
|
412
461
|
args: ["actionClick"]
|
|
462
|
+
}],
|
|
463
|
+
opened: [{
|
|
464
|
+
type: i0.Output,
|
|
465
|
+
args: ["opened"]
|
|
413
466
|
}]
|
|
414
467
|
}
|
|
415
468
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-more-menu.mjs","names":[],"sources":["../../../projects/forgeroute-ui/more-menu/src/lib/more-menu/more-menu.component.ts"],"sourcesContent":["import { Component, input, output, signal, effect, ChangeDetectionStrategy, ChangeDetectorRef, inject, ElementRef } from '@angular/core';\nimport { RowAction } from '@forgeroute/ui/table-types';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nexport interface MenuItem {\n type: string;\n label: string;\n icon?: string;\n primary?: boolean;\n danger?: boolean;\n disabled?: boolean;\n}\n\nconst BUILT_IN_ICONS: Record<string, string> = {\n 'view': 'M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z M12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z',\n 'edit': 'M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7 M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z',\n 'delete': 'M3 6h18 M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6 M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2',\n 'call': 'M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z',\n 'message': 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',\n 'email': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M22 6l-10 7L2 6',\n 'task': 'M9 11l3 3L22 4 M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11',\n 'opportunity': 'M22 12h-4l-3 9L9 3l-3 9H2',\n 'assign-owner': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M19 8v6 M22 11h-6',\n 'assign-agent': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M19 8v6 M22 11h-6',\n 'view-contact': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',\n 'confirm': 'M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3',\n 'decline': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M15 9l-6 6 M9 9l6 6',\n 'sphere': 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M23 21v-2a4 4 0 0 0-3-3.87 M16 3.13a4 4 0 0 1 0 7.75',\n 'remove-sphere': 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M23 18h-6',\n 'portal-invite': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M15 9l3 3-3 3 M18 12H8',\n 'archive': 'M21 8v13H3V8 M1 3h22v5H1z M10 12h4',\n 'duplicate': 'M20 2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z M4 6H2v14a2 2 0 0 0 2 2h14v-2H4V6z',\n 'download': 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3',\n 'export': 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3',\n 'share': 'M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8 M16 6l-4-4-4 4 M12 2v13',\n // Status / workflow actions\n 'approve': 'M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3',\n 'reject': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M15 9l-6 6 M9 9l6 6',\n 'activate': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M10 8l6 4-6 4V8z',\n 'deactivate': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M8 12h8',\n 'pause': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M10 15V9 M14 15V9',\n 'cancel': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M4.93 4.93l14.14 14.14',\n 'restore': 'M1 4v6h6 M3.51 15a9 9 0 1 0 2.13-9.36L1 10',\n // Create / navigate actions\n 'send-message': 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',\n 'create-job': 'M20 7H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16',\n 'view-job': 'M20 7H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16',\n 'create-invoice': 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8',\n 'create-estimate':'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M12 18v-6 M9 15h6',\n 'add-note': 'M12 20h9 M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z',\n 'history': 'M3 3v5h5 M3.05 13A9 9 0 1 0 6 5.3L3 8 M12 7v5l4 2',\n 'move-up': 'M12 19V5 M5 12l7-7 7 7',\n 'move-down': 'M12 5v14 M19 12l-7 7-7-7',\n 'invite-portal': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M15 9l3 3-3 3 M18 12H8',\n};\n\n/** Built-in SVG path for a row-action type (exported so apps can reuse it for their own action types). */\nexport function builtInActionIcon(type: string): string | undefined {\n // own keys only: 'constructor' / 'toString' / '__proto__' must not resolve to inherited Object members\n return Object.prototype.hasOwnProperty.call(BUILT_IN_ICONS, type) ? BUILT_IN_ICONS[type] : undefined;\n}\n\n@Component({\n selector: 'ui-more-menu',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(document:click)': 'onDocumentClick()',\n '(keydown.arrowdown)': 'onArrow($event, 1)',\n '(keydown.arrowup)': 'onArrow($event, -1)',\n },\n template: `\n <div class=\"mm-wrapper\">\n <button\n class=\"mm-trigger\"\n data-testid=\"more-menu-trigger\"\n [attr.aria-expanded]=\"open()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? labels.t('common.rowActions')\"\n (click)=\"toggle($event)\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"5\" r=\"1.5\"/><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><circle cx=\"12\" cy=\"19\" r=\"1.5\"/>\n </svg>\n </button>\n\n @if (open()) {\n <div class=\"mm-dropdown\" [class.mm-up]=\"openUp()\" [class.mm-fixed]=\"placement() !== null\"\n [style.top.px]=\"placement()?.top ?? null\" [style.bottom.px]=\"placement()?.bottom ?? null\" [style.right.px]=\"placement()?.right ?? null\"\n [style.max-height.px]=\"maxHeight()\" [style.max-width.px]=\"maxWidth()\" role=\"menu\">\n @for (action of visibleActions(); track action.type) {\n <button\n class=\"mm-item\"\n data-testid=\"more-menu-item\"\n [class.mm-danger]=\"action.variant === 'danger'\"\n [disabled]=\"isDisabled(action)\"\n role=\"menuitem\"\n (click)=\"onActionClick(action, $event)\">\n <svg class=\"mm-icon\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path [attr.d]=\"resolveIcon(action)\" />\n </svg>\n {{ action.label }}\n </button>\n }\n </div>\n }\n </div>\n `,\n styles: [`\n :host { display: inline-block; position: relative; }\n .mm-wrapper { position: relative; }\n .mm-trigger {\n display: flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; border-radius: 8px; border: none;\n background: transparent; color: #64748b; cursor: pointer;\n transition: background 0.1s, color 0.1s;\n &:hover { background: #f1f5f9; color: #334155; }\n &:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n }\n .mm-dropdown {\n position: absolute; right: 0; top: calc(100% + 4px); z-index: 200;\n border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.1); min-width: 160px;\n /* As wide as its longest item (up to the screen): without this the absolutely positioned menu is sized from its tiny ⋮ trigger wrapper,\n falls back to min-width and wraps \"View Document\" onto two lines. */\n width: max-content; box-sizing: border-box; /* the max-width cap (inline px or 100vw - 16px) then includes the padding and border: the menu never runs past the 8px screen margin */\n overflow-x: hidden; overflow-y: auto; padding: 4px;\n max-width: calc(100vw - 16px); overscroll-behavior: contain;\n /* Scroll affordance: edge shadows appear only when content is clipped on that side\n (\"scroll shadows\"): white covers (attachment: local) hide the shadows (attachment: scroll)\n once scrolled to that end, and everything is invisible when the menu does not overflow. */\n background:\n linear-gradient(#fff 30%, rgba(255,255,255,0)) center top / 100% 16px no-repeat local,\n linear-gradient(rgba(255,255,255,0), #fff 70%) center bottom / 100% 16px no-repeat local,\n radial-gradient(farthest-side at 50% 0, rgba(15,23,42,0.22), rgba(15,23,42,0)) center top / 100% 8px no-repeat scroll,\n radial-gradient(farthest-side at 50% 100%, rgba(15,23,42,0.22), rgba(15,23,42,0)) center bottom / 100% 8px no-repeat scroll,\n #fff;\n &.mm-up { top: auto; bottom: calc(100% + 4px); }\n /* Placed from the trigger's screen position (inline top / bottom / right), so no scrolling or overflow-hidden ancestor\n (e.g. the table's scroll box around a short table) can clip it. Used unless an ancestor has a transform / filter / contain,\n which would turn fixed into \"relative to that ancestor\" (then the absolute placement above is kept). */\n &.mm-fixed { position: fixed; left: auto; }\n }\n .mm-item {\n display: flex; align-items: center; gap: 10px; width: 100%;\n padding: 10px 12px; background: none; border: none; cursor: pointer;\n font-size: 0.875rem; color: #334155; font-family: inherit;\n text-align: left; border-radius: 5px; transition: background 0.1s;\n min-height: 40px;\n &:hover:not(:disabled) { background: #f8fafc; }\n &:disabled { opacity: 0.4; cursor: default; }\n &.mm-danger { color: #dc2626; }\n &.mm-danger:hover:not(:disabled) { background: #fef2f2; }\n &:focus-visible { outline: 2px solid #60a5fa; outline-offset: -2px; }\n }\n .mm-icon { flex-shrink: 0; }\n /* ── iPad (≤1024px) — 36px trigger, comfortable item height ─── */\n @media (max-width: 1024px) {\n .mm-trigger { width: 36px; height: 36px; }\n .mm-item { padding: 11px 14px; min-height: 40px; }\n }\n\n /* ── Touch (incl. iPad): 44px trigger, desktop mouse sizes unchanged ─── */\n @media (pointer: coarse) {\n .mm-trigger { width: 44px; height: 44px; }\n .mm-item { min-height: 44px; }\n }\n\n /* ── Phone (≤640px) — full touch targets, safe dropdown bounds ─── */\n @media (max-width: 640px) {\n .mm-trigger { width: 44px; height: 44px; }\n .mm-item { padding: 12px 14px; font-size: 0.9375rem; min-height: 44px; }\n .mm-dropdown { max-height: 60vh; overflow-y: auto; }\n }\n `],\n})\nexport class MoreMenuComponent {\n protected readonly labels = inject(UiLabelsService);\n /** Accessible name of the ⋮ trigger. Lists pass a row-specific one (\"Row actions for Acme Electric\"). */\n readonly ariaLabel = input<string | null>(null);\n readonly actions = input<RowAction[]>([]);\n readonly actionClick = output<string>();\n\n protected readonly open = signal(false);\n protected readonly openUp = signal(false);\n /** Caps the dropdown to the space on the side it opens, so it never runs off-screen; it scrolls instead. */\n protected readonly maxHeight = signal<number | null>(null);\n /** Caps a fixed dropdown to the visible width minus 8px each side (the CSS cap uses 100vw, which includes classic scrollbars). */\n protected readonly maxWidth = signal<number | null>(null);\n\n /**\n * Viewport placement (px) of a `position: fixed` dropdown; null = the dropdown is positioned absolutely under the trigger\n * (an ancestor with a transform / filter / contain makes `fixed` unusable there).\n */\n protected readonly placement = signal<{ top: number | null; bottom: number | null; right: number } | null>(null);\n\n private readonly _el = inject(ElementRef);\n private readonly _cdr = inject(ChangeDetectorRef);\n\n /** Width of the window when the menu opened: a resize that keeps it (the on-screen keyboard, a collapsing address bar) does not close the menu. */\n private _openWidth = 0;\n\n constructor() {\n effect(onCleanup => {\n if (!this.open()) return;\n // A press anywhere outside the menu closes it (pointerdown: iOS sends no click for plain page areas). Only registered while open.\n const onPointerDown = (event: Event) => this.onDocumentPointerDown(event);\n document.addEventListener('pointerdown', onPointerDown, true);\n // Escape closes only this menu: it is taken in the capture phase while the menu is open, so a surrounding side panel / modal\n // (which listens on the document) never sees that key press and stays open. With the menu closed nothing is registered.\n const onKeydown = (event: KeyboardEvent) => { if (event.key === 'Escape') this.onEscape(event); };\n document.addEventListener('keydown', onKeydown, true);\n // A fixed dropdown does not follow its trigger when something scrolls or the window is rotated / resized, so it closes then\n // (a scroll inside the dropdown itself, when it is height-capped, does not count).\n const fixed = this.placement() !== null;\n const onScroll = (event: Event) => {\n if (!(event.target instanceof Node && this._dropdownEl()?.contains(event.target))) this.open.set(false);\n };\n const onResize = () => {\n if (this._layoutViewport().width !== this._openWidth) this.open.set(false);\n };\n if (fixed) {\n document.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n }\n onCleanup(() => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('keydown', onKeydown, true);\n if (fixed) {\n document.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n }\n });\n });\n }\n\n protected readonly visibleActions = () =>\n this.actions().filter(a => !a.hidden?.(null));\n\n protected resolveIcon(action: RowAction): string {\n return action.icon ?? builtInActionIcon(action.type) ?? 'M5 12h14 M12 5l7 7-7 7';\n }\n\n protected isDisabled(action: RowAction): boolean {\n return typeof action.disabled === 'function' ? action.disabled(null) : !!action.disabled;\n }\n\n toggle(event: Event) {\n event.stopPropagation();\n if (this.open()) {\n this.open.set(false);\n return;\n }\n const triggerRect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n const view = this._layoutViewport();\n const fixed = this._fixedPositionable();\n this._openWidth = view.width;\n this.openUp.set(false);\n this.maxHeight.set(null);\n this.maxWidth.set(null);\n // Render the dropdown in its final kind of position (fixed under the trigger) so its real size can be measured: a dropdown\n // measured while absolute inside the narrow trigger wrapper would wrap long labels and report the wrong size.\n // `right: 8` gives the box the whole window width to size itself in (a box anchored at the trigger's right edge near the left\n // of the screen would be squeezed into the space left of the trigger); `_place` then sets the real right offset.\n this.placement.set(fixed ? { top: triggerRect.bottom + 4, bottom: null, right: 8 } : null);\n this.open.set(true);\n this._cdr.detectChanges();\n this._place(triggerRect, fixed);\n this._cdr.detectChanges();\n // preventScroll: focusing must never scroll anything (a scroll closes a fixed dropdown, and moves the page on phones)\n setTimeout(() => this._menuItems()[0]?.focus({ preventScroll: true }), 30);\n }\n\n /**\n * Decides where the open dropdown goes: below the trigger when its real height fits, otherwise above when there is more\n * room there, capped to the room on that side (it scrolls inside). Measured against the visible window (the on-screen\n * keyboard and pinch-zoom shrink it, and the home-indicator safe area is kept clear), or, when `position: fixed` is not\n * usable, against the nearest scrolling ancestor. A fixed dropdown also stays inside the screen horizontally.\n */\n private _place(rect: DOMRect, fixed: boolean): void {\n const dropdown = this._dropdownEl();\n if (!dropdown) return;\n const view = this._viewport();\n const layout = this._layoutViewport();\n const bounds = fixed\n ? { top: view.top, bottom: view.bottom - this._safeAreaBottom() }\n : this._visibleBounds();\n const natural = Math.max(dropdown.offsetHeight, dropdown.scrollHeight);\n const spaceBelow = bounds.bottom - rect.bottom;\n const spaceAbove = rect.top - bounds.top;\n // 4px gap to the trigger + 8px margin from the screen edge = 12px.\n // Only flip upward when it doesn't fit below AND there is more room above — otherwise an upward\n // menu can run off the top of the screen (e.g. under a fixed header) where items can't be tapped.\n const up = natural + 12 > spaceBelow && spaceAbove > spaceBelow;\n this.openUp.set(up);\n this.maxHeight.set(Math.max(120, Math.floor((up ? spaceAbove : spaceBelow) - 12)));\n if (!fixed) {\n this.placement.set(null);\n return;\n }\n // right-aligned with the trigger, moved left/right only as far as needed to stay 8px inside the visible window\n this.maxWidth.set(Math.max(160, view.right - view.left - 16));\n const width = Math.min(dropdown.offsetWidth, this.maxWidth()!);\n const rightEdge = Math.min(Math.max(rect.right, view.left + 8 + width), view.right - 8);\n const right = Math.max(8, layout.width - rightEdge);\n this.placement.set(up\n ? { top: null, bottom: layout.height - rect.top + 4, right }\n : { top: rect.bottom + 4, bottom: null, right });\n }\n\n /**\n * The layout viewport: the box `position: fixed` offsets are measured from. It excludes scrollbars and ignores pinch-zoom,\n * unlike `window.innerWidth / innerHeight`.\n */\n private _layoutViewport(): { width: number; height: number } {\n const root = document.documentElement;\n return { width: root.clientWidth, height: root.clientHeight };\n }\n\n /** The part of the page that is actually visible (shrinks with the on-screen keyboard and pinch-zoom on phones). */\n private _viewport(): { top: number; bottom: number; left: number; right: number } {\n const vv = window.visualViewport;\n if (!vv) {\n const layout = this._layoutViewport();\n return { top: 0, left: 0, right: layout.width, bottom: layout.height };\n }\n return { top: vv.offsetTop, left: vv.offsetLeft, right: vv.offsetLeft + vv.width, bottom: vv.offsetTop + vv.height };\n }\n\n /** Height of the bottom safe area (home indicator) in px; 0 where there is none. */\n protected _safeAreaBottom(): number {\n const probe = document.createElement('div');\n probe.style.cssText = 'position:fixed;left:0;top:0;width:0;height:0;visibility:hidden;padding-bottom:env(safe-area-inset-bottom,0px)';\n document.body.appendChild(probe);\n const value = parseFloat(getComputedStyle(probe).paddingBottom) || 0;\n probe.remove();\n return value;\n }\n\n onActionClick(action: RowAction, event: Event) {\n event.stopPropagation();\n this.actionClick.emit(action.type);\n this.open.set(false);\n this._trigger()?.focus();\n }\n\n onDocumentClick() {\n if (this.open()) this.open.set(false);\n }\n\n /** A touch or mouse press anywhere outside the menu closes it (more reliable than a click on phones: iOS does not send clicks for plain page areas). */\n onDocumentPointerDown(event: Event) {\n if (!this.open()) return;\n const target = event.target;\n if (target instanceof Node && this._el.nativeElement.contains(target)) return;\n this.open.set(false);\n }\n\n onEscape(event?: Event) {\n if (!this.open()) return; // closed: Escape is left to a surrounding side panel / modal\n event?.stopPropagation();\n event?.preventDefault();\n this.open.set(false);\n this._trigger()?.focus();\n }\n\n onArrow(event: Event, dir: 1 | -1) {\n if (!this.open()) return;\n event.preventDefault();\n const items = this._menuItems();\n if (!items.length) return;\n const idx = items.indexOf(document.activeElement as HTMLButtonElement);\n const next = idx === -1 ? 0 : (idx + dir + items.length) % items.length;\n items[next].focus();\n }\n\n /** Visible top/bottom of the nearest scrolling ancestor, clipped to the viewport. */\n private _visibleBounds(): { top: number; bottom: number } {\n let top = 0;\n let bottom = this._layoutViewport().height;\n let el: HTMLElement | null = (this._el.nativeElement as HTMLElement).parentElement;\n while (el && el !== document.body) {\n const oy = getComputedStyle(el).overflowY;\n if (oy === 'auto' || oy === 'scroll' || oy === 'hidden') {\n const r = el.getBoundingClientRect();\n top = Math.max(top, r.top);\n bottom = Math.min(bottom, r.bottom);\n break;\n }\n el = el.parentElement;\n }\n return { top, bottom };\n }\n\n /**\n * False when an ancestor creates a containing block for `position: fixed` (transform and the individual translate / rotate / scale,\n * filter, perspective, backdrop-filter, contain, container-type, content-visibility, will-change naming any of those).\n */\n private _fixedPositionable(): boolean {\n const isSet = (value: string | undefined) => !!value && value !== 'none';\n let el: HTMLElement | null = (this._el.nativeElement as HTMLElement).parentElement;\n while (el) {\n const cs = getComputedStyle(el) as CSSStyleDeclaration & Record<string, string | undefined>;\n if (\n isSet(cs.transform) || isSet(cs['translate']) || isSet(cs['rotate']) || isSet(cs['scale']) ||\n isSet(cs.filter) || isSet(cs.perspective) || isSet(cs['backdropFilter']) ||\n /paint|layout|strict|content/.test(cs.contain || '') ||\n (!!cs['containerType'] && cs['containerType'] !== 'normal') ||\n cs['contentVisibility'] === 'auto' ||\n /transform|filter|perspective|translate|rotate|scale|contain|backdrop-filter/.test(cs.willChange || '')\n ) return false;\n el = el.parentElement;\n }\n return true;\n }\n\n private _dropdownEl(): HTMLElement | null {\n return this._el.nativeElement.querySelector('.mm-dropdown') as HTMLElement | null;\n }\n\n private _menuItems(): HTMLButtonElement[] {\n return Array.from(\n this._el.nativeElement.querySelectorAll('.mm-item:not([disabled])')\n ) as HTMLButtonElement[];\n }\n\n private _trigger(): HTMLButtonElement | null {\n return this._el.nativeElement.querySelector('.mm-trigger') as HTMLButtonElement | null;\n }\n}\n"],"mappings":";;;AAaA,MAAM,iBAAyC;CAC7C,QAAkB;CAClB,QAAkB;CAClB,UAAkB;CAClB,QAAkB;CAClB,WAAkB;CAClB,SAAkB;CAClB,QAAkB;CAClB,eAAkB;CAClB,gBAAkB;CAClB,gBAAkB;CAClB,gBAAkB;CAClB,WAAkB;CAClB,WAAkB;CAClB,UAAkB;CAClB,iBAAkB;CAClB,iBAAkB;CAClB,WAAkB;CAClB,aAAkB;CAClB,YAAkB;CAClB,UAAkB;CAClB,SAAkB;CAElB,WAAkB;CAClB,UAAkB;CAClB,YAAkB;CAClB,cAAkB;CAClB,SAAkB;CAClB,UAAkB;CAClB,WAAkB;CAElB,gBAAkB;CAClB,cAAkB;CAClB,YAAkB;CAClB,kBAAkB;CAClB,mBAAkB;CAClB,YAAkB;CAClB,WAAkB;CAClB,WAAkB;CAClB,aAAkB;CAClB,iBAAkB;AACnB;AAGD,SAAgB,kBAAkB,MAAY;CAE5C,OAAO,OAAO,UAAU,eAAe,KAAK,gBAAgB,IAAI,IAAI,eAAe,QAAQ;AAC7F;AAmHA,IAAa,oBAAb,MAAa,kBAAiB;CA0B5B,cAAA;EAzBmB,KAAA,SAAS,OAAO,eAAe;EA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KAAK,IAAI,cAAc,cAAc,aAAa;CAC3D;CA5PW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAiB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAjB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAiB,cAAA;GAAA,UAAA;GAAA,QAAA;IAAA,WAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;IAAA,SAAA;KAAA,mBAAA;KAAA,YAAA;KAAA,UAAA;KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,SAAA,EAAA,aAAA,cAAA;GAAA,MAAA,EAAA,WAAA;IAAA,kBAAA;IAAA,qBAAA;IAAA,mBAAA;GAAA,EAAA;GAAA,UAAA;GAAA,UAxGlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCT,UAAA;GAAA,QAAA,CAAA,6gEAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAqEU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAjH7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,YACZ;GAAI,iBACC,wBAAwB;GAAM,MACzC;IACJ,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;GACtB;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCT,QAAA,CAAA,6gEAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-more-menu.mjs","names":[],"sources":["../../../projects/forgeroute-ui/more-menu/src/lib/more-menu/more-menu.component.ts"],"sourcesContent":["import { Component, input, output, signal, effect, ChangeDetectionStrategy, ChangeDetectorRef, inject, ElementRef } from '@angular/core';\nimport { RowAction } from '@forgeroute/ui/table-types';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nexport interface MenuItem {\n type: string;\n label: string;\n icon?: string;\n primary?: boolean;\n danger?: boolean;\n disabled?: boolean;\n}\n\nconst BUILT_IN_ICONS: Record<string, string> = {\n 'view': 'M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z M12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z',\n 'edit': 'M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7 M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z',\n 'delete': 'M3 6h18 M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6 M8 6V4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2',\n 'call': 'M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.127.96.361 1.903.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.907.339 1.85.573 2.81.7A2 2 0 0 1 22 16.92z',\n 'message': 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',\n 'email': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M22 6l-10 7L2 6',\n 'task': 'M9 11l3 3L22 4 M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11',\n 'opportunity': 'M22 12h-4l-3 9L9 3l-3 9H2',\n 'assign-owner': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M19 8v6 M22 11h-6',\n 'assign-agent': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M19 8v6 M22 11h-6',\n 'view-contact': 'M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2 M12 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z',\n 'confirm': 'M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3',\n 'decline': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M15 9l-6 6 M9 9l6 6',\n 'sphere': 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M23 21v-2a4 4 0 0 0-3-3.87 M16 3.13a4 4 0 0 1 0 7.75',\n 'remove-sphere': 'M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2 M9 3a4 4 0 1 0 0 8 4 4 0 0 0 0-8z M23 18h-6',\n 'portal-invite': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M15 9l3 3-3 3 M18 12H8',\n 'archive': 'M21 8v13H3V8 M1 3h22v5H1z M10 12h4',\n 'duplicate': 'M20 2H8a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2z M4 6H2v14a2 2 0 0 0 2 2h14v-2H4V6z',\n 'download': 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3',\n 'export': 'M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4 M7 10l5 5 5-5 M12 15V3',\n 'share': 'M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8 M16 6l-4-4-4 4 M12 2v13',\n // Status / workflow actions\n 'approve': 'M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4L12 14.01l-3-3',\n 'reject': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M15 9l-6 6 M9 9l6 6',\n 'activate': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M10 8l6 4-6 4V8z',\n 'deactivate': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M8 12h8',\n 'pause': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M10 15V9 M14 15V9',\n 'cancel': 'M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20z M4.93 4.93l14.14 14.14',\n 'restore': 'M1 4v6h6 M3.51 15a9 9 0 1 0 2.13-9.36L1 10',\n // Create / navigate actions\n 'send-message': 'M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z',\n 'create-job': 'M20 7H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16',\n 'view-job': 'M20 7H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z M16 21V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16',\n 'create-invoice': 'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M16 13H8 M16 17H8 M10 9H8',\n 'create-estimate':'M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z M14 2v6h6 M12 18v-6 M9 15h6',\n 'add-note': 'M12 20h9 M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z',\n 'history': 'M3 3v5h5 M3.05 13A9 9 0 1 0 6 5.3L3 8 M12 7v5l4 2',\n 'move-up': 'M12 19V5 M5 12l7-7 7 7',\n 'move-down': 'M12 5v14 M19 12l-7 7-7-7',\n 'invite-portal': 'M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z M15 9l3 3-3 3 M18 12H8',\n};\n\n/** Built-in SVG path for a row-action type (exported so apps can reuse it for their own action types). */\nexport function builtInActionIcon(type: string): string | undefined {\n // own keys only: 'constructor' / 'toString' / '__proto__' must not resolve to inherited Object members\n return Object.prototype.hasOwnProperty.call(BUILT_IN_ICONS, type) ? BUILT_IN_ICONS[type] : undefined;\n}\n\nlet nextMenuId = 0;\n\n@Component({\n selector: 'ui-more-menu',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '(document:click)': 'onDocumentClick()',\n '(keydown.arrowdown)': 'onArrow($event, 1)',\n '(keydown.arrowup)': 'onArrow($event, -1)',\n },\n template: `\n <div class=\"mm-wrapper\">\n <button\n class=\"mm-trigger\"\n data-testid=\"more-menu-trigger\"\n [attr.aria-expanded]=\"open()\"\n aria-haspopup=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? labels.t('common.rowActions')\"\n (click)=\"toggle($event)\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"5\" r=\"1.5\"/><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><circle cx=\"12\" cy=\"19\" r=\"1.5\"/>\n </svg>\n </button>\n\n @if (open()) {\n <div class=\"mm-dropdown\" [class.mm-up]=\"openUp()\" [class.mm-fixed]=\"placement() !== null\"\n [style.top.px]=\"placement()?.top ?? null\" [style.bottom.px]=\"placement()?.bottom ?? null\" [style.right.px]=\"placement()?.right ?? null\"\n [style.max-height.px]=\"maxHeight()\" [style.max-width.px]=\"maxWidth()\" role=\"menu\">\n @for (action of visibleActions(); track action.type) {\n @let reason = reasonFor(action);\n <button\n class=\"mm-item\"\n data-testid=\"more-menu-item\"\n [class.mm-danger]=\"action.variant === 'danger'\"\n [class.mm-has-reason]=\"!!reason\"\n [disabled]=\"isDisabled(action) && !reason\"\n [attr.aria-disabled]=\"isDisabled(action) && reason ? 'true' : null\"\n [attr.aria-describedby]=\"reason ? reasonId(action) : null\"\n role=\"menuitem\"\n (click)=\"onActionClick(action, $event)\">\n <svg class=\"mm-icon\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <path [attr.d]=\"resolveIcon(action)\" />\n </svg>\n @if (reason) {\n <span class=\"mm-text\">\n <span class=\"mm-label\">{{ action.label }}</span>\n <span class=\"mm-reason\" [id]=\"reasonId(action)\" data-testid=\"more-menu-reason\">{{ reason }}</span>\n </span>\n } @else {\n {{ action.label }}\n }\n </button>\n }\n </div>\n }\n </div>\n `,\n styles: [`\n :host { display: inline-block; position: relative; }\n .mm-wrapper { position: relative; }\n .mm-trigger {\n display: flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; border-radius: 8px; border: none;\n background: transparent; color: #64748b; cursor: pointer;\n transition: background 0.1s, color 0.1s;\n &:hover { background: #f1f5f9; color: #334155; }\n &:focus-visible { outline: 2px solid #3b82f6; outline-offset: 2px; }\n }\n .mm-dropdown {\n position: absolute; right: 0; top: calc(100% + 4px); z-index: 200;\n border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 4px 16px rgba(0,0,0,0.1); min-width: 160px;\n /* As wide as its longest item (up to the screen): without this the absolutely positioned menu is sized from its tiny ⋮ trigger wrapper,\n falls back to min-width and wraps \"View Document\" onto two lines. */\n width: max-content; box-sizing: border-box; /* the max-width cap (inline px or 100vw - 16px) then includes the padding and border: the menu never runs past the 8px screen margin */\n overflow-x: hidden; overflow-y: auto; padding: 4px;\n max-width: calc(100vw - 16px); overscroll-behavior: contain;\n /* Scroll affordance: edge shadows appear only when content is clipped on that side\n (\"scroll shadows\"): white covers (attachment: local) hide the shadows (attachment: scroll)\n once scrolled to that end, and everything is invisible when the menu does not overflow. */\n background:\n linear-gradient(#fff 30%, rgba(255,255,255,0)) center top / 100% 16px no-repeat local,\n linear-gradient(rgba(255,255,255,0), #fff 70%) center bottom / 100% 16px no-repeat local,\n radial-gradient(farthest-side at 50% 0, rgba(15,23,42,0.22), rgba(15,23,42,0)) center top / 100% 8px no-repeat scroll,\n radial-gradient(farthest-side at 50% 100%, rgba(15,23,42,0.22), rgba(15,23,42,0)) center bottom / 100% 8px no-repeat scroll,\n #fff;\n &.mm-up { top: auto; bottom: calc(100% + 4px); }\n /* Placed from the trigger's screen position (inline top / bottom / right), so no scrolling or overflow-hidden ancestor\n (e.g. the table's scroll box around a short table) can clip it. Used unless an ancestor has a transform / filter / contain,\n which would turn fixed into \"relative to that ancestor\" (then the absolute placement above is kept). */\n &.mm-fixed { position: fixed; left: auto; }\n }\n .mm-item {\n display: flex; align-items: center; gap: 10px; width: 100%;\n padding: 10px 12px; background: none; border: none; cursor: pointer;\n font-size: 0.875rem; color: #334155; font-family: inherit;\n text-align: left; border-radius: 5px; transition: background 0.1s;\n min-height: 40px;\n &:hover:not(:disabled) { background: #f8fafc; }\n &:disabled { opacity: 0.4; cursor: default; }\n &.mm-has-reason { cursor: default; align-items: flex-start; }\n /* A disabled item that explains itself keeps real contrast (no opacity): #64748b on white is 4.76:1 (text >= 4.5:1), the icon the same colour (non-text >= 3:1). Danger items go muted too, the reason line says why. */\n &.mm-has-reason .mm-icon { margin-top: 2px; color: #64748b; }\n &.mm-has-reason .mm-label { color: #64748b; }\n &.mm-has-reason:hover { background: none; }\n &.mm-danger { color: #dc2626; }\n &.mm-danger:hover:not(:disabled) { background: #fef2f2; }\n &:focus-visible { outline: 2px solid #60a5fa; outline-offset: -2px; }\n }\n .mm-icon { flex-shrink: 0; }\n .mm-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }\n /* The reason is real text (never colour alone), full contrast: #475569 on white is 7.6:1 */\n .mm-reason { font-size: 0.75rem; line-height: 1.3; color: #475569; white-space: normal; }\n /* ── iPad (≤1024px) — 36px trigger, comfortable item height ─── */\n @media (max-width: 1024px) {\n .mm-trigger { width: 36px; height: 36px; }\n .mm-item { padding: 11px 14px; min-height: 40px; }\n }\n\n /* ── Touch (incl. iPad): 44px trigger, desktop mouse sizes unchanged ─── */\n @media (pointer: coarse) {\n .mm-trigger { width: 44px; height: 44px; }\n .mm-item { min-height: 44px; }\n }\n\n /* ── Phone (≤640px) — full touch targets, safe dropdown bounds ─── */\n @media (max-width: 640px) {\n .mm-trigger { width: 44px; height: 44px; }\n .mm-item { padding: 12px 14px; font-size: 0.9375rem; min-height: 44px; }\n .mm-dropdown { max-height: 60vh; overflow-y: auto; }\n }\n `],\n})\nexport class MoreMenuComponent {\n protected readonly labels = inject(UiLabelsService);\n /** Accessible name of the ⋮ trigger. Lists pass a row-specific one (\"Row actions for Acme Electric\"). */\n readonly ariaLabel = input<string | null>(null);\n readonly actions = input<RowAction[]>([]);\n readonly actionClick = output<string>();\n /** The menu was opened (the ⋮ trigger was pressed and the dropdown is showing). Library source 2026-11-21. */\n readonly opened = output<void>();\n\n protected readonly open = signal(false);\n protected readonly openUp = signal(false);\n /** Caps the dropdown to the space on the side it opens, so it never runs off-screen; it scrolls instead. */\n protected readonly maxHeight = signal<number | null>(null);\n /** Caps a fixed dropdown to the visible width minus 8px each side (the CSS cap uses 100vw, which includes classic scrollbars). */\n protected readonly maxWidth = signal<number | null>(null);\n\n /**\n * Viewport placement (px) of a `position: fixed` dropdown; null = the dropdown is positioned absolutely under the trigger\n * (an ancestor with a transform / filter / contain makes `fixed` unusable there).\n */\n protected readonly placement = signal<{ top: number | null; bottom: number | null; right: number } | null>(null);\n\n private readonly _el = inject(ElementRef);\n private readonly _cdr = inject(ChangeDetectorRef);\n\n /** Width of the window when the menu opened: a resize that keeps it (the on-screen keyboard, a collapsing address bar) does not close the menu. */\n private _openWidth = 0;\n\n constructor() {\n effect(onCleanup => {\n if (!this.open()) return;\n // A press anywhere outside the menu closes it (pointerdown: iOS sends no click for plain page areas). Only registered while open.\n const onPointerDown = (event: Event) => this.onDocumentPointerDown(event);\n document.addEventListener('pointerdown', onPointerDown, true);\n // Escape closes only this menu: it is taken in the capture phase while the menu is open, so a surrounding side panel / modal\n // (which listens on the document) never sees that key press and stays open. With the menu closed nothing is registered.\n const onKeydown = (event: KeyboardEvent) => { if (event.key === 'Escape') this.onEscape(event); };\n document.addEventListener('keydown', onKeydown, true);\n // A fixed dropdown does not follow its trigger when something scrolls or the window is rotated / resized, so it closes then\n // (a scroll inside the dropdown itself, when it is height-capped, does not count).\n const fixed = this.placement() !== null;\n const onScroll = (event: Event) => {\n if (!(event.target instanceof Node && this._dropdownEl()?.contains(event.target))) this.open.set(false);\n };\n const onResize = () => {\n if (this._layoutViewport().width !== this._openWidth) this.open.set(false);\n };\n if (fixed) {\n document.addEventListener('scroll', onScroll, true);\n window.addEventListener('resize', onResize);\n }\n onCleanup(() => {\n document.removeEventListener('pointerdown', onPointerDown, true);\n document.removeEventListener('keydown', onKeydown, true);\n if (fixed) {\n document.removeEventListener('scroll', onScroll, true);\n window.removeEventListener('resize', onResize);\n }\n });\n });\n }\n\n protected readonly visibleActions = () =>\n this.actions().filter(a => !a.hidden?.(null));\n\n protected resolveIcon(action: RowAction): string {\n return action.icon ?? builtInActionIcon(action.type) ?? 'M5 12h14 M12 5l7 7-7 7';\n }\n\n protected isDisabled(action: RowAction): boolean {\n if (typeof action.disabled !== 'function') return !!action.disabled;\n try { return !!action.disabled(null); } catch { return false; } // a row-based function called without a row must never break the menu: not disabled\n }\n\n /** The visible reason of a DISABLED action (`RowAction.disabledReason`), or '' when there is none. A function reason is called with `null` here; `ui-data-table` resolves it with the row before handing the actions over. */\n protected reasonFor(action: RowAction): string {\n if (!this.isDisabled(action)) return '';\n const raw = action.disabledReason;\n let value: string | null | undefined;\n try { value = typeof raw === 'function' ? raw(null) : raw; } catch { value = null; }\n return typeof value === 'string' ? value.trim() : '';\n }\n\n private readonly _uid = nextMenuId++;\n protected reasonId(action: RowAction): string { return `mm-${this._uid}-reason-${action.type.replace(/[^A-Za-z0-9_-]/g, '-')}`; }\n\n toggle(event: Event) {\n event.stopPropagation();\n if (this.open()) {\n this.open.set(false);\n return;\n }\n const triggerRect = (event.currentTarget as HTMLElement).getBoundingClientRect();\n const view = this._layoutViewport();\n const fixed = this._fixedPositionable();\n this._openWidth = view.width;\n this.openUp.set(false);\n this.maxHeight.set(null);\n this.maxWidth.set(null);\n // Render the dropdown in its final kind of position (fixed under the trigger) so its real size can be measured: a dropdown\n // measured while absolute inside the narrow trigger wrapper would wrap long labels and report the wrong size.\n // `right: 8` gives the box the whole window width to size itself in (a box anchored at the trigger's right edge near the left\n // of the screen would be squeezed into the space left of the trigger); `_place` then sets the real right offset.\n this.placement.set(fixed ? { top: triggerRect.bottom + 4, bottom: null, right: 8 } : null);\n this.open.set(true);\n this._cdr.detectChanges();\n this._place(triggerRect, fixed);\n this._cdr.detectChanges();\n // preventScroll: focusing must never scroll anything (a scroll closes a fixed dropdown, and moves the page on phones)\n setTimeout(() => this._menuItems()[0]?.focus({ preventScroll: true }), 30);\n this.opened.emit();\n }\n\n /**\n * Decides where the open dropdown goes: below the trigger when its real height fits, otherwise above when there is more\n * room there, capped to the room on that side (it scrolls inside). Measured against the visible window (the on-screen\n * keyboard and pinch-zoom shrink it, and the home-indicator safe area is kept clear), or, when `position: fixed` is not\n * usable, against the nearest scrolling ancestor. A fixed dropdown also stays inside the screen horizontally.\n */\n private _place(rect: DOMRect, fixed: boolean): void {\n const dropdown = this._dropdownEl();\n if (!dropdown) return;\n const view = this._viewport();\n const layout = this._layoutViewport();\n const bounds = fixed\n ? { top: view.top, bottom: view.bottom - this._safeAreaBottom() }\n : this._visibleBounds();\n const natural = Math.max(dropdown.offsetHeight, dropdown.scrollHeight);\n const spaceBelow = bounds.bottom - rect.bottom;\n const spaceAbove = rect.top - bounds.top;\n // 4px gap to the trigger + 8px margin from the screen edge = 12px.\n // Only flip upward when it doesn't fit below AND there is more room above — otherwise an upward\n // menu can run off the top of the screen (e.g. under a fixed header) where items can't be tapped.\n const up = natural + 12 > spaceBelow && spaceAbove > spaceBelow;\n this.openUp.set(up);\n this.maxHeight.set(Math.max(120, Math.floor((up ? spaceAbove : spaceBelow) - 12)));\n if (!fixed) {\n this.placement.set(null);\n return;\n }\n // right-aligned with the trigger, moved left/right only as far as needed to stay 8px inside the visible window\n this.maxWidth.set(Math.max(160, view.right - view.left - 16));\n const width = Math.min(dropdown.offsetWidth, this.maxWidth()!);\n const rightEdge = Math.min(Math.max(rect.right, view.left + 8 + width), view.right - 8);\n const right = Math.max(8, layout.width - rightEdge);\n this.placement.set(up\n ? { top: null, bottom: layout.height - rect.top + 4, right }\n : { top: rect.bottom + 4, bottom: null, right });\n }\n\n /**\n * The layout viewport: the box `position: fixed` offsets are measured from. It excludes scrollbars and ignores pinch-zoom,\n * unlike `window.innerWidth / innerHeight`.\n */\n private _layoutViewport(): { width: number; height: number } {\n const root = document.documentElement;\n return { width: root.clientWidth, height: root.clientHeight };\n }\n\n /** The part of the page that is actually visible (shrinks with the on-screen keyboard and pinch-zoom on phones). */\n private _viewport(): { top: number; bottom: number; left: number; right: number } {\n const vv = window.visualViewport;\n if (!vv) {\n const layout = this._layoutViewport();\n return { top: 0, left: 0, right: layout.width, bottom: layout.height };\n }\n return { top: vv.offsetTop, left: vv.offsetLeft, right: vv.offsetLeft + vv.width, bottom: vv.offsetTop + vv.height };\n }\n\n /** Height of the bottom safe area (home indicator) in px; 0 where there is none. */\n protected _safeAreaBottom(): number {\n const probe = document.createElement('div');\n probe.style.cssText = 'position:fixed;left:0;top:0;width:0;height:0;visibility:hidden;padding-bottom:env(safe-area-inset-bottom,0px)';\n document.body.appendChild(probe);\n const value = parseFloat(getComputedStyle(probe).paddingBottom) || 0;\n probe.remove();\n return value;\n }\n\n onActionClick(action: RowAction, event: Event) {\n event.stopPropagation();\n // A disabled action with a reason is aria-disabled (focusable, so its reason can be read), not `disabled`: it must still never run.\n if (this.isDisabled(action)) return;\n this.actionClick.emit(action.type);\n this.open.set(false);\n this._trigger()?.focus();\n }\n\n onDocumentClick() {\n if (this.open()) this.open.set(false);\n }\n\n /** A touch or mouse press anywhere outside the menu closes it (more reliable than a click on phones: iOS does not send clicks for plain page areas). */\n onDocumentPointerDown(event: Event) {\n if (!this.open()) return;\n const target = event.target;\n if (target instanceof Node && this._el.nativeElement.contains(target)) return;\n this.open.set(false);\n }\n\n onEscape(event?: Event) {\n if (!this.open()) return; // closed: Escape is left to a surrounding side panel / modal\n event?.stopPropagation();\n event?.preventDefault();\n this.open.set(false);\n this._trigger()?.focus();\n }\n\n onArrow(event: Event, dir: 1 | -1) {\n if (!this.open()) return;\n event.preventDefault();\n const items = this._menuItems();\n if (!items.length) return;\n const idx = items.indexOf(document.activeElement as HTMLButtonElement);\n const next = idx === -1 ? 0 : (idx + dir + items.length) % items.length;\n items[next].focus();\n }\n\n /** Visible top/bottom of the nearest scrolling ancestor, clipped to the viewport. */\n private _visibleBounds(): { top: number; bottom: number } {\n let top = 0;\n let bottom = this._layoutViewport().height;\n let el: HTMLElement | null = (this._el.nativeElement as HTMLElement).parentElement;\n while (el && el !== document.body) {\n const oy = getComputedStyle(el).overflowY;\n if (oy === 'auto' || oy === 'scroll' || oy === 'hidden') {\n const r = el.getBoundingClientRect();\n top = Math.max(top, r.top);\n bottom = Math.min(bottom, r.bottom);\n break;\n }\n el = el.parentElement;\n }\n return { top, bottom };\n }\n\n /**\n * False when an ancestor creates a containing block for `position: fixed` (transform and the individual translate / rotate / scale,\n * filter, perspective, backdrop-filter, contain, container-type, content-visibility, will-change naming any of those).\n */\n private _fixedPositionable(): boolean {\n const isSet = (value: string | undefined) => !!value && value !== 'none';\n let el: HTMLElement | null = (this._el.nativeElement as HTMLElement).parentElement;\n while (el) {\n const cs = getComputedStyle(el) as CSSStyleDeclaration & Record<string, string | undefined>;\n if (\n isSet(cs.transform) || isSet(cs['translate']) || isSet(cs['rotate']) || isSet(cs['scale']) ||\n isSet(cs.filter) || isSet(cs.perspective) || isSet(cs['backdropFilter']) ||\n /paint|layout|strict|content/.test(cs.contain || '') ||\n (!!cs['containerType'] && cs['containerType'] !== 'normal') ||\n cs['contentVisibility'] === 'auto' ||\n /transform|filter|perspective|translate|rotate|scale|contain|backdrop-filter/.test(cs.willChange || '')\n ) return false;\n el = el.parentElement;\n }\n return true;\n }\n\n private _dropdownEl(): HTMLElement | null {\n return this._el.nativeElement.querySelector('.mm-dropdown') as HTMLElement | null;\n }\n\n private _menuItems(): HTMLButtonElement[] {\n return Array.from(\n this._el.nativeElement.querySelectorAll('.mm-item:not([disabled])')\n ) as HTMLButtonElement[];\n }\n\n private _trigger(): HTMLButtonElement | null {\n return this._el.nativeElement.querySelector('.mm-trigger') as HTMLButtonElement | null;\n }\n}\n"],"mappings":";;;AAaA,MAAM,iBAAyC;CAC7C,QAAkB;CAClB,QAAkB;CAClB,UAAkB;CAClB,QAAkB;CAClB,WAAkB;CAClB,SAAkB;CAClB,QAAkB;CAClB,eAAkB;CAClB,gBAAkB;CAClB,gBAAkB;CAClB,gBAAkB;CAClB,WAAkB;CAClB,WAAkB;CAClB,UAAkB;CAClB,iBAAkB;CAClB,iBAAkB;CAClB,WAAkB;CAClB,aAAkB;CAClB,YAAkB;CAClB,UAAkB;CAClB,SAAkB;CAElB,WAAkB;CAClB,UAAkB;CAClB,YAAkB;CAClB,cAAkB;CAClB,SAAkB;CAClB,UAAkB;CAClB,WAAkB;CAElB,gBAAkB;CAClB,cAAkB;CAClB,YAAkB;CAClB,kBAAkB;CAClB,mBAAkB;CAClB,YAAkB;CAClB,WAAkB;CAClB,WAAkB;CAClB,aAAkB;CAClB,iBAAkB;AACnB;AAGD,SAAgB,kBAAkB,MAAY;CAE5C,OAAO,OAAO,UAAU,eAAe,KAAK,gBAAgB,IAAI,IAAI,eAAe,QAAQ;AAC7F;AAEA,IAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CT,UAAA;GAAA,QAAA,CAAA,g3EAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AA6EU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EApI7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAc,YACZ;GAAI,iBACC,wBAAwB;GAAM,MACzC;IACJ,oBAAoB;IACpB,uBAAuB;IACvB,qBAAqB;GACtB;GAAA,UACS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CT,QAAA,CAAA,g3EAAA;EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forgeroute-ui-multi-select.mjs","names":[],"sources":["../../../projects/forgeroute-ui/multi-select/src/lib/multi-select/multi-select.component.ts"],"sourcesContent":["import {\n Component, ChangeDetectionStrategy, ElementRef, HostListener, input, model, signal, computed, forwardRef, inject,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChipComponent } from '@forgeroute/ui/chip';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport type { SelectOption } from '@forgeroute/ui/select';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { createFieldReveal } from '@forgeroute/ui/core';\n\n/**\n * Searchable multi-value dropdown. Selected values render as dismissible chips above the trigger.\n *\n * Bind with `[(selected)]` or `[(ngModel)]` — the value is an array of option `value`s.\n *\n * <ui-multi-select label=\"Job Types\" [options]=\"jobTypeOptions\" [(selected)]=\"jobTypeIds\" />\n */\n@Component({\n selector: 'ui-multi-select',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [ChipComponent, CheckboxComponent],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MultiSelectComponent),\n multi: true,\n }],\n template: `\n <div class=\"ms-field\" [class.ms-has-error]=\"_shownError()\" [class.ms-disabled]=\"disabled()\">\n @if (label()) {\n <span class=\"ms-label\" [id]=\"_id + '-label'\">\n {{ label() }}\n @if (required()) { <span class=\"ms-required\" aria-hidden=\"true\">*</span> }\n </span>\n }\n\n @if (_selectedOptions().length) {\n <div class=\"ms-tags\">\n @for (opt of _selectedOptions(); track opt.value) {\n <ui-chip size=\"sm\" [label]=\"opt.label\" [active]=\"true\" [dismissible]=\"!disabled()\" (dismiss)=\"remove(opt.value)\" />\n }\n </div>\n }\n\n <div class=\"ms-wrap\">\n <button\n type=\"button\"\n class=\"ms-trigger\"\n [class.ms-open]=\"_open()\"\n [disabled]=\"disabled()\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"_open()\"\n [attr.aria-controls]=\"_open() ? _id + '-options' : null\"\n [attr.aria-labelledby]=\"label() ? _id + '-label' : null\"\n [attr.aria-describedby]=\"_shownError() ? _id + '-error' : (hint() ? _id + '-hint' : null)\"\n [attr.aria-invalid]=\"_shownError() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"toggleOpen()\"\n (keydown.escape)=\"onEscape($event)\">\n <span class=\"ms-placeholder\">{{ _selectedSet().size ? labels.t(_selectedSet().size === 1 ? 'multiSelect.nSelected_one' : 'multiSelect.nSelected_other', { count: _selectedSet().size }) : placeholder() }}</span>\n <svg class=\"ms-chevron\" [class.ms-chevron-open]=\"_open()\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" aria-hidden=\"true\"><polyline points=\"6 9 12 15 18 9\"/></svg>\n </button>\n\n @if (_open()) {\n <div class=\"ms-dropdown\" [id]=\"_id + '-list'\" (keydown.escape)=\"onEscape($event)\">\n @if (searchable()) {\n <div class=\"ms-search-wrap\">\n <input\n class=\"ms-search\"\n type=\"text\"\n [placeholder]=\"searchPlaceholder()\"\n [attr.aria-label]=\"searchPlaceholder()\"\n [value]=\"_query()\"\n (input)=\"_query.set($any($event.target).value)\" />\n </div>\n }\n <div class=\"ms-options\" role=\"group\" [id]=\"_id + '-options'\" [attr.aria-labelledby]=\"label() ? _id + '-label' : null\">\n @for (opt of _filteredOptions(); track opt.value) {\n <div class=\"ms-option\" [class.ms-option-selected]=\"_selectedSet().has(opt.value)\">\n <ui-checkbox\n [label]=\"opt.label\"\n [checked]=\"_selectedSet().has(opt.value)\"\n [description]=\"opt.description ?? ''\"\n (checkedChange)=\"toggleValue(opt.value)\" />\n </div>\n } @empty {\n <div class=\"ms-empty\">{{ labels.t('multiSelect.noOptionsFound') }}</div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (_shownError()) {\n <p class=\"ms-desc ms-desc-error\" [id]=\"_id + '-error'\" role=\"alert\">{{ _shownError() }}</p>\n } @else if (hint()) {\n <p class=\"ms-desc\" [id]=\"_id + '-hint'\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n\n .ms-field { display: flex; flex-direction: column; gap: 6px; }\n\n .ms-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .ms-required { color: #dc2626; margin-left: 2px; }\n\n .ms-tags { display: flex; flex-wrap: wrap; gap: 6px; }\n\n .ms-wrap { position: relative; }\n\n .ms-trigger {\n width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between;\n padding: 9px 10px 9px 12px; font-size: 0.875rem; font-family: inherit; text-align: left;\n color: #1e293b; background: #fff; border: 1px solid #7c8ba1; border-radius: 8px;\n cursor: pointer; outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n &:focus-visible, &.ms-open { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n }\n .ms-has-error .ms-trigger { border-color: #ef4444; }\n .ms-disabled .ms-trigger { opacity: 0.5; cursor: not-allowed; }\n\n .ms-placeholder { color: #64748b; }\n\n .ms-chevron { color: #64748b; flex-shrink: 0; margin-left: 8px; transition: transform 0.2s ease; }\n .ms-chevron-open { transform: rotate(180deg); }\n\n .ms-dropdown {\n position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;\n display: flex; flex-direction: column; max-height: 260px;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);\n }\n\n .ms-search-wrap { padding: 8px; border-bottom: 1px solid #e2e8f0; }\n .ms-search {\n width: 100%; box-sizing: border-box; padding: 7px 10px;\n font-size: 0.8125rem; font-family: inherit; color: #1e293b;\n border: 1px solid #7c8ba1; border-radius: 6px; outline: none;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; }\n }\n\n .ms-options { overflow-y: auto; padding: 4px 0; }\n .ms-option {\n padding: 7px 12px; font-size: 0.8125rem;\n &:hover { background: #f8fafc; }\n }\n .ms-option-selected { background: #eff6ff; }\n\n .ms-empty { padding: 16px; text-align: center; color: #94a3b8; font-size: 0.8125rem; }\n\n .ms-desc { margin: 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .ms-desc-error { color: #dc2626; }\n\n @media (max-width: 480px) { .ms-trigger, .ms-search { font-size: 1rem; } }\n `],\n})\nexport class MultiSelectComponent implements ControlValueAccessor {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n readonly placeholderInput = input<string | null>(null, { alias: 'placeholder' });\n readonly placeholder = computed(() => this.placeholderInput() ?? this.labels.t('multiSelect.placeholder'));\n readonly options = input<SelectOption[]>([]);\n readonly searchable = input(true);\n readonly searchPlaceholderInput = input<string | null>(null, { alias: 'searchPlaceholder' });\n readonly searchPlaceholder = computed(() => this.searchPlaceholderInput() ?? this.labels.t('multiSelect.searchPlaceholder'));\n readonly required = input(false);\n readonly hint = input('');\n readonly error = input('');\n /** Selected option values — two-way bindable as `[(selected)]`. */\n readonly selected = model<string[]>([]);\n\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n private readonly el = inject(ElementRef);\n protected readonly _id = `ms-${Math.random().toString(36).slice(2, 8)}`;\n protected readonly _open = signal(false);\n protected readonly _query = signal('');\n\n protected readonly _selectedSet = computed(() => new Set(this.selected()));\n protected readonly _selectedOptions = computed(() => this.options().filter(o => this._selectedSet().has(o.value)));\n protected readonly _filteredOptions = computed(() => {\n const fold = (v: string) => v.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '').toLowerCase();\n const q = fold(this._query().trim());\n return q ? this.options().filter(o => fold(o.label).includes(q)) : this.options();\n });\n\n private _onChange = (_: string[]) => {};\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click): `true` shows the host `error` at once, even before the user touched the field; otherwise it shows once the user closed the list or moved focus out of the control (Tab away) even if the list stayed open; true -> false forgets the interaction (closing the form leaves no red field). */\n readonly showErrors = input(false);\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _touched = this._reveal.touched;\n protected readonly _shownError = computed(() => this._reveal.revealed() ? this.error() : '');\n /** Forgets that the user interacted (call it when the host resets its form): a host `error` is hidden again until the list is closed or focus leaves. Same method on ui-signature-pad and ui-rich-text-editor. */\n resetTouched(): void { this._touched.set(false); }\n private _onTouched = () => {};\n\n writeValue(val: string[] | null) { this.selected.set(val ?? []); }\n registerOnChange(fn: (v: string[]) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n @HostListener('document:click', ['$event'])\n protected onDocumentClick(event: Event) {\n if (this._open() && !this.el.nativeElement.contains(event.target)) this.close();\n }\n\n /** Focus moved to another element outside the control (Tab away): the field counts as touched even when the list stayed open. */\n @HostListener('focusout', ['$event'])\n protected onFocusOut(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n if (!next || this.el.nativeElement.contains(next)) return;\n this._touched.set(true);\n this._onTouched();\n }\n\n /** Escape with the list open closes ONLY the list (focus back on the trigger) and is not passed on, so a surrounding side panel / modal stays open. */\n protected onEscape(event: Event) {\n if (!this._open()) return;\n event.preventDefault();\n event.stopPropagation();\n this.close();\n (this.el.nativeElement as HTMLElement).querySelector<HTMLElement>('.ms-trigger')?.focus();\n }\n\n protected toggleOpen() {\n if (this.disabled()) return;\n if (this._open()) this.close(); else this._open.set(true);\n }\n\n protected toggleValue(value: string) {\n const set = new Set(this.selected());\n if (set.has(value)) set.delete(value); else set.add(value);\n this._set(Array.from(set));\n }\n\n protected remove(value: string) {\n this._set(this.selected().filter(v => v !== value));\n }\n\n private close() {\n this._open.set(false);\n this._query.set('');\n this._touched.set(true);\n this._onTouched();\n }\n\n private _set(values: string[]) {\n this.selected.set(values);\n this._onChange(values);\n }\n}\n"],"mappings":";;;;;;AA8JA,IAAa,uBAAb,MAAa,qBAAoB;CA7IjC,cAAA;EA8IqB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,QAAoB,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;EAC7B,KAAA,mBAAmB,MAAqB,MAAI;GAAA,GAAA,YAAA,EAAA,WAAA,mBAAA,+BAAA,CAAA;GAAI,OAAO;EAAa,CAAA;EACpE,KAAA,cAAc,eAAe,KAAK,iBAAgB,KAAM,KAAK,OAAO,EAAE,yBAAyB,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;EACjG,KAAA,UAAoB,MAAsB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;EAC7C,KAAA,aAAoB,MAAM,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;EAC/B,KAAA,yBAAyB,MAAqB,MAAI;GAAA,GAAA,YAAA,EAAA,WAAA,yBAAA,+BAAA,CAAA;GAAI,OAAO;EAAmB,CAAA;EAChF,KAAA,oBAAoB,eAAe,KA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;;;;;;;;;;;;;;;;;;;;;;GAwET,UAAA;GAAA,QAAA,CAAA,g2DAAA;GAAA,cAAA,CAAA;IAAA,MAAA;IAAA,MA9ES;IAAa,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,UAAA,SAAA;GAAA,GAAA;IAAA,MAAA;IAAA,MAAE;IAAiB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA;KAAA;KAAA;KAAA;IAAA;GAAA,CAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAyI/B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAoB,YAAA,CAAA;EA7IhC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAiB,YACf;GAAI,iBACC,wBAAwB;GAAM,SACtC,CAAC,eAAe,iBAAiB;GAAC,WAChC,CAAC;IACV,SAAS;IACT,aAAa,iBAAgB,oBAAqB;IAClD,OAAO;GACR,CAAA;GAAC,UACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwET,QAAA,CAAA,g2DAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0GA,MAAA;GAAa,MAAA,CAAA,kBAAkB,CAAC,QAAQ,CAAC;;;GAMzC,MAAA;GAAa,MAAA,CAAA,YAAY,CAAC,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-multi-select.mjs","names":[],"sources":["../../../projects/forgeroute-ui/multi-select/src/lib/multi-select/multi-select.component.ts"],"sourcesContent":["import {\n Component, ChangeDetectionStrategy, ElementRef, HostListener, input, model, signal, computed, forwardRef, inject,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { ChipComponent } from '@forgeroute/ui/chip';\nimport { CheckboxComponent } from '@forgeroute/ui/checkbox';\nimport type { SelectOption } from '@forgeroute/ui/select';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { createFieldReveal } from '@forgeroute/ui/core';\n\n/**\n * Searchable multi-value dropdown. Selected values render as dismissible chips above the trigger.\n *\n * Bind with `[(selected)]` or `[(ngModel)]` — the value is an array of option `value`s.\n *\n * <ui-multi-select label=\"Job Types\" [options]=\"jobTypeOptions\" [(selected)]=\"jobTypeIds\" />\n */\n@Component({\n selector: 'ui-multi-select',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [ChipComponent, CheckboxComponent],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MultiSelectComponent),\n multi: true,\n }],\n template: `\n <div class=\"ms-field\" [class.ms-has-error]=\"_shownError()\" [class.ms-disabled]=\"disabled()\">\n @if (label()) {\n <span class=\"ms-label\" [id]=\"_id + '-label'\">\n {{ label() }}\n @if (required()) { <span class=\"ms-required\" aria-hidden=\"true\">*</span> }\n </span>\n }\n\n @if (_selectedOptions().length) {\n <div class=\"ms-tags\">\n @for (opt of _selectedOptions(); track opt.value) {\n <ui-chip size=\"sm\" [label]=\"opt.label\" [active]=\"true\" [dismissible]=\"!disabled()\" (dismiss)=\"remove(opt.value)\" />\n }\n </div>\n }\n\n <div class=\"ms-wrap\">\n <button\n type=\"button\"\n class=\"ms-trigger\"\n [class.ms-open]=\"_open()\"\n [disabled]=\"disabled()\"\n aria-haspopup=\"true\"\n [attr.aria-expanded]=\"_open()\"\n [attr.aria-controls]=\"_open() ? _id + '-options' : null\"\n [attr.aria-labelledby]=\"label() ? _id + '-label' : null\"\n [attr.aria-describedby]=\"_shownError() ? _id + '-error' : (hint() ? _id + '-hint' : null)\"\n [attr.aria-invalid]=\"_shownError() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n (click)=\"toggleOpen()\"\n (keydown.escape)=\"onEscape($event)\">\n <span class=\"ms-placeholder\">{{ _selectedSet().size ? labels.t(_selectedSet().size === 1 ? 'multiSelect.nSelected_one' : 'multiSelect.nSelected_other', { count: _selectedSet().size }) : placeholder() }}</span>\n <svg class=\"ms-chevron\" [class.ms-chevron-open]=\"_open()\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" aria-hidden=\"true\"><polyline points=\"6 9 12 15 18 9\"/></svg>\n </button>\n\n @if (_open()) {\n <div class=\"ms-dropdown\" [id]=\"_id + '-list'\" (keydown.escape)=\"onEscape($event)\">\n @if (searchable()) {\n <div class=\"ms-search-wrap\">\n <input\n class=\"ms-search\"\n type=\"text\"\n [placeholder]=\"searchPlaceholder()\"\n [attr.aria-label]=\"searchPlaceholder()\"\n [value]=\"_query()\"\n (input)=\"_query.set($any($event.target).value)\" />\n </div>\n }\n <div class=\"ms-options\" role=\"group\" [id]=\"_id + '-options'\" [attr.aria-labelledby]=\"label() ? _id + '-label' : null\">\n @for (opt of _filteredOptions(); track opt.value) {\n <div class=\"ms-option\" [class.ms-option-selected]=\"_selectedSet().has(opt.value)\">\n <ui-checkbox\n [label]=\"opt.label\"\n [checked]=\"_selectedSet().has(opt.value)\"\n [description]=\"opt.description ?? ''\"\n (checkedChange)=\"toggleValue(opt.value)\" />\n </div>\n } @empty {\n <div class=\"ms-empty\">{{ labels.t('multiSelect.noOptionsFound') }}</div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (_shownError()) {\n <p class=\"ms-desc ms-desc-error\" [id]=\"_id + '-error'\" role=\"alert\">{{ _shownError() }}</p>\n } @else if (hint()) {\n <p class=\"ms-desc\" [id]=\"_id + '-hint'\">{{ hint() }}</p>\n }\n </div>\n `,\n styles: [`\n :host { display: block; }\n\n .ms-field { display: flex; flex-direction: column; gap: 6px; }\n\n .ms-label { font-size: 0.8125rem; font-weight: 600; color: #374151; line-height: 1; }\n .ms-required { color: #dc2626; margin-left: 2px; }\n\n .ms-tags { display: flex; flex-wrap: wrap; gap: 6px; }\n\n .ms-wrap { position: relative; }\n\n .ms-trigger {\n width: 100%; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between;\n padding: 9px 10px 9px 12px; font-size: 0.875rem; font-family: inherit; text-align: left;\n color: #1e293b; background: #fff; border: 1px solid #7c8ba1; border-radius: 8px;\n cursor: pointer; outline: none; transition: border-color 0.15s, box-shadow 0.15s;\n &:focus-visible, &.ms-open { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }\n }\n .ms-has-error .ms-trigger { border-color: #ef4444; }\n .ms-disabled .ms-trigger { opacity: 0.5; cursor: not-allowed; }\n\n .ms-placeholder { color: #64748b; }\n\n .ms-chevron { color: #64748b; flex-shrink: 0; margin-left: 8px; transition: transform 0.2s ease; }\n .ms-chevron-open { transform: rotate(180deg); }\n\n .ms-dropdown {\n position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;\n display: flex; flex-direction: column; max-height: 260px;\n background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;\n box-shadow: 0 4px 16px rgba(15, 23, 42, 0.1);\n }\n\n .ms-search-wrap { padding: 8px; border-bottom: 1px solid #e2e8f0; }\n .ms-search {\n width: 100%; box-sizing: border-box; padding: 7px 10px;\n font-size: 0.8125rem; font-family: inherit; color: #1e293b;\n border: 1px solid #7c8ba1; border-radius: 6px; outline: none;\n &::placeholder { color: #64748b; opacity: 1; }\n &:focus { border-color: #3b82f6; }\n }\n\n .ms-options { overflow-y: auto; padding: 4px 0; }\n .ms-option {\n padding: 7px 12px; font-size: 0.8125rem;\n &:hover { background: #f8fafc; }\n }\n .ms-option-selected { background: #eff6ff; }\n\n .ms-empty { padding: 16px; text-align: center; color: #94a3b8; font-size: 0.8125rem; }\n\n .ms-desc { margin: 0; font-size: 0.75rem; line-height: 1.4; color: #64748b; }\n .ms-desc-error { color: #dc2626; }\n\n @media (max-width: 480px) { .ms-trigger, .ms-search { font-size: 1rem; } }\n `],\n})\nexport class MultiSelectComponent implements ControlValueAccessor {\n protected readonly labels = inject(UiLabelsService);\n readonly label = input('');\n readonly placeholderInput = input<string | null>(null, { alias: 'placeholder' });\n readonly placeholder = computed(() => this.placeholderInput() ?? this.labels.t('multiSelect.placeholder'));\n readonly options = input<SelectOption[]>([]);\n readonly searchable = input(true);\n readonly searchPlaceholderInput = input<string | null>(null, { alias: 'searchPlaceholder' });\n readonly searchPlaceholder = computed(() => this.searchPlaceholderInput() ?? this.labels.t('multiSelect.searchPlaceholder'));\n readonly required = input(false);\n readonly hint = input('');\n readonly error = input('');\n /** Selected option values — two-way bindable as `[(selected)]`. */\n readonly selected = model<string[]>([]);\n\n readonly _disabledInput = input(false, { alias: 'disabled' });\n private readonly _cvaDisabled = signal(false);\n protected readonly disabled = computed(() => this._disabledInput() || this._cvaDisabled());\n\n private readonly el = inject(ElementRef);\n protected readonly _id = `ms-${Math.random().toString(36).slice(2, 8)}`;\n protected readonly _open = signal(false);\n protected readonly _query = signal('');\n\n protected readonly _selectedSet = computed(() => new Set(this.selected()));\n protected readonly _selectedOptions = computed(() => this.options().filter(o => this._selectedSet().has(o.value)));\n protected readonly _filteredOptions = computed(() => {\n const fold = (v: string) => v.normalize('NFD').replace(/[\\u0300-\\u036f]/g, '').toLowerCase();\n const q = fold(this._query().trim());\n return q ? this.options().filter(o => fold(o.label).includes(q)) : this.options();\n });\n\n private _onChange = (_: string[]) => {};\n /** The host's \"tried to submit\" flag (e.g. after a failed Save click): `true` shows the host `error` at once, even before the user touched the field; otherwise it shows once the user closed the list or moved focus out of the control (Tab away) even if the list stayed open; true -> false forgets the interaction (closing the form leaves no red field). */\n readonly showErrors = input(false);\n private readonly _reveal = createFieldReveal(this.showErrors);\n private readonly _touched = this._reveal.touched;\n protected readonly _shownError = computed(() => this._reveal.revealed() ? this.error() : '');\n /** Forgets that the user interacted (call it when the host resets its form): a host `error` is hidden again until the list is closed or focus leaves. Same method on ui-signature-pad and ui-rich-text-editor. */\n resetTouched(): void { this._touched.set(false); }\n private _onTouched = () => {};\n\n writeValue(val: string[] | null) { this.selected.set(val ?? []); }\n registerOnChange(fn: (v: string[]) => void) { this._onChange = fn; }\n registerOnTouched(fn: () => void) { this._onTouched = fn; }\n setDisabledState(d: boolean) { this._cvaDisabled.set(d); }\n\n @HostListener('document:click', ['$event'])\n protected onDocumentClick(event: Event) {\n if (this._open() && !this.el.nativeElement.contains(event.target)) this.close();\n }\n\n /** Focus moved to another element outside the control (Tab away): the field counts as touched even when the list stayed open. */\n @HostListener('focusout', ['$event'])\n protected onFocusOut(event: FocusEvent) {\n const next = event.relatedTarget as Node | null;\n if (!next || this.el.nativeElement.contains(next)) return;\n this._touched.set(true);\n this._onTouched();\n }\n\n /** Escape with the list open closes ONLY the list (focus back on the trigger) and is not passed on, so a surrounding side panel / modal stays open. */\n protected onEscape(event: Event) {\n if (!this._open()) return;\n event.preventDefault();\n event.stopPropagation();\n this.close();\n (this.el.nativeElement as HTMLElement).querySelector<HTMLElement>('.ms-trigger')?.focus();\n }\n\n protected toggleOpen() {\n if (this.disabled()) return;\n if (this._open()) this.close(); else this._open.set(true);\n }\n\n protected toggleValue(value: string) {\n const set = new Set(this.selected());\n if (set.has(value)) set.delete(value); else set.add(value);\n this._set(Array.from(set));\n }\n\n protected remove(value: string) {\n this._set(this.selected().filter(v => v !== value));\n }\n\n private close() {\n this._open.set(false);\n this._query.set('');\n this._touched.set(true);\n this._onTouched();\n }\n\n private _set(values: string[]) {\n this.selected.set(values);\n this._onChange(values);\n }\n}\n"],"mappings":";;;;;;AA8JA,IAAa,uBAAb,MAAa,qBAAoB;CA7IjC,cAAA;EA8IqB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,QAAoB,MAAM,IAAG,GAAA,YAAA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