@raqm/ui 0.0.0-stage → 0.1.1
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/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/NOTICE.md +28 -0
- package/README.md +126 -3
- package/combobox/README.md +17 -0
- package/fesm2022/raqm-ui-accordion.mjs +414 -0
- package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert.mjs +195 -0
- package/fesm2022/raqm-ui-alert.mjs.map +1 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/raqm-ui-attachment.mjs +435 -0
- package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
- package/fesm2022/raqm-ui-avatar.mjs +337 -0
- package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
- package/fesm2022/raqm-ui-badge.mjs +68 -0
- package/fesm2022/raqm-ui-badge.mjs.map +1 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/raqm-ui-button-group.mjs +138 -0
- package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-button.mjs +295 -0
- package/fesm2022/raqm-ui-button.mjs.map +1 -0
- package/fesm2022/raqm-ui-calendar.mjs +1394 -0
- package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
- package/fesm2022/raqm-ui-card.mjs +331 -0
- package/fesm2022/raqm-ui-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-carousel.mjs +410 -0
- package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
- package/fesm2022/raqm-ui-checkbox.mjs +86 -0
- package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
- package/fesm2022/raqm-ui-collapsible.mjs +266 -0
- package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
- package/fesm2022/raqm-ui-combobox.mjs +1584 -0
- package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
- package/fesm2022/raqm-ui-command.mjs +1210 -0
- package/fesm2022/raqm-ui-command.mjs.map +1 -0
- package/fesm2022/raqm-ui-context-menu.mjs +723 -0
- package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-dialog.mjs +1214 -0
- package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-drawer.mjs +687 -0
- package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-empty.mjs +272 -0
- package/fesm2022/raqm-ui-empty.mjs.map +1 -0
- package/fesm2022/raqm-ui-field.mjs +517 -0
- package/fesm2022/raqm-ui-field.mjs.map +1 -0
- package/fesm2022/raqm-ui-hover-card.mjs +828 -0
- package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-group.mjs +270 -0
- package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-otp.mjs +788 -0
- package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
- package/fesm2022/raqm-ui-input.mjs +73 -0
- package/fesm2022/raqm-ui-input.mjs.map +1 -0
- package/fesm2022/raqm-ui-item.mjs +495 -0
- package/fesm2022/raqm-ui-item.mjs.map +1 -0
- package/fesm2022/raqm-ui-kbd.mjs +80 -0
- package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
- package/fesm2022/raqm-ui-label.mjs +44 -0
- package/fesm2022/raqm-ui-label.mjs.map +1 -0
- package/fesm2022/raqm-ui-menubar.mjs +536 -0
- package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
- package/fesm2022/raqm-ui-native-select.mjs +131 -0
- package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
- package/fesm2022/raqm-ui-pagination.mjs +440 -0
- package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
- package/fesm2022/raqm-ui-popover.mjs +1495 -0
- package/fesm2022/raqm-ui-popover.mjs.map +1 -0
- package/fesm2022/raqm-ui-progress.mjs +369 -0
- package/fesm2022/raqm-ui-progress.mjs.map +1 -0
- package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
- package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
- package/fesm2022/raqm-ui-radio-group.mjs +151 -0
- package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-resizable.mjs +439 -0
- package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
- package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
- package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/raqm-ui-select.mjs +1073 -0
- package/fesm2022/raqm-ui-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-separator.mjs +103 -0
- package/fesm2022/raqm-ui-separator.mjs.map +1 -0
- package/fesm2022/raqm-ui-sheet.mjs +411 -0
- package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
- package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
- package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
- package/fesm2022/raqm-ui-skeleton.mjs +50 -0
- package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
- package/fesm2022/raqm-ui-slider.mjs +609 -0
- package/fesm2022/raqm-ui-slider.mjs.map +1 -0
- package/fesm2022/raqm-ui-spinner.mjs +137 -0
- package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
- package/fesm2022/raqm-ui-switch.mjs +109 -0
- package/fesm2022/raqm-ui-switch.mjs.map +1 -0
- package/fesm2022/raqm-ui-table.mjs +271 -0
- package/fesm2022/raqm-ui-table.mjs.map +1 -0
- package/fesm2022/raqm-ui-tabs.mjs +536 -0
- package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
- package/fesm2022/raqm-ui-textarea.mjs +37 -0
- package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
- package/fesm2022/raqm-ui-toast.mjs +918 -0
- package/fesm2022/raqm-ui-toast.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
- package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle.mjs +158 -0
- package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
- package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
- package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
- package/fesm2022/raqm-ui.mjs +50 -0
- package/input-otp/README.md +12 -0
- package/package.json +275 -3
- package/styles/theme.css +4324 -0
- package/types/raqm-ui-accordion.d.ts +124 -0
- package/types/raqm-ui-alert-dialog.d.ts +81 -0
- package/types/raqm-ui-alert.d.ts +29 -0
- package/types/raqm-ui-aspect-ratio.d.ts +13 -0
- package/types/raqm-ui-attachment.d.ts +72 -0
- package/types/raqm-ui-avatar.d.ts +67 -0
- package/types/raqm-ui-badge.d.ts +20 -0
- package/types/raqm-ui-breadcrumb.d.ts +35 -0
- package/types/raqm-ui-button-group.d.ts +27 -0
- package/types/raqm-ui-button.d.ts +80 -0
- package/types/raqm-ui-calendar.d.ts +359 -0
- package/types/raqm-ui-card.d.ts +34 -0
- package/types/raqm-ui-carousel.d.ts +81 -0
- package/types/raqm-ui-checkbox.d.ts +24 -0
- package/types/raqm-ui-collapsible.d.ts +72 -0
- package/types/raqm-ui-combobox.d.ts +405 -0
- package/types/raqm-ui-command.d.ts +256 -0
- package/types/raqm-ui-context-menu.d.ts +196 -0
- package/types/raqm-ui-dialog.d.ts +232 -0
- package/types/raqm-ui-drawer.d.ts +121 -0
- package/types/raqm-ui-dropdown-menu.d.ts +319 -0
- package/types/raqm-ui-empty.d.ts +35 -0
- package/types/raqm-ui-field.d.ts +88 -0
- package/types/raqm-ui-hover-card.d.ts +139 -0
- package/types/raqm-ui-input-group.d.ts +45 -0
- package/types/raqm-ui-input-otp.d.ts +197 -0
- package/types/raqm-ui-input.d.ts +16 -0
- package/types/raqm-ui-item.d.ts +71 -0
- package/types/raqm-ui-kbd.d.ts +12 -0
- package/types/raqm-ui-label.d.ts +6 -0
- package/types/raqm-ui-menubar.d.ts +159 -0
- package/types/raqm-ui-native-select.d.ts +23 -0
- package/types/raqm-ui-navigation-menu.d.ts +230 -0
- package/types/raqm-ui-overlay-internal.d.ts +5 -0
- package/types/raqm-ui-pagination.d.ts +84 -0
- package/types/raqm-ui-popover.d.ts +235 -0
- package/types/raqm-ui-progress.d.ts +79 -0
- package/types/raqm-ui-questionnaire.d.ts +217 -0
- package/types/raqm-ui-radio-group.d.ts +48 -0
- package/types/raqm-ui-resizable.d.ts +98 -0
- package/types/raqm-ui-scroll-area.d.ts +132 -0
- package/types/raqm-ui-select.d.ts +205 -0
- package/types/raqm-ui-separator.d.ts +21 -0
- package/types/raqm-ui-sheet.d.ts +79 -0
- package/types/raqm-ui-sidebar.d.ts +285 -0
- package/types/raqm-ui-skeleton.d.ts +6 -0
- package/types/raqm-ui-slider.d.ts +129 -0
- package/types/raqm-ui-spinner.d.ts +32 -0
- package/types/raqm-ui-switch.d.ts +32 -0
- package/types/raqm-ui-table.d.ts +36 -0
- package/types/raqm-ui-tabs.d.ts +154 -0
- package/types/raqm-ui-textarea.d.ts +6 -0
- package/types/raqm-ui-toast.d.ts +190 -0
- package/types/raqm-ui-toggle-group.d.ts +167 -0
- package/types/raqm-ui-toggle.d.ts +42 -0
- package/types/raqm-ui-tooltip.d.ts +207 -0
- package/types/raqm-ui.d.ts +50 -0
|
@@ -0,0 +1,1584 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, isDevMode, linkedSignal, output, signal, untracked, viewChild } from "@angular/core";
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from "@angular/forms";
|
|
4
|
+
import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
|
|
5
|
+
import { ActiveDescendantKeyManager, InteractivityChecker } from "@angular/cdk/a11y";
|
|
6
|
+
import { Directionality } from "@angular/cdk/bidi";
|
|
7
|
+
import { Overlay } from "@angular/cdk/overlay";
|
|
8
|
+
import { ViewportRuler } from "@angular/cdk/scrolling";
|
|
9
|
+
import { RaqmButton } from "@raqm/ui/button";
|
|
10
|
+
import { RaqmInput } from "@raqm/ui/input";
|
|
11
|
+
import * as i1 from "@raqm/ui/input-group";
|
|
12
|
+
import { RaqmInputGroup } from "@raqm/ui/input-group";
|
|
13
|
+
import { TemplatePortal } from "@angular/cdk/portal";
|
|
14
|
+
import { registerOverlayOwnership } from "@raqm/ui/overlay-internal";
|
|
15
|
+
const collator = new Intl.Collator(void 0, {
|
|
16
|
+
usage: "search",
|
|
17
|
+
sensitivity: "base",
|
|
18
|
+
ignorePunctuation: true
|
|
19
|
+
});
|
|
20
|
+
function labelContains(label, query) {
|
|
21
|
+
if (!query) return true;
|
|
22
|
+
for (let i = 0; i <= label.length - query.length; i += 1) if (collator.compare(label.slice(i, i + query.length), query) === 0) return true;
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
function normalizeMultiple(value) {
|
|
26
|
+
if (!Array.isArray(value)) return [];
|
|
27
|
+
const result = [];
|
|
28
|
+
for (const member of value) if (typeof member === "string" && !result.includes(member)) result.push(member);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
function normalizePopup(value) {
|
|
32
|
+
return typeof value === "string" ? value : null;
|
|
33
|
+
}
|
|
34
|
+
function normalizeModel(value, mode) {
|
|
35
|
+
return mode === "multiple" ? normalizeMultiple(value) : normalizePopup(value);
|
|
36
|
+
}
|
|
37
|
+
function reportDuplicateValues(items) {
|
|
38
|
+
if (!isDevMode()) return;
|
|
39
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
41
|
+
for (const item of items) if (seen.has(item.value)) duplicates.add(item.value);
|
|
42
|
+
else seen.add(item.value);
|
|
43
|
+
if (duplicates.size > 0) console.error(`[raqm-combobox] Duplicate option value(s) ${[...duplicates].map((value) => JSON.stringify(value)).join(", ")}; Combobox option values must be unique.`);
|
|
44
|
+
}
|
|
45
|
+
var RaqmComboboxControl = class {
|
|
46
|
+
host;
|
|
47
|
+
cvaDisabled = signal(false, ...ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []);
|
|
48
|
+
onChange;
|
|
49
|
+
onTouched;
|
|
50
|
+
disabled = this.cvaDisabled.asReadonly();
|
|
51
|
+
constructor(host) {
|
|
52
|
+
this.host = host;
|
|
53
|
+
}
|
|
54
|
+
writeValue(value) {
|
|
55
|
+
this.host.setSelected(normalizeModel(value, this.host.mode()));
|
|
56
|
+
}
|
|
57
|
+
registerOnChange(fn) {
|
|
58
|
+
this.onChange = fn;
|
|
59
|
+
}
|
|
60
|
+
registerOnTouched(fn) {
|
|
61
|
+
this.onTouched = fn;
|
|
62
|
+
}
|
|
63
|
+
setDisabledState(isDisabled) {
|
|
64
|
+
this.cvaDisabled.set(isDisabled);
|
|
65
|
+
if (isDisabled) this.host.close(false);
|
|
66
|
+
}
|
|
67
|
+
commit(item) {
|
|
68
|
+
if (this.host.disabled() || item.disabled === true) return;
|
|
69
|
+
if (this.host.mode() === "multiple") {
|
|
70
|
+
const selected = this.host.selected();
|
|
71
|
+
const current = Array.isArray(selected) ? selected : [];
|
|
72
|
+
const next = current.includes(item.value) ? current.filter((value) => value !== item.value) : [...current, item.value];
|
|
73
|
+
this.emit(next);
|
|
74
|
+
if (this.host.query().trim() === "") return;
|
|
75
|
+
this.host.close(true);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const next = item.value;
|
|
79
|
+
if (this.host.selected() === next) {
|
|
80
|
+
this.host.close(true);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!this.host.selectionRemovable()) return;
|
|
84
|
+
this.emit(next);
|
|
85
|
+
this.host.close(true);
|
|
86
|
+
}
|
|
87
|
+
emit(next) {
|
|
88
|
+
const normalized = normalizeModel(next, this.host.mode());
|
|
89
|
+
this.host.setSelected(normalized);
|
|
90
|
+
this.onChange?.(normalized);
|
|
91
|
+
this.host.publish(normalized);
|
|
92
|
+
}
|
|
93
|
+
touch() {
|
|
94
|
+
this.onTouched?.();
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
function connectComboboxEffects(host) {
|
|
98
|
+
let lastMode;
|
|
99
|
+
effect(() => {
|
|
100
|
+
const mode = host.mode();
|
|
101
|
+
if (mode === lastMode) return;
|
|
102
|
+
const isFirstRender = lastMode === void 0;
|
|
103
|
+
lastMode = mode;
|
|
104
|
+
untracked(() => {
|
|
105
|
+
if (!isFirstRender) host.resetForMode();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
effect(() => reportDuplicateValues(host.flatItems()));
|
|
109
|
+
effect(() => {
|
|
110
|
+
host.popupWidth();
|
|
111
|
+
host.alignOffset();
|
|
112
|
+
host.dir();
|
|
113
|
+
if (host.open()) untracked(() => host.reposition());
|
|
114
|
+
});
|
|
115
|
+
effect(() => {
|
|
116
|
+
const views = host.views();
|
|
117
|
+
const disabled = host.disabled();
|
|
118
|
+
host.selectionRemovable();
|
|
119
|
+
host.autoHighlight();
|
|
120
|
+
host.open();
|
|
121
|
+
if (disabled) {
|
|
122
|
+
untracked(() => host.close());
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
untracked(() => host.reconcile(views));
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const INTERACTIVE_SELECTOR = "button, a[href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])";
|
|
129
|
+
var RaqmComboboxField = class {
|
|
130
|
+
host;
|
|
131
|
+
document;
|
|
132
|
+
interactivityChecker;
|
|
133
|
+
query = signal("", ...ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []);
|
|
134
|
+
composingValue = signal(null, ...ngDevMode ? [{ debugName: "composingValue" }] : /* istanbul ignore next */ []);
|
|
135
|
+
suppressBlurTouched = false;
|
|
136
|
+
composing = false;
|
|
137
|
+
constructor(host, document, interactivityChecker) {
|
|
138
|
+
this.host = host;
|
|
139
|
+
this.document = document;
|
|
140
|
+
this.interactivityChecker = interactivityChecker;
|
|
141
|
+
}
|
|
142
|
+
get isComposing() {
|
|
143
|
+
return this.composing;
|
|
144
|
+
}
|
|
145
|
+
reset() {
|
|
146
|
+
this.query.set("");
|
|
147
|
+
this.composingValue.set(null);
|
|
148
|
+
}
|
|
149
|
+
resetQuery() {
|
|
150
|
+
this.query.set("");
|
|
151
|
+
}
|
|
152
|
+
onChipsPointerDown(event) {
|
|
153
|
+
if (this.host.disabled()) return;
|
|
154
|
+
if (event.target?.closest(INTERACTIVE_SELECTOR)) return;
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
this.focusInput();
|
|
157
|
+
if (!this.host.open()) this.host.openPopup();
|
|
158
|
+
}
|
|
159
|
+
onInputPointerDown() {
|
|
160
|
+
if (this.host.disabled() || this.host.open()) return;
|
|
161
|
+
this.host.openPopup();
|
|
162
|
+
}
|
|
163
|
+
onInlineFocus(event) {
|
|
164
|
+
if (this.host.open() || this.host.disabled()) return;
|
|
165
|
+
event.target.select();
|
|
166
|
+
}
|
|
167
|
+
onClearClick(event) {
|
|
168
|
+
event.preventDefault();
|
|
169
|
+
event.stopPropagation();
|
|
170
|
+
if (this.host.disabled() || !this.host.selectionRemovable()) return;
|
|
171
|
+
this.host.emit(null);
|
|
172
|
+
this.host.markTouched();
|
|
173
|
+
this.focusInput();
|
|
174
|
+
}
|
|
175
|
+
onTriggerClick() {
|
|
176
|
+
if (this.host.disabled()) return;
|
|
177
|
+
if (this.host.open()) this.host.close(true);
|
|
178
|
+
else this.host.openPopup();
|
|
179
|
+
}
|
|
180
|
+
onFocusOut(event) {
|
|
181
|
+
if (this.suppressBlurTouched) return;
|
|
182
|
+
const next = event.relatedTarget;
|
|
183
|
+
const overlayElement = this.host.overlayElement();
|
|
184
|
+
if (next && (this.host.element().contains(next) || overlayElement?.contains(next) === true)) return;
|
|
185
|
+
if (this.host.open()) this.host.close(true, false);
|
|
186
|
+
else this.host.markTouched();
|
|
187
|
+
}
|
|
188
|
+
onInput(event) {
|
|
189
|
+
if (this.host.disabled()) return;
|
|
190
|
+
const input = event.target;
|
|
191
|
+
if (this.composing) {
|
|
192
|
+
this.composingValue.set(input.value);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.query.set(input.value);
|
|
196
|
+
this.applyQueryHighlight(input.value);
|
|
197
|
+
}
|
|
198
|
+
onCompositionStart(event) {
|
|
199
|
+
this.composing = true;
|
|
200
|
+
this.composingValue.set(event.target.value);
|
|
201
|
+
}
|
|
202
|
+
onCompositionEnd(event) {
|
|
203
|
+
this.composing = false;
|
|
204
|
+
this.composingValue.set(null);
|
|
205
|
+
const input = event.target;
|
|
206
|
+
this.query.set(input.value);
|
|
207
|
+
this.applyQueryHighlight(input.value);
|
|
208
|
+
}
|
|
209
|
+
onOptionPointerMove(view, event) {
|
|
210
|
+
if (event.pointerType === "touch") return;
|
|
211
|
+
if (this.host.isOptionDisabled(view.item) || this.host.activeId() === view.id) return;
|
|
212
|
+
const index = this.host.optionViews().findIndex((candidate) => candidate.id === view.id);
|
|
213
|
+
if (index === -1) return;
|
|
214
|
+
this.host.activateOption(index);
|
|
215
|
+
}
|
|
216
|
+
onOptionPointerLeave(event) {
|
|
217
|
+
if (event.pointerType === "touch") return;
|
|
218
|
+
const related = event.relatedTarget;
|
|
219
|
+
if (related instanceof Element && related.closest(".raqm-combobox-option")) return;
|
|
220
|
+
this.host.resetActive();
|
|
221
|
+
}
|
|
222
|
+
onOptionClick(item) {
|
|
223
|
+
if (this.host.isOptionDisabled(item)) return;
|
|
224
|
+
this.host.select(item);
|
|
225
|
+
}
|
|
226
|
+
isSelected(item) {
|
|
227
|
+
const value = this.host.selected();
|
|
228
|
+
if (Array.isArray(value)) return value.includes(item.value);
|
|
229
|
+
return value === item.value;
|
|
230
|
+
}
|
|
231
|
+
leavePopupByTab(event) {
|
|
232
|
+
const trigger = this.host.trigger();
|
|
233
|
+
if (!trigger) return;
|
|
234
|
+
const overlay = this.host.overlayElement();
|
|
235
|
+
const candidates = Array.from(this.document.querySelectorAll("a[href], button, input, select, textarea, [tabindex], [contenteditable=\"true\"]")).filter((element) => !overlay?.contains(element) && this.interactivityChecker.isTabbable(element));
|
|
236
|
+
candidates.sort((a, b) => (a.tabIndex || Infinity) - (b.tabIndex || Infinity));
|
|
237
|
+
const index = candidates.indexOf(trigger);
|
|
238
|
+
const target = index < 0 ? void 0 : candidates[index + (event.shiftKey ? -1 : 1)];
|
|
239
|
+
if (target) {
|
|
240
|
+
event.preventDefault();
|
|
241
|
+
target.focus();
|
|
242
|
+
this.host.close(true, false);
|
|
243
|
+
} else {
|
|
244
|
+
trigger.focus();
|
|
245
|
+
this.host.close(true, false);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
onChipRemoveClick(index, event) {
|
|
249
|
+
event.stopPropagation();
|
|
250
|
+
this.removeAt(index);
|
|
251
|
+
}
|
|
252
|
+
removeAt(index) {
|
|
253
|
+
if (this.host.disabled()) return;
|
|
254
|
+
const chip = this.host.chipViews()[index];
|
|
255
|
+
if (!chip || !chip.removable) return;
|
|
256
|
+
const removeButton = this.chipButton(index);
|
|
257
|
+
const heldFocus = removeButton !== null && this.host.element().ownerDocument.activeElement === removeButton;
|
|
258
|
+
const selected = this.host.selected();
|
|
259
|
+
const current = Array.isArray(selected) ? selected : [];
|
|
260
|
+
const activeView = this.host.optionViews().find((view) => view.item.value === chip.value);
|
|
261
|
+
if (activeView && this.host.activeId() === activeView.id) this.host.resetActive();
|
|
262
|
+
this.host.emit(current.filter((value) => value !== chip.value));
|
|
263
|
+
if (heldFocus) {
|
|
264
|
+
const remaining = this.host.chipViews();
|
|
265
|
+
if (remaining.length === 0) this.focusInput();
|
|
266
|
+
else this.focusChip(Math.min(index, remaining.length - 1));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
focusInput() {
|
|
270
|
+
const input = this.inputElement();
|
|
271
|
+
if (input && !input.disabled) input.focus();
|
|
272
|
+
}
|
|
273
|
+
focusChip(index) {
|
|
274
|
+
const button = this.chipButton(index);
|
|
275
|
+
if (button && !button.disabled) button.focus();
|
|
276
|
+
}
|
|
277
|
+
restoreTriggerFocus() {
|
|
278
|
+
const trigger = this.host.trigger();
|
|
279
|
+
if (trigger && !trigger.disabled) trigger.focus();
|
|
280
|
+
}
|
|
281
|
+
applyQueryHighlight(value) {
|
|
282
|
+
if (value.trim() !== "" && !this.host.open()) this.host.openPopup();
|
|
283
|
+
this.host.reconcileActive();
|
|
284
|
+
}
|
|
285
|
+
inputElement() {
|
|
286
|
+
const inHost = this.host.element().querySelector(".raqm-combobox-input");
|
|
287
|
+
if (inHost) return inHost;
|
|
288
|
+
return this.host.overlayElement()?.querySelector(".raqm-combobox-input") ?? null;
|
|
289
|
+
}
|
|
290
|
+
chipButton(index) {
|
|
291
|
+
return this.host.element().querySelectorAll(".raqm-combobox-chip-remove")[index] ?? null;
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
var RaqmComboboxOptionRef = class {
|
|
295
|
+
view;
|
|
296
|
+
activate;
|
|
297
|
+
isDisabled;
|
|
298
|
+
constructor(view, activate, isDisabled) {
|
|
299
|
+
this.view = view;
|
|
300
|
+
this.activate = activate;
|
|
301
|
+
this.isDisabled = isDisabled;
|
|
302
|
+
}
|
|
303
|
+
get disabled() {
|
|
304
|
+
return this.isDisabled(this.view.item);
|
|
305
|
+
}
|
|
306
|
+
getLabel() {
|
|
307
|
+
return this.view.item.label;
|
|
308
|
+
}
|
|
309
|
+
setActiveStyles() {
|
|
310
|
+
this.activate(this);
|
|
311
|
+
}
|
|
312
|
+
setInactiveStyles() {}
|
|
313
|
+
};
|
|
314
|
+
var RaqmComboboxKeyboard = class {
|
|
315
|
+
host;
|
|
316
|
+
injector;
|
|
317
|
+
keyManager;
|
|
318
|
+
suppressActivationScroll = false;
|
|
319
|
+
activeValue = signal(null, ...ngDevMode ? [{ debugName: "activeValue" }] : /* istanbul ignore next */ []);
|
|
320
|
+
activeId = computed(() => {
|
|
321
|
+
if (!this.host.open() || this.host.disabled()) return null;
|
|
322
|
+
const value = this.activeValue();
|
|
323
|
+
return this.host.views().find((view) => view.item.value === value && !this.host.isOptionDisabled(view.item))?.id ?? null;
|
|
324
|
+
}, ...ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []);
|
|
325
|
+
optionRefs = computed(() => this.host.views().map((view) => new RaqmComboboxOptionRef(view, (ref) => {
|
|
326
|
+
this.activeValue.set(ref.view.item.value);
|
|
327
|
+
if (!this.suppressActivationScroll) this.host.scrollTo(ref.view.id);
|
|
328
|
+
}, (item) => this.host.isOptionDisabled(item))), ...ngDevMode ? [{ debugName: "optionRefs" }] : /* istanbul ignore next */ []);
|
|
329
|
+
constructor(host, injector) {
|
|
330
|
+
this.host = host;
|
|
331
|
+
this.injector = injector;
|
|
332
|
+
}
|
|
333
|
+
init() {
|
|
334
|
+
this.keyManager = new ActiveDescendantKeyManager(this.optionRefs, this.injector).withWrap(false).withVerticalOrientation(true).withHomeAndEnd(true);
|
|
335
|
+
}
|
|
336
|
+
destroy() {
|
|
337
|
+
this.keyManager?.destroy();
|
|
338
|
+
}
|
|
339
|
+
onTriggerKeydown(event) {
|
|
340
|
+
if (this.host.disabled()) return;
|
|
341
|
+
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
342
|
+
event.preventDefault();
|
|
343
|
+
if (!this.host.open()) this.host.openPopup();
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
onKeydown(event) {
|
|
347
|
+
if (this.host.mode() === "multiple" && this.handleChipNavigation(event)) return;
|
|
348
|
+
if (this.host.composing() || event.isComposing || event.keyCode === 229) return;
|
|
349
|
+
switch (event.key) {
|
|
350
|
+
case "Escape":
|
|
351
|
+
if (this.host.open()) {
|
|
352
|
+
event.preventDefault();
|
|
353
|
+
this.host.close(true);
|
|
354
|
+
}
|
|
355
|
+
return;
|
|
356
|
+
case "Tab":
|
|
357
|
+
if (this.host.mode() === "popup" && this.host.open()) this.host.leavePopupByTab(event);
|
|
358
|
+
return;
|
|
359
|
+
case "Enter": {
|
|
360
|
+
if (!this.host.open()) return;
|
|
361
|
+
this.reconcile(this.host.views());
|
|
362
|
+
const active = this.host.views().find((view) => view.item.value === this.activeValue());
|
|
363
|
+
if (active && !this.host.isOptionDisabled(active.item) && !this.host.disabled()) {
|
|
364
|
+
event.preventDefault();
|
|
365
|
+
this.host.select(active.item);
|
|
366
|
+
}
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
case "ArrowDown":
|
|
370
|
+
case "ArrowUp":
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
if (!this.host.open()) this.host.openPopup();
|
|
373
|
+
else {
|
|
374
|
+
this.reconcile(this.host.views());
|
|
375
|
+
this.keyManager?.onKeydown(event);
|
|
376
|
+
}
|
|
377
|
+
return;
|
|
378
|
+
case "Home":
|
|
379
|
+
case "End":
|
|
380
|
+
if (this.host.open()) {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
this.reconcile(this.host.views());
|
|
383
|
+
this.keyManager?.onKeydown(event);
|
|
384
|
+
}
|
|
385
|
+
return;
|
|
386
|
+
default: return;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
onChipKeydown(index, event) {
|
|
390
|
+
if (this.host.disabled()) return;
|
|
391
|
+
const rtl = this.host.direction() === "rtl";
|
|
392
|
+
const previousKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
393
|
+
const nextKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
394
|
+
switch (event.key) {
|
|
395
|
+
case "Backspace":
|
|
396
|
+
case "Delete":
|
|
397
|
+
event.preventDefault();
|
|
398
|
+
this.host.removeChip(index);
|
|
399
|
+
return;
|
|
400
|
+
case previousKey:
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
if (index > 0) this.host.focusChip(index - 1);
|
|
403
|
+
else this.host.focusInput();
|
|
404
|
+
return;
|
|
405
|
+
case nextKey:
|
|
406
|
+
event.preventDefault();
|
|
407
|
+
if (index < this.host.chipCount() - 1) this.host.focusChip(index + 1);
|
|
408
|
+
else this.host.focusInput();
|
|
409
|
+
return;
|
|
410
|
+
case "ArrowDown":
|
|
411
|
+
case "ArrowUp":
|
|
412
|
+
event.preventDefault();
|
|
413
|
+
if (!this.host.open()) this.host.openPopup();
|
|
414
|
+
return;
|
|
415
|
+
default:
|
|
416
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) this.host.focusInput();
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
activateIndex(index, scroll) {
|
|
421
|
+
if (!this.keyManager) return;
|
|
422
|
+
if (scroll) {
|
|
423
|
+
this.keyManager.setActiveItem(index);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
this.suppressActivationScroll = true;
|
|
427
|
+
try {
|
|
428
|
+
this.keyManager.setActiveItem(index);
|
|
429
|
+
} finally {
|
|
430
|
+
this.suppressActivationScroll = false;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
activateFirst() {
|
|
434
|
+
const index = this.host.views().findIndex((view) => !this.host.isOptionDisabled(view.item));
|
|
435
|
+
if (index === -1) return;
|
|
436
|
+
this.keyManager?.setActiveItem(index);
|
|
437
|
+
}
|
|
438
|
+
reconcile(views) {
|
|
439
|
+
if (!this.host.open() || this.host.disabled() || !this.keyManager) return;
|
|
440
|
+
const value = this.activeValue();
|
|
441
|
+
const index = value === null ? -1 : views.findIndex((view) => view.item.value === value && !this.host.isOptionDisabled(view.item));
|
|
442
|
+
if (index >= 0) {
|
|
443
|
+
const current = this.optionRefs()[index];
|
|
444
|
+
if (this.keyManager.activeItem !== current) this.keyManager.setActiveItem(index);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
this.reset();
|
|
448
|
+
if (this.host.autoHighlight() && this.host.query().trim() !== "") this.activateFirst();
|
|
449
|
+
}
|
|
450
|
+
reset() {
|
|
451
|
+
this.keyManager?.setActiveItem(-1);
|
|
452
|
+
this.activeValue.set(null);
|
|
453
|
+
}
|
|
454
|
+
handleChipNavigation(event) {
|
|
455
|
+
if (this.host.chipCount() === 0) return false;
|
|
456
|
+
const previousKey = this.host.direction() === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
457
|
+
const input = event.currentTarget;
|
|
458
|
+
const caret = input.selectionStart ?? 0;
|
|
459
|
+
if (event.key === previousKey && caret === 0) {
|
|
460
|
+
event.preventDefault();
|
|
461
|
+
this.host.focusChip(this.host.chipCount() - 1);
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
if (event.key === "Backspace" && input.value === "") {
|
|
465
|
+
event.preventDefault();
|
|
466
|
+
this.host.removeChip(this.host.chipCount() - 1);
|
|
467
|
+
return true;
|
|
468
|
+
}
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
const OVERLAY_GAP = 6;
|
|
473
|
+
const VIEWPORT_MARGIN = 10;
|
|
474
|
+
var RaqmComboboxOverlay = class {
|
|
475
|
+
overlay;
|
|
476
|
+
viewportRuler;
|
|
477
|
+
viewContainerRef;
|
|
478
|
+
host;
|
|
479
|
+
overlayRef;
|
|
480
|
+
releaseOverlayOwnership;
|
|
481
|
+
outsideSubscription;
|
|
482
|
+
detachSubscription;
|
|
483
|
+
positionStrategy;
|
|
484
|
+
resizeSubscription;
|
|
485
|
+
directionSubscription;
|
|
486
|
+
directionObserver;
|
|
487
|
+
open = signal(false, ...ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []);
|
|
488
|
+
dir = signal("ltr", ...ngDevMode ? [{ debugName: "dir" }] : /* istanbul ignore next */ []);
|
|
489
|
+
constructor(overlay, viewportRuler, viewContainerRef, host) {
|
|
490
|
+
this.overlay = overlay;
|
|
491
|
+
this.viewportRuler = viewportRuler;
|
|
492
|
+
this.viewContainerRef = viewContainerRef;
|
|
493
|
+
this.host = host;
|
|
494
|
+
}
|
|
495
|
+
get element() {
|
|
496
|
+
return this.overlayRef?.overlayElement;
|
|
497
|
+
}
|
|
498
|
+
get hasPane() {
|
|
499
|
+
return this.overlayRef !== void 0;
|
|
500
|
+
}
|
|
501
|
+
openLayer() {
|
|
502
|
+
const anchor = this.host.anchor();
|
|
503
|
+
if (!anchor) return false;
|
|
504
|
+
const direction = this.host.direction();
|
|
505
|
+
this.dir.set(direction);
|
|
506
|
+
const anchorWidth = anchor.getBoundingClientRect().width;
|
|
507
|
+
const width = this.host.width() || anchorWidth;
|
|
508
|
+
const strategy = this.overlay.position().flexibleConnectedTo(anchor).withPositions(this.positions()).withFlexibleDimensions(true).withGrowAfterOpen(true).withPush(true).withViewportMargin(VIEWPORT_MARGIN);
|
|
509
|
+
const config = {
|
|
510
|
+
positionStrategy: strategy,
|
|
511
|
+
scrollStrategy: this.overlay.scrollStrategies.reposition(),
|
|
512
|
+
hasBackdrop: false,
|
|
513
|
+
panelClass: "raqm-combobox-overlay-pane",
|
|
514
|
+
disposeOnNavigation: true,
|
|
515
|
+
width,
|
|
516
|
+
direction
|
|
517
|
+
};
|
|
518
|
+
this.positionStrategy = strategy;
|
|
519
|
+
this.overlayRef = this.overlay.create(config);
|
|
520
|
+
this.overlayRef.overlayElement.style.setProperty("--raqm-combobox-viewport-margin", `${VIEWPORT_MARGIN}px`);
|
|
521
|
+
this.applyAvailableHeight();
|
|
522
|
+
this.overlayRef.attach(new TemplatePortal(this.host.template(), this.viewContainerRef));
|
|
523
|
+
this.releaseOverlayOwnership = registerOverlayOwnership(anchor, this.overlayRef);
|
|
524
|
+
this.open.set(true);
|
|
525
|
+
this.observeDirection();
|
|
526
|
+
this.outsideSubscription = this.overlayRef.outsidePointerEvents().subscribe((event) => {
|
|
527
|
+
const target = event.target;
|
|
528
|
+
if (target && this.host.element.contains(target)) return;
|
|
529
|
+
this.host.onOutside();
|
|
530
|
+
});
|
|
531
|
+
this.detachSubscription = this.overlayRef.detachments().subscribe(() => this.host.onDetached());
|
|
532
|
+
this.resizeSubscription = this.viewportRuler.change(0).subscribe(() => {
|
|
533
|
+
this.updateDirection();
|
|
534
|
+
this.applyAnchorWidth();
|
|
535
|
+
this.applyAvailableHeight();
|
|
536
|
+
this.positionStrategy?.apply();
|
|
537
|
+
});
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
reposition() {
|
|
541
|
+
this.updateDirection();
|
|
542
|
+
this.applyAnchorWidth();
|
|
543
|
+
this.positionStrategy?.withPositions(this.positions());
|
|
544
|
+
this.positionStrategy?.apply();
|
|
545
|
+
}
|
|
546
|
+
detach() {
|
|
547
|
+
const overlayRef = this.overlayRef;
|
|
548
|
+
this.stopObservingDirection();
|
|
549
|
+
this.releaseOverlayOwnership?.();
|
|
550
|
+
this.releaseOverlayOwnership = void 0;
|
|
551
|
+
this.outsideSubscription?.unsubscribe();
|
|
552
|
+
this.outsideSubscription = void 0;
|
|
553
|
+
this.detachSubscription?.unsubscribe();
|
|
554
|
+
this.detachSubscription = void 0;
|
|
555
|
+
this.resizeSubscription?.unsubscribe();
|
|
556
|
+
this.resizeSubscription = void 0;
|
|
557
|
+
this.positionStrategy = void 0;
|
|
558
|
+
this.overlayRef = void 0;
|
|
559
|
+
this.open.set(false);
|
|
560
|
+
return overlayRef;
|
|
561
|
+
}
|
|
562
|
+
scrollOptionIntoView(id) {
|
|
563
|
+
const overlayRef = this.overlayRef;
|
|
564
|
+
if (!overlayRef || !id) return;
|
|
565
|
+
const list = overlayRef.overlayElement.querySelector(".raqm-combobox-list");
|
|
566
|
+
const row = Array.from(overlayRef.overlayElement.querySelectorAll(".raqm-combobox-option")).find((option) => option.id === id);
|
|
567
|
+
if (!list || !row) return;
|
|
568
|
+
const listRect = list.getBoundingClientRect();
|
|
569
|
+
const rowRect = row.getBoundingClientRect();
|
|
570
|
+
const rowTop = rowRect.top - listRect.top - list.clientTop + list.scrollTop;
|
|
571
|
+
const rowBottom = rowRect.bottom - listRect.top - list.clientTop + list.scrollTop;
|
|
572
|
+
const viewTop = list.scrollTop;
|
|
573
|
+
const viewBottom = viewTop + list.clientHeight;
|
|
574
|
+
let target = null;
|
|
575
|
+
if (rowTop < viewTop) target = rowTop;
|
|
576
|
+
else if (rowBottom > viewBottom) target = rowBottom - list.clientHeight;
|
|
577
|
+
if (target === null) return;
|
|
578
|
+
const maxScrollTop = Math.max(list.scrollHeight - list.clientHeight, 0);
|
|
579
|
+
list.scrollTop = Math.min(Math.max(target, 0), maxScrollTop);
|
|
580
|
+
}
|
|
581
|
+
positions() {
|
|
582
|
+
const offset = Number.isFinite(this.host.alignOffset()) ? this.host.alignOffset() : 0;
|
|
583
|
+
const offsetX = this.dir() === "rtl" ? -offset : offset;
|
|
584
|
+
return [{
|
|
585
|
+
originX: "start",
|
|
586
|
+
originY: "bottom",
|
|
587
|
+
overlayX: "start",
|
|
588
|
+
overlayY: "top",
|
|
589
|
+
offsetY: OVERLAY_GAP,
|
|
590
|
+
offsetX
|
|
591
|
+
}, {
|
|
592
|
+
originX: "start",
|
|
593
|
+
originY: "top",
|
|
594
|
+
overlayX: "start",
|
|
595
|
+
overlayY: "bottom",
|
|
596
|
+
offsetY: -6,
|
|
597
|
+
offsetX
|
|
598
|
+
}];
|
|
599
|
+
}
|
|
600
|
+
observeDirection() {
|
|
601
|
+
this.directionSubscription = this.host.directionality?.change.subscribe(() => this.updateDirection());
|
|
602
|
+
if (typeof MutationObserver === "undefined") return;
|
|
603
|
+
this.directionObserver = new MutationObserver(() => this.updateDirection());
|
|
604
|
+
for (let element = this.host.element; element; element = element.parentElement) this.directionObserver.observe(element, {
|
|
605
|
+
attributes: true,
|
|
606
|
+
attributeFilter: [
|
|
607
|
+
"dir",
|
|
608
|
+
"class",
|
|
609
|
+
"style"
|
|
610
|
+
]
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
updateDirection() {
|
|
614
|
+
const ref = this.overlayRef;
|
|
615
|
+
if (!ref) return;
|
|
616
|
+
const direction = this.host.direction();
|
|
617
|
+
if (direction === this.dir()) return;
|
|
618
|
+
this.dir.set(direction);
|
|
619
|
+
ref.setDirection(direction);
|
|
620
|
+
this.positionStrategy?.withPositions(this.positions());
|
|
621
|
+
ref.updatePosition();
|
|
622
|
+
}
|
|
623
|
+
stopObservingDirection() {
|
|
624
|
+
this.directionObserver?.disconnect();
|
|
625
|
+
this.directionObserver = void 0;
|
|
626
|
+
this.directionSubscription?.unsubscribe();
|
|
627
|
+
this.directionSubscription = void 0;
|
|
628
|
+
}
|
|
629
|
+
applyAnchorWidth() {
|
|
630
|
+
const overlayRef = this.overlayRef;
|
|
631
|
+
const anchor = this.host.anchor();
|
|
632
|
+
if (!overlayRef || !anchor || !anchor.isConnected) return;
|
|
633
|
+
const width = this.host.width();
|
|
634
|
+
const anchorWidth = anchor.getBoundingClientRect().width;
|
|
635
|
+
if (!width && (!Number.isFinite(anchorWidth) || anchorWidth <= 0)) return;
|
|
636
|
+
overlayRef.updateSize({ width: width || `${anchorWidth}px` });
|
|
637
|
+
}
|
|
638
|
+
applyAvailableHeight() {
|
|
639
|
+
const overlayRef = this.overlayRef;
|
|
640
|
+
const anchor = this.host.anchor();
|
|
641
|
+
if (!overlayRef || !anchor) return;
|
|
642
|
+
const anchorRect = anchor.getBoundingClientRect();
|
|
643
|
+
const below = this.viewportRuler.getViewportSize().height - anchorRect.bottom - OVERLAY_GAP - VIEWPORT_MARGIN;
|
|
644
|
+
const above = anchorRect.top - OVERLAY_GAP - VIEWPORT_MARGIN;
|
|
645
|
+
const available = Math.max(below, above, 0);
|
|
646
|
+
overlayRef.overlayElement.style.setProperty("--raqm-combobox-available-height", `${available}px`);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
function resolveComboboxDirection(dir, element, directionality) {
|
|
650
|
+
if (dir === "ltr" || dir === "rtl") return dir;
|
|
651
|
+
const computed = getComputedStyle(element).direction;
|
|
652
|
+
if (computed === "rtl" || computed === "ltr") return computed;
|
|
653
|
+
return directionality?.value ?? "ltr";
|
|
654
|
+
}
|
|
655
|
+
var RaqmComboboxPopup = class {
|
|
656
|
+
host;
|
|
657
|
+
constructor(host) {
|
|
658
|
+
this.host = host;
|
|
659
|
+
}
|
|
660
|
+
show() {
|
|
661
|
+
if (this.host.layer.open() || this.host.disabled()) return;
|
|
662
|
+
if (!this.host.layer.openLayer()) return;
|
|
663
|
+
this.host.keyboard.reset();
|
|
664
|
+
if (this.host.mode() === "popup") this.host.field.focusInput();
|
|
665
|
+
else if (this.host.mode() === "inline") this.host.field.focusInput();
|
|
666
|
+
else if (this.host.autoHighlight() && this.host.query().trim() !== "") this.host.keyboard.activateFirst();
|
|
667
|
+
}
|
|
668
|
+
close(touched, restoreFocus = true) {
|
|
669
|
+
if (!this.host.layer.open() && !this.host.layer.hasPane) return;
|
|
670
|
+
this.destroy(restoreFocus);
|
|
671
|
+
if (touched) this.host.touched();
|
|
672
|
+
}
|
|
673
|
+
destroy(restoreFocus) {
|
|
674
|
+
const wasOpen = this.host.layer.open();
|
|
675
|
+
const overlayRef = this.host.layer.detach();
|
|
676
|
+
this.host.keyboard.reset();
|
|
677
|
+
this.host.field.reset();
|
|
678
|
+
this.host.field.suppressBlurTouched = true;
|
|
679
|
+
overlayRef?.dispose();
|
|
680
|
+
this.host.field.suppressBlurTouched = false;
|
|
681
|
+
if (restoreFocus && wasOpen && this.host.mode() === "popup") this.host.field.restoreTriggerFocus();
|
|
682
|
+
}
|
|
683
|
+
handleDetached() {
|
|
684
|
+
this.host.layer.detach();
|
|
685
|
+
this.host.keyboard.reset();
|
|
686
|
+
this.host.field.resetQuery();
|
|
687
|
+
}
|
|
688
|
+
resetForMode() {
|
|
689
|
+
this.destroy(false);
|
|
690
|
+
this.host.field.resetQuery();
|
|
691
|
+
this.host.keyboard.reset();
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
var RaqmComboboxItemDirective = class RaqmComboboxItemDirective {
|
|
695
|
+
template = inject(TemplateRef);
|
|
696
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
697
|
+
minVersion: "12.0.0",
|
|
698
|
+
version: "22.2.2",
|
|
699
|
+
ngImport: i0,
|
|
700
|
+
type: RaqmComboboxItemDirective,
|
|
701
|
+
deps: [],
|
|
702
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
703
|
+
});
|
|
704
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
705
|
+
minVersion: "14.0.0",
|
|
706
|
+
version: "22.2.2",
|
|
707
|
+
type: RaqmComboboxItemDirective,
|
|
708
|
+
isStandalone: true,
|
|
709
|
+
selector: "ng-template[raqm-combobox-item]",
|
|
710
|
+
exportAs: ["raqmComboboxItem"],
|
|
711
|
+
ngImport: i0
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
715
|
+
minVersion: "12.0.0",
|
|
716
|
+
version: "22.2.2",
|
|
717
|
+
ngImport: i0,
|
|
718
|
+
type: RaqmComboboxItemDirective,
|
|
719
|
+
decorators: [{
|
|
720
|
+
type: Directive,
|
|
721
|
+
args: [{
|
|
722
|
+
selector: "ng-template[raqm-combobox-item]",
|
|
723
|
+
exportAs: "raqmComboboxItem"
|
|
724
|
+
}]
|
|
725
|
+
}]
|
|
726
|
+
});
|
|
727
|
+
var RaqmComboboxPrefixDirective = class RaqmComboboxPrefixDirective {
|
|
728
|
+
template = inject(TemplateRef);
|
|
729
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
730
|
+
minVersion: "12.0.0",
|
|
731
|
+
version: "22.2.2",
|
|
732
|
+
ngImport: i0,
|
|
733
|
+
type: RaqmComboboxPrefixDirective,
|
|
734
|
+
deps: [],
|
|
735
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
736
|
+
});
|
|
737
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
738
|
+
minVersion: "14.0.0",
|
|
739
|
+
version: "22.2.2",
|
|
740
|
+
type: RaqmComboboxPrefixDirective,
|
|
741
|
+
isStandalone: true,
|
|
742
|
+
selector: "ng-template[raqm-combobox-prefix]",
|
|
743
|
+
exportAs: ["raqmComboboxPrefix"],
|
|
744
|
+
ngImport: i0
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
748
|
+
minVersion: "12.0.0",
|
|
749
|
+
version: "22.2.2",
|
|
750
|
+
ngImport: i0,
|
|
751
|
+
type: RaqmComboboxPrefixDirective,
|
|
752
|
+
decorators: [{
|
|
753
|
+
type: Directive,
|
|
754
|
+
args: [{
|
|
755
|
+
selector: "ng-template[raqm-combobox-prefix]",
|
|
756
|
+
exportAs: "raqmComboboxPrefix"
|
|
757
|
+
}]
|
|
758
|
+
}]
|
|
759
|
+
});
|
|
760
|
+
function flattenItems(items) {
|
|
761
|
+
return items.flatMap((entry) => "options" in entry ? entry.options : [entry]);
|
|
762
|
+
}
|
|
763
|
+
function filterOptions(items, query, mode, selectedLabel) {
|
|
764
|
+
if (mode !== "multiple") {
|
|
765
|
+
if (!query) return items;
|
|
766
|
+
return items.filter((item) => {
|
|
767
|
+
if (selectedLabel !== null && selectedLabel.length === query.length && labelContains(selectedLabel, query)) return true;
|
|
768
|
+
return labelContains(item.label, query);
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
return items.filter((item) => labelContains(item.label, query));
|
|
772
|
+
}
|
|
773
|
+
function optionDomId(inputId, value) {
|
|
774
|
+
return `${inputId}-option-${Array.from({ length: value.length }, (_, i) => value.charCodeAt(i).toString(16).padStart(4, "0")).join("")}`;
|
|
775
|
+
}
|
|
776
|
+
function buildOptionViews(items, inputId) {
|
|
777
|
+
return items.map((item, index) => ({
|
|
778
|
+
item,
|
|
779
|
+
id: optionDomId(inputId, item.value),
|
|
780
|
+
index
|
|
781
|
+
}));
|
|
782
|
+
}
|
|
783
|
+
function buildRenderEntries(items, views, listboxId) {
|
|
784
|
+
const byValue = new Map(views.map((view) => [view.item.value, view]));
|
|
785
|
+
return items.flatMap((entry, index) => {
|
|
786
|
+
if ("options" in entry) {
|
|
787
|
+
const options = entry.options.flatMap((item) => {
|
|
788
|
+
const view = byValue.get(item.value);
|
|
789
|
+
return view ? [view] : [];
|
|
790
|
+
});
|
|
791
|
+
return options.length ? [{
|
|
792
|
+
label: entry.label,
|
|
793
|
+
id: `${listboxId}-group-${index}`,
|
|
794
|
+
options,
|
|
795
|
+
separatorBefore: entry.separatorBefore === true
|
|
796
|
+
}] : [];
|
|
797
|
+
}
|
|
798
|
+
const view = byValue.get(entry.value);
|
|
799
|
+
return view ? [{
|
|
800
|
+
label: null,
|
|
801
|
+
id: "",
|
|
802
|
+
options: [view],
|
|
803
|
+
separatorBefore: false
|
|
804
|
+
}] : [];
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
function buildSelectedLabel(selected, items) {
|
|
808
|
+
if (typeof selected !== "string") return null;
|
|
809
|
+
const match = items.find((item) => item.value === selected);
|
|
810
|
+
return match ? match.label : selected;
|
|
811
|
+
}
|
|
812
|
+
function buildSelectionRemovable(selected, items) {
|
|
813
|
+
return typeof selected !== "string" || !items.find((item) => item.value === selected)?.disabled;
|
|
814
|
+
}
|
|
815
|
+
function buildChipViews(selected, items) {
|
|
816
|
+
if (!Array.isArray(selected)) return [];
|
|
817
|
+
return selected.map((value) => {
|
|
818
|
+
const match = items.find((item) => item.value === value);
|
|
819
|
+
return {
|
|
820
|
+
value,
|
|
821
|
+
label: match ? match.label : value,
|
|
822
|
+
removable: match ? match.disabled !== true : true
|
|
823
|
+
};
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
var RaqmComboboxViewState = class {
|
|
827
|
+
host;
|
|
828
|
+
resolvedInputId = computed(() => this.host.inputId() || this.host.autoId(), ...ngDevMode ? [{ debugName: "resolvedInputId" }] : /* istanbul ignore next */ []);
|
|
829
|
+
labelId = computed(() => `${this.resolvedInputId()}-label`, ...ngDevMode ? [{ debugName: "labelId" }] : /* istanbul ignore next */ []);
|
|
830
|
+
listboxId = computed(() => `${this.resolvedInputId()}-listbox`, ...ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []);
|
|
831
|
+
popupId = computed(() => `${this.resolvedInputId()}-popup`, ...ngDevMode ? [{ debugName: "popupId" }] : /* istanbul ignore next */ []);
|
|
832
|
+
searchId = computed(() => `${this.resolvedInputId()}-search`, ...ngDevMode ? [{ debugName: "searchId" }] : /* istanbul ignore next */ []);
|
|
833
|
+
inputLabelledBy = computed(() => this.host.labelledBy() ?? (this.host.label() ? this.labelId() : null), ...ngDevMode ? [{ debugName: "inputLabelledBy" }] : /* istanbul ignore next */ []);
|
|
834
|
+
flatItems = computed(() => flattenItems(this.host.items()), ...ngDevMode ? [{ debugName: "flatItems" }] : /* istanbul ignore next */ []);
|
|
835
|
+
filteredItems = computed(() => filterOptions(this.flatItems(), this.host.query(), this.host.mode(), this.selectedLabel()), ...ngDevMode ? [{ debugName: "filteredItems" }] : /* istanbul ignore next */ []);
|
|
836
|
+
optionViews = computed(() => buildOptionViews(this.filteredItems(), this.resolvedInputId()), ...ngDevMode ? [{ debugName: "optionViews" }] : /* istanbul ignore next */ []);
|
|
837
|
+
renderEntries = computed(() => buildRenderEntries(this.host.items(), this.optionViews(), this.listboxId()), ...ngDevMode ? [{ debugName: "renderEntries" }] : /* istanbul ignore next */ []);
|
|
838
|
+
selectedLabel = computed(() => buildSelectedLabel(this.host.selected(), this.flatItems()), ...ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []);
|
|
839
|
+
selectionRemovable = computed(() => buildSelectionRemovable(this.host.selected(), this.flatItems()), ...ngDevMode ? [{ debugName: "selectionRemovable" }] : /* istanbul ignore next */ []);
|
|
840
|
+
inlineValue = computed(() => {
|
|
841
|
+
const composing = this.host.composingValue();
|
|
842
|
+
if (composing !== null) return composing;
|
|
843
|
+
return this.host.open() ? this.host.query() : this.selectedLabel() ?? "";
|
|
844
|
+
}, ...ngDevMode ? [{ debugName: "inlineValue" }] : /* istanbul ignore next */ []);
|
|
845
|
+
chipViews = computed(() => buildChipViews(this.host.selected(), this.flatItems()), ...ngDevMode ? [{ debugName: "chipViews" }] : /* istanbul ignore next */ []);
|
|
846
|
+
constructor(host) {
|
|
847
|
+
this.host = host;
|
|
848
|
+
}
|
|
849
|
+
};
|
|
850
|
+
let nextComboboxId = 0;
|
|
851
|
+
var RaqmCombobox = class RaqmCombobox {
|
|
852
|
+
host = inject(ElementRef);
|
|
853
|
+
document = inject(DOCUMENT);
|
|
854
|
+
interactivityChecker = inject(InteractivityChecker);
|
|
855
|
+
overlay = inject(Overlay);
|
|
856
|
+
viewportRuler = inject(ViewportRuler);
|
|
857
|
+
viewContainerRef = inject(ViewContainerRef);
|
|
858
|
+
injector = inject(Injector);
|
|
859
|
+
directionality = inject(Directionality, { optional: true });
|
|
860
|
+
popupTemplate = viewChild.required("popup", {
|
|
861
|
+
...ngDevMode ? { debugName: "popupTemplate" } : /* istanbul ignore next */ {},
|
|
862
|
+
read: TemplateRef
|
|
863
|
+
});
|
|
864
|
+
itemTemplateDirective = contentChild(RaqmComboboxItemDirective, ...ngDevMode ? [{ debugName: "itemTemplateDirective" }] : /* istanbul ignore next */ []);
|
|
865
|
+
inlinePrefixDirective = contentChild(RaqmComboboxPrefixDirective, ...ngDevMode ? [{ debugName: "inlinePrefixDirective" }] : /* istanbul ignore next */ []);
|
|
866
|
+
chipsRef = viewChild("chips", ...ngDevMode ? [{ debugName: "chipsRef" }] : /* istanbul ignore next */ []);
|
|
867
|
+
triggerRef = viewChild("trigger", {
|
|
868
|
+
...ngDevMode ? { debugName: "triggerRef" } : /* istanbul ignore next */ {},
|
|
869
|
+
read: ElementRef
|
|
870
|
+
});
|
|
871
|
+
inlineGroupRef = viewChild("inlineGroup", {
|
|
872
|
+
...ngDevMode ? { debugName: "inlineGroupRef" } : /* istanbul ignore next */ {},
|
|
873
|
+
read: ElementRef
|
|
874
|
+
});
|
|
875
|
+
autoId = `raqm-combobox-${++nextComboboxId}`;
|
|
876
|
+
mode = input("multiple", ...ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []);
|
|
877
|
+
items = input.required(...ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []);
|
|
878
|
+
inlinePrefix = computed(() => this.inlinePrefixDirective()?.template ?? null, ...ngDevMode ? [{ debugName: "inlinePrefix" }] : /* istanbul ignore next */ []);
|
|
879
|
+
itemTemplate = computed(() => this.itemTemplateDirective()?.template ?? null, ...ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []);
|
|
880
|
+
popupWidth = input(null, ...ngDevMode ? [{ debugName: "popupWidth" }] : /* istanbul ignore next */ []);
|
|
881
|
+
popupAlignOffset = input(0, ...ngDevMode ? [{ debugName: "popupAlignOffset" }] : /* istanbul ignore next */ []);
|
|
882
|
+
value = input(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
883
|
+
valueChange = output();
|
|
884
|
+
disabled = input(false, {
|
|
885
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
886
|
+
transform: booleanAttribute
|
|
887
|
+
});
|
|
888
|
+
invalid = input(false, {
|
|
889
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
890
|
+
transform: booleanAttribute
|
|
891
|
+
});
|
|
892
|
+
inputId = input("", ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
893
|
+
label = input(void 0, ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
894
|
+
labelledBy = input(void 0, ...ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []);
|
|
895
|
+
describedBy = input(void 0, ...ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []);
|
|
896
|
+
placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
|
|
897
|
+
searchPlaceholder = input(null, ...ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []);
|
|
898
|
+
emptyText = input(null, ...ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []);
|
|
899
|
+
removeLabel = input(null, ...ngDevMode ? [{ debugName: "removeLabel" }] : /* istanbul ignore next */ []);
|
|
900
|
+
dir = input(void 0, ...ngDevMode ? [{ debugName: "dir" }] : /* istanbul ignore next */ []);
|
|
901
|
+
autoHighlight = input(true, {
|
|
902
|
+
...ngDevMode ? { debugName: "autoHighlight" } : /* istanbul ignore next */ {},
|
|
903
|
+
transform: booleanAttribute
|
|
904
|
+
});
|
|
905
|
+
showTrigger = input(true, {
|
|
906
|
+
...ngDevMode ? { debugName: "showTrigger" } : /* istanbul ignore next */ {},
|
|
907
|
+
transform: booleanAttribute
|
|
908
|
+
});
|
|
909
|
+
showClear = input(false, {
|
|
910
|
+
...ngDevMode ? { debugName: "showClear" } : /* istanbul ignore next */ {},
|
|
911
|
+
transform: booleanAttribute
|
|
912
|
+
});
|
|
913
|
+
clearLabel = input(null, ...ngDevMode ? [{ debugName: "clearLabel" }] : /* istanbul ignore next */ []);
|
|
914
|
+
triggerLabel = input(null, ...ngDevMode ? [{ debugName: "triggerLabel" }] : /* istanbul ignore next */ []);
|
|
915
|
+
selected = linkedSignal(() => normalizeModel(this.value(), this.mode()), ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
916
|
+
view = new RaqmComboboxViewState({
|
|
917
|
+
items: () => this.items(),
|
|
918
|
+
selected: () => this.selected(),
|
|
919
|
+
mode: () => this.mode(),
|
|
920
|
+
inputId: () => this.inputId(),
|
|
921
|
+
autoId: () => this.autoId,
|
|
922
|
+
labelledBy: () => this.labelledBy(),
|
|
923
|
+
label: () => this.label(),
|
|
924
|
+
open: () => this.open(),
|
|
925
|
+
query: () => this.query(),
|
|
926
|
+
composingValue: () => this.composingValue()
|
|
927
|
+
});
|
|
928
|
+
resolvedInputId = this.view.resolvedInputId;
|
|
929
|
+
labelId = this.view.labelId;
|
|
930
|
+
listboxId = this.view.listboxId;
|
|
931
|
+
popupId = this.view.popupId;
|
|
932
|
+
searchId = this.view.searchId;
|
|
933
|
+
inputLabelledBy = this.view.inputLabelledBy;
|
|
934
|
+
flatItems = this.view.flatItems;
|
|
935
|
+
filteredItems = this.view.filteredItems;
|
|
936
|
+
optionViews = this.view.optionViews;
|
|
937
|
+
renderEntries = this.view.renderEntries;
|
|
938
|
+
selectedLabel = this.view.selectedLabel;
|
|
939
|
+
selectionRemovable = this.view.selectionRemovable;
|
|
940
|
+
inlineValue = this.view.inlineValue;
|
|
941
|
+
chipViews = this.view.chipViews;
|
|
942
|
+
control = new RaqmComboboxControl({
|
|
943
|
+
mode: () => this.mode(),
|
|
944
|
+
selected: () => this.selected(),
|
|
945
|
+
setSelected: (value) => this.selected.set(value),
|
|
946
|
+
query: () => this.query(),
|
|
947
|
+
disabled: () => this.effectiveDisabled(),
|
|
948
|
+
selectionRemovable: () => this.selectionRemovable(),
|
|
949
|
+
close: (touched) => this.popup.close(touched),
|
|
950
|
+
publish: (value) => this.valueChange.emit(value)
|
|
951
|
+
});
|
|
952
|
+
effectiveDisabled = computed(() => this.disabled() || this.control.disabled(), ...ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []);
|
|
953
|
+
field = new RaqmComboboxField({
|
|
954
|
+
open: () => this.open(),
|
|
955
|
+
disabled: () => this.effectiveDisabled(),
|
|
956
|
+
selectionRemovable: () => this.selectionRemovable(),
|
|
957
|
+
chipViews: () => this.chipViews(),
|
|
958
|
+
optionViews: () => this.optionViews(),
|
|
959
|
+
activeId: () => this.activeId(),
|
|
960
|
+
selected: () => this.selected(),
|
|
961
|
+
isOptionDisabled: (item) => this.isOptionDisabled(item),
|
|
962
|
+
trigger: () => this.triggerRef()?.nativeElement ?? null,
|
|
963
|
+
element: () => this.host.nativeElement,
|
|
964
|
+
overlayElement: () => this.layer.element,
|
|
965
|
+
openPopup: () => this.popup.show(),
|
|
966
|
+
close: (touched, restoreFocus) => this.popup.close(touched, restoreFocus),
|
|
967
|
+
select: (item) => this.control.commit(item),
|
|
968
|
+
emit: (value) => this.control.emit(value),
|
|
969
|
+
resetActive: () => this.keyboard.reset(),
|
|
970
|
+
reconcileActive: () => this.keyboard.reconcile(this.optionViews()),
|
|
971
|
+
markTouched: () => this.control.touch(),
|
|
972
|
+
activateOption: (index) => this.keyboard.activateIndex(index, false)
|
|
973
|
+
}, this.document, this.interactivityChecker);
|
|
974
|
+
keyboard = new RaqmComboboxKeyboard({
|
|
975
|
+
views: () => this.optionViews(),
|
|
976
|
+
open: () => this.open(),
|
|
977
|
+
disabled: () => this.effectiveDisabled(),
|
|
978
|
+
composing: () => this.field.isComposing,
|
|
979
|
+
mode: () => this.mode(),
|
|
980
|
+
autoHighlight: () => this.autoHighlight(),
|
|
981
|
+
query: () => this.query(),
|
|
982
|
+
direction: () => resolveComboboxDirection(this.dir(), this.host.nativeElement, this.directionality),
|
|
983
|
+
isOptionDisabled: (item) => this.isOptionDisabled(item),
|
|
984
|
+
chipCount: () => this.chipViews().length,
|
|
985
|
+
scrollTo: (id) => this.layer.scrollOptionIntoView(id),
|
|
986
|
+
openPopup: () => this.popup.show(),
|
|
987
|
+
close: (touched) => this.popup.close(touched),
|
|
988
|
+
select: (item) => this.control.commit(item),
|
|
989
|
+
removeChip: (index) => this.field.removeAt(index),
|
|
990
|
+
focusChip: (index) => this.field.focusChip(index),
|
|
991
|
+
focusInput: () => this.field.focusInput(),
|
|
992
|
+
leavePopupByTab: (event) => this.field.leavePopupByTab(event)
|
|
993
|
+
}, this.injector);
|
|
994
|
+
layer = new RaqmComboboxOverlay(this.overlay, this.viewportRuler, this.viewContainerRef, {
|
|
995
|
+
element: this.host.nativeElement,
|
|
996
|
+
directionality: this.directionality,
|
|
997
|
+
anchor: () => this.mode() === "popup" ? this.triggerRef()?.nativeElement ?? null : this.mode() === "inline" ? this.inlineGroupRef()?.nativeElement ?? null : this.chipsRef()?.nativeElement ?? null,
|
|
998
|
+
template: () => this.popupTemplate(),
|
|
999
|
+
direction: () => resolveComboboxDirection(this.dir(), this.host.nativeElement, this.directionality),
|
|
1000
|
+
width: () => this.popupWidth(),
|
|
1001
|
+
alignOffset: () => this.popupAlignOffset(),
|
|
1002
|
+
onOutside: () => this.popup.close(true, false),
|
|
1003
|
+
onDetached: () => this.popup.handleDetached()
|
|
1004
|
+
});
|
|
1005
|
+
popup = new RaqmComboboxPopup({
|
|
1006
|
+
layer: this.layer,
|
|
1007
|
+
keyboard: this.keyboard,
|
|
1008
|
+
field: this.field,
|
|
1009
|
+
mode: () => this.mode(),
|
|
1010
|
+
disabled: () => this.effectiveDisabled(),
|
|
1011
|
+
autoHighlight: () => this.autoHighlight(),
|
|
1012
|
+
query: () => this.query(),
|
|
1013
|
+
touched: () => this.control.touch()
|
|
1014
|
+
});
|
|
1015
|
+
open = this.layer.open;
|
|
1016
|
+
overlayDir = this.layer.dir;
|
|
1017
|
+
activeId = this.keyboard.activeId;
|
|
1018
|
+
query = this.field.query;
|
|
1019
|
+
composingValue = this.field.composingValue;
|
|
1020
|
+
constructor() {
|
|
1021
|
+
connectComboboxEffects({
|
|
1022
|
+
mode: () => this.mode(),
|
|
1023
|
+
popupWidth: () => this.popupWidth(),
|
|
1024
|
+
alignOffset: () => this.popupAlignOffset(),
|
|
1025
|
+
dir: () => this.dir(),
|
|
1026
|
+
open: () => this.open(),
|
|
1027
|
+
reposition: () => this.layer.reposition(),
|
|
1028
|
+
flatItems: () => this.flatItems(),
|
|
1029
|
+
views: () => this.optionViews(),
|
|
1030
|
+
disabled: () => this.effectiveDisabled(),
|
|
1031
|
+
selectionRemovable: () => this.selectionRemovable(),
|
|
1032
|
+
autoHighlight: () => this.autoHighlight(),
|
|
1033
|
+
close: () => this.popup.close(false),
|
|
1034
|
+
reconcile: (views) => this.keyboard.reconcile(views),
|
|
1035
|
+
resetForMode: () => this.popup.resetForMode()
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
ngOnInit() {
|
|
1039
|
+
this.keyboard.init();
|
|
1040
|
+
}
|
|
1041
|
+
ngOnDestroy() {
|
|
1042
|
+
this.keyboard.destroy();
|
|
1043
|
+
this.popup.destroy(false);
|
|
1044
|
+
}
|
|
1045
|
+
isOptionDisabled(item) {
|
|
1046
|
+
return item.disabled === true || this.mode() !== "multiple" && !this.selectionRemovable();
|
|
1047
|
+
}
|
|
1048
|
+
writeValue(value) {
|
|
1049
|
+
this.control.writeValue(value);
|
|
1050
|
+
}
|
|
1051
|
+
registerOnChange(fn) {
|
|
1052
|
+
this.control.registerOnChange(fn);
|
|
1053
|
+
}
|
|
1054
|
+
registerOnTouched(fn) {
|
|
1055
|
+
this.control.registerOnTouched(fn);
|
|
1056
|
+
}
|
|
1057
|
+
setDisabledState(isDisabled) {
|
|
1058
|
+
this.control.setDisabledState(isDisabled);
|
|
1059
|
+
}
|
|
1060
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
1061
|
+
minVersion: "12.0.0",
|
|
1062
|
+
version: "22.2.2",
|
|
1063
|
+
ngImport: i0,
|
|
1064
|
+
type: RaqmCombobox,
|
|
1065
|
+
deps: [],
|
|
1066
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
1067
|
+
});
|
|
1068
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
1069
|
+
minVersion: "17.0.0",
|
|
1070
|
+
version: "22.2.2",
|
|
1071
|
+
type: RaqmCombobox,
|
|
1072
|
+
isStandalone: true,
|
|
1073
|
+
selector: "raqm-combobox",
|
|
1074
|
+
inputs: {
|
|
1075
|
+
mode: {
|
|
1076
|
+
classPropertyName: "mode",
|
|
1077
|
+
publicName: "mode",
|
|
1078
|
+
isSignal: true,
|
|
1079
|
+
isRequired: false,
|
|
1080
|
+
transformFunction: null
|
|
1081
|
+
},
|
|
1082
|
+
items: {
|
|
1083
|
+
classPropertyName: "items",
|
|
1084
|
+
publicName: "items",
|
|
1085
|
+
isSignal: true,
|
|
1086
|
+
isRequired: true,
|
|
1087
|
+
transformFunction: null
|
|
1088
|
+
},
|
|
1089
|
+
popupWidth: {
|
|
1090
|
+
classPropertyName: "popupWidth",
|
|
1091
|
+
publicName: "popupWidth",
|
|
1092
|
+
isSignal: true,
|
|
1093
|
+
isRequired: false,
|
|
1094
|
+
transformFunction: null
|
|
1095
|
+
},
|
|
1096
|
+
popupAlignOffset: {
|
|
1097
|
+
classPropertyName: "popupAlignOffset",
|
|
1098
|
+
publicName: "popupAlignOffset",
|
|
1099
|
+
isSignal: true,
|
|
1100
|
+
isRequired: false,
|
|
1101
|
+
transformFunction: null
|
|
1102
|
+
},
|
|
1103
|
+
value: {
|
|
1104
|
+
classPropertyName: "value",
|
|
1105
|
+
publicName: "value",
|
|
1106
|
+
isSignal: true,
|
|
1107
|
+
isRequired: false,
|
|
1108
|
+
transformFunction: null
|
|
1109
|
+
},
|
|
1110
|
+
disabled: {
|
|
1111
|
+
classPropertyName: "disabled",
|
|
1112
|
+
publicName: "disabled",
|
|
1113
|
+
isSignal: true,
|
|
1114
|
+
isRequired: false,
|
|
1115
|
+
transformFunction: null
|
|
1116
|
+
},
|
|
1117
|
+
invalid: {
|
|
1118
|
+
classPropertyName: "invalid",
|
|
1119
|
+
publicName: "invalid",
|
|
1120
|
+
isSignal: true,
|
|
1121
|
+
isRequired: false,
|
|
1122
|
+
transformFunction: null
|
|
1123
|
+
},
|
|
1124
|
+
inputId: {
|
|
1125
|
+
classPropertyName: "inputId",
|
|
1126
|
+
publicName: "inputId",
|
|
1127
|
+
isSignal: true,
|
|
1128
|
+
isRequired: false,
|
|
1129
|
+
transformFunction: null
|
|
1130
|
+
},
|
|
1131
|
+
label: {
|
|
1132
|
+
classPropertyName: "label",
|
|
1133
|
+
publicName: "label",
|
|
1134
|
+
isSignal: true,
|
|
1135
|
+
isRequired: false,
|
|
1136
|
+
transformFunction: null
|
|
1137
|
+
},
|
|
1138
|
+
labelledBy: {
|
|
1139
|
+
classPropertyName: "labelledBy",
|
|
1140
|
+
publicName: "labelledBy",
|
|
1141
|
+
isSignal: true,
|
|
1142
|
+
isRequired: false,
|
|
1143
|
+
transformFunction: null
|
|
1144
|
+
},
|
|
1145
|
+
describedBy: {
|
|
1146
|
+
classPropertyName: "describedBy",
|
|
1147
|
+
publicName: "describedBy",
|
|
1148
|
+
isSignal: true,
|
|
1149
|
+
isRequired: false,
|
|
1150
|
+
transformFunction: null
|
|
1151
|
+
},
|
|
1152
|
+
placeholder: {
|
|
1153
|
+
classPropertyName: "placeholder",
|
|
1154
|
+
publicName: "placeholder",
|
|
1155
|
+
isSignal: true,
|
|
1156
|
+
isRequired: false,
|
|
1157
|
+
transformFunction: null
|
|
1158
|
+
},
|
|
1159
|
+
searchPlaceholder: {
|
|
1160
|
+
classPropertyName: "searchPlaceholder",
|
|
1161
|
+
publicName: "searchPlaceholder",
|
|
1162
|
+
isSignal: true,
|
|
1163
|
+
isRequired: false,
|
|
1164
|
+
transformFunction: null
|
|
1165
|
+
},
|
|
1166
|
+
emptyText: {
|
|
1167
|
+
classPropertyName: "emptyText",
|
|
1168
|
+
publicName: "emptyText",
|
|
1169
|
+
isSignal: true,
|
|
1170
|
+
isRequired: false,
|
|
1171
|
+
transformFunction: null
|
|
1172
|
+
},
|
|
1173
|
+
removeLabel: {
|
|
1174
|
+
classPropertyName: "removeLabel",
|
|
1175
|
+
publicName: "removeLabel",
|
|
1176
|
+
isSignal: true,
|
|
1177
|
+
isRequired: false,
|
|
1178
|
+
transformFunction: null
|
|
1179
|
+
},
|
|
1180
|
+
dir: {
|
|
1181
|
+
classPropertyName: "dir",
|
|
1182
|
+
publicName: "dir",
|
|
1183
|
+
isSignal: true,
|
|
1184
|
+
isRequired: false,
|
|
1185
|
+
transformFunction: null
|
|
1186
|
+
},
|
|
1187
|
+
autoHighlight: {
|
|
1188
|
+
classPropertyName: "autoHighlight",
|
|
1189
|
+
publicName: "autoHighlight",
|
|
1190
|
+
isSignal: true,
|
|
1191
|
+
isRequired: false,
|
|
1192
|
+
transformFunction: null
|
|
1193
|
+
},
|
|
1194
|
+
showTrigger: {
|
|
1195
|
+
classPropertyName: "showTrigger",
|
|
1196
|
+
publicName: "showTrigger",
|
|
1197
|
+
isSignal: true,
|
|
1198
|
+
isRequired: false,
|
|
1199
|
+
transformFunction: null
|
|
1200
|
+
},
|
|
1201
|
+
showClear: {
|
|
1202
|
+
classPropertyName: "showClear",
|
|
1203
|
+
publicName: "showClear",
|
|
1204
|
+
isSignal: true,
|
|
1205
|
+
isRequired: false,
|
|
1206
|
+
transformFunction: null
|
|
1207
|
+
},
|
|
1208
|
+
clearLabel: {
|
|
1209
|
+
classPropertyName: "clearLabel",
|
|
1210
|
+
publicName: "clearLabel",
|
|
1211
|
+
isSignal: true,
|
|
1212
|
+
isRequired: false,
|
|
1213
|
+
transformFunction: null
|
|
1214
|
+
},
|
|
1215
|
+
triggerLabel: {
|
|
1216
|
+
classPropertyName: "triggerLabel",
|
|
1217
|
+
publicName: "triggerLabel",
|
|
1218
|
+
isSignal: true,
|
|
1219
|
+
isRequired: false,
|
|
1220
|
+
transformFunction: null
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
outputs: { valueChange: "valueChange" },
|
|
1224
|
+
host: {
|
|
1225
|
+
properties: {
|
|
1226
|
+
"attr.data-raqm-mode": "mode()",
|
|
1227
|
+
"attr.data-raqm-disabled": "effectiveDisabled() ? \"true\" : null",
|
|
1228
|
+
"attr.data-raqm-invalid": "invalid() ? \"true\" : null",
|
|
1229
|
+
"attr.data-raqm-open": "open() ? \"true\" : null"
|
|
1230
|
+
},
|
|
1231
|
+
classAttribute: "raqm-combobox"
|
|
1232
|
+
},
|
|
1233
|
+
providers: [{
|
|
1234
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1235
|
+
useExisting: forwardRef(() => RaqmCombobox),
|
|
1236
|
+
multi: true
|
|
1237
|
+
}],
|
|
1238
|
+
queries: [{
|
|
1239
|
+
propertyName: "itemTemplateDirective",
|
|
1240
|
+
first: true,
|
|
1241
|
+
predicate: RaqmComboboxItemDirective,
|
|
1242
|
+
descendants: true,
|
|
1243
|
+
isSignal: true
|
|
1244
|
+
}, {
|
|
1245
|
+
propertyName: "inlinePrefixDirective",
|
|
1246
|
+
first: true,
|
|
1247
|
+
predicate: RaqmComboboxPrefixDirective,
|
|
1248
|
+
descendants: true,
|
|
1249
|
+
isSignal: true
|
|
1250
|
+
}],
|
|
1251
|
+
viewQueries: [
|
|
1252
|
+
{
|
|
1253
|
+
propertyName: "popupTemplate",
|
|
1254
|
+
first: true,
|
|
1255
|
+
predicate: ["popup"],
|
|
1256
|
+
descendants: true,
|
|
1257
|
+
read: TemplateRef,
|
|
1258
|
+
isSignal: true
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
propertyName: "chipsRef",
|
|
1262
|
+
first: true,
|
|
1263
|
+
predicate: ["chips"],
|
|
1264
|
+
descendants: true,
|
|
1265
|
+
isSignal: true
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
propertyName: "triggerRef",
|
|
1269
|
+
first: true,
|
|
1270
|
+
predicate: ["trigger"],
|
|
1271
|
+
descendants: true,
|
|
1272
|
+
read: ElementRef,
|
|
1273
|
+
isSignal: true
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
propertyName: "inlineGroupRef",
|
|
1277
|
+
first: true,
|
|
1278
|
+
predicate: ["inlineGroup"],
|
|
1279
|
+
descendants: true,
|
|
1280
|
+
read: ElementRef,
|
|
1281
|
+
isSignal: true
|
|
1282
|
+
}
|
|
1283
|
+
],
|
|
1284
|
+
ngImport: i0,
|
|
1285
|
+
template: "@if (label(); as labelText) {\r\n <!-- `for` targets the real control id, not the custom-element host. -->\r\n <label class=\"raqm-combobox-label\" [attr.for]=\"resolvedInputId()\" [attr.id]=\"labelId()\">\r\n {{ labelText }}\r\n </label>\r\n}\r\n\r\n@if (mode() === 'multiple') {\r\n <!-- Multiple chip field: the overlay anchor, owning the focus and invalid boundary. -->\r\n <div\r\n #chips\r\n class=\"raqm-combobox-chips\"\r\n [attr.data-raqm-invalid]=\"invalid() ? 'true' : null\"\r\n (pointerdown)=\"field.onChipsPointerDown($event)\"\r\n >\r\n @for (chip of chipViews(); track chip.value) {\r\n <span class=\"raqm-combobox-chip\">\r\n <span class=\"raqm-combobox-chip-label\">{{ chip.label }}</span>\r\n <button\r\n raqm-button=\"ghost\"\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-chip-remove\"\r\n [disabled]=\"effectiveDisabled() || !chip.removable\"\r\n [attr.aria-label]=\"removeLabel() ? removeLabel() + ' ' + chip.label : null\"\r\n (click)=\"field.onChipRemoveClick($index, $event)\"\r\n (keydown)=\"keyboard.onChipKeydown($index, $event)\"\r\n >\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n </button>\r\n </span>\r\n }\r\n\r\n <!-- The one editable control; `role=\"combobox\"` and `aria-activedescendant` wire the listbox. -->\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input raqm-combobox-chip-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"placeholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"composingValue() ?? query()\"\r\n (pointerdown)=\"field.onInputPointerDown()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n </div>\r\n} @else if (mode() === 'inline') {\r\n <!-- Inline: the Input Group is the anchor; the clear button replaces the chevron trigger. -->\r\n <raqm-input-group #inlineGroup class=\"raqm-combobox-inline\">\r\n @if (inlinePrefix(); as prefix) {\r\n <raqm-input-group-addon align=\"inline-start\">\r\n <ng-container [ngTemplateOutlet]=\"prefix\" />\r\n </raqm-input-group-addon>\r\n }\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"placeholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"inlineValue()\"\r\n (focus)=\"field.onInlineFocus($event)\"\r\n (pointerdown)=\"field.onInputPointerDown()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n <raqm-input-group-addon align=\"inline-end\">\r\n @if (showClear() && selectedLabel() !== null) {\r\n <button\r\n raqm-button=\"ghost\"\r\n raqm-input-group-button\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-clear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [disabled]=\"effectiveDisabled() || !selectionRemovable()\"\r\n (click)=\"field.onClearClick($event)\"\r\n >\r\n <svg\r\n class=\"raqm-combobox-clear-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n </button>\r\n } @else if (showTrigger()) {\r\n <button\r\n raqm-button=\"ghost\"\r\n raqm-input-group-button\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-inline-trigger\"\r\n aria-haspopup=\"listbox\"\r\n [attr.aria-label]=\"triggerLabel()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [disabled]=\"effectiveDisabled()\"\r\n (click)=\"field.onTriggerClick()\"\r\n (keydown)=\"keyboard.onTriggerKeydown($event)\"\r\n >\r\n <svg\r\n class=\"raqm-combobox-trigger-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n </button>\r\n }\r\n </raqm-input-group-addon>\r\n </raqm-input-group>\r\n} @else {\r\n <!-- Popup trigger; it never holds focus while the search field does. -->\r\n <button\r\n raqm-button=\"outline\"\r\n #trigger\r\n type=\"button\"\r\n class=\"raqm-combobox-trigger\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [disabled]=\"effectiveDisabled()\"\r\n (click)=\"field.onTriggerClick()\"\r\n (keydown)=\"keyboard.onTriggerKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n >\r\n <span class=\"raqm-combobox-trigger-value\">{{ selectedLabel() ?? placeholder() }}</span>\r\n <svg\r\n class=\"raqm-combobox-trigger-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n </button>\r\n}\r\n\r\n<!-- Instantiated into a CDK overlay from this view, so component styles apply. -->\r\n<ng-template #popup>\r\n <div\r\n class=\"raqm-combobox-popup\"\r\n [attr.id]=\"popupId()\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.data-raqm-anchor]=\"mode()\"\r\n >\r\n @if (mode() === 'popup') {\r\n <!-- Inner search field; deliberately no inner trigger or clear. -->\r\n <raqm-input-group class=\"raqm-combobox-search\">\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input raqm-combobox-search-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"searchId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"listboxId()\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"searchPlaceholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"composingValue() ?? query()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n <raqm-input-group-addon align=\"inline-end\"></raqm-input-group-addon>\r\n </raqm-input-group>\r\n }\r\n\r\n <!-- No-results message; the list collapses to zero padding while it shows. -->\r\n @if (filteredItems().length === 0 && emptyText(); as emptyMessage) {\r\n <div class=\"raqm-combobox-empty\">{{ emptyMessage }}</div>\r\n }\r\n\r\n <!-- Real listbox; `aria-multiselectable` only in Multiple. -->\r\n <div\r\n class=\"raqm-combobox-list\"\r\n role=\"listbox\"\r\n [attr.id]=\"listboxId()\"\r\n [attr.aria-multiselectable]=\"mode() === 'multiple' ? 'true' : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.data-raqm-empty]=\"filteredItems().length === 0 ? '' : null\"\r\n >\r\n @for (entry of renderEntries(); track $index) {\r\n @if (entry.separatorBefore && !$first) {\r\n <div class=\"raqm-combobox-separator\" role=\"presentation\" aria-hidden=\"true\"></div>\r\n }\r\n @if (entry.label !== null) {\r\n <div role=\"group\" [attr.aria-labelledby]=\"entry.id\">\r\n <div class=\"raqm-combobox-group-label\" [attr.id]=\"entry.id\">{{ entry.label }}</div>\r\n @for (view of entry.options; track view.id) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"option\"\r\n [ngTemplateOutletContext]=\"{ $implicit: view }\"\r\n />\r\n }\r\n </div>\r\n } @else {\r\n @for (view of entry.options; track view.id) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"option\"\r\n [ngTemplateOutletContext]=\"{ $implicit: view }\"\r\n />\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #option let-view>\r\n <div\r\n class=\"raqm-combobox-option\"\r\n role=\"option\"\r\n [attr.id]=\"view.id\"\r\n [attr.aria-selected]=\"field.isSelected(view.item) ? 'true' : 'false'\"\r\n [attr.aria-disabled]=\"isOptionDisabled(view.item) ? 'true' : null\"\r\n [attr.aria-label]=\"view.item.label\"\r\n [attr.aria-describedby]=\"view.item.description ? view.id + '-description' : null\"\r\n [class.raqm-combobox-option--active]=\"view.id === activeId()\"\r\n [attr.data-raqm-highlighted]=\"view.id === activeId() ? '' : null\"\r\n (pointerdown)=\"$event.preventDefault()\"\r\n (mousedown)=\"$event.preventDefault()\"\r\n (pointermove)=\"field.onOptionPointerMove(view, $event)\"\r\n (pointerleave)=\"field.onOptionPointerLeave($event)\"\r\n (click)=\"field.onOptionClick(view.item)\"\r\n >\r\n @if (view.item.description) {\r\n <span class=\"raqm-combobox-option-description\" [attr.id]=\"view.id + '-description'\">{{\r\n view.item.description\r\n }}</span>\r\n }\r\n <span class=\"raqm-combobox-option-indicator\" aria-hidden=\"true\">\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M20 6 9 17l-5-5\" />\r\n </svg>\r\n </span>\r\n <span class=\"raqm-combobox-option-text\">\r\n @if (itemTemplate(); as template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"template\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: view.item,\r\n item: view.item,\r\n selected: field.isSelected(view.item),\r\n active: view.id === activeId(),\r\n }\"\r\n />\r\n } @else {\r\n {{ view.item.label }}\r\n }\r\n </span>\r\n </div>\r\n</ng-template>\r\n",
|
|
1286
|
+
styles: [".raqm-combobox-chips{display:flex;flex-wrap:wrap;align-items:center;gap:calc(var(--raqm-spacing) * 1);min-block-size:calc(var(--raqm-spacing) * 8);inline-size:100%;box-sizing:border-box;border:1px solid var(--raqm-input);border-radius:var(--raqm-radius-lg);background-color:var(--raqm-control-bg);background-clip:padding-box;padding-inline:calc(var(--raqm-spacing) * 2.5);padding-block:calc(var(--raqm-spacing) * 1);font-size:var(--raqm-font-size-sm);color:var(--raqm-foreground);transition:color var(--raqm-duration-base) var(--raqm-ease-standard),background-color var(--raqm-duration-base) var(--raqm-ease-standard),border-color var(--raqm-duration-base) var(--raqm-ease-standard),box-shadow var(--raqm-duration-base) var(--raqm-ease-standard)}.raqm-combobox-chips:has(>.raqm-combobox-chip){padding-inline:calc(var(--raqm-spacing) * 1)}.raqm-combobox-chips:focus-within{border-color:var(--raqm-ring);box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-focus-ring-color)}.raqm-combobox-chips[data-raqm-invalid=true]{border-color:var(--raqm-invalid-border);box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-invalid-ring)}.raqm-combobox-chips:has(>.raqm-combobox-chip-input:disabled){background-color:var(--raqm-input-disabled-bg);opacity:var(--raqm-disabled-opacity);cursor:not-allowed}.raqm-combobox-chip{display:flex;inline-size:fit-content;align-items:center;justify-content:center;gap:calc(var(--raqm-spacing) * 1);block-size:calc(var(--raqm-spacing) * 5.25);border-radius:var(--raqm-radius-sm);padding-inline:calc(var(--raqm-spacing) * 1.5);background-color:var(--raqm-muted);color:var(--raqm-foreground);font-size:var(--raqm-font-size-xs);font-weight:var(--raqm-font-weight-medium);white-space:nowrap}.raqm-combobox-chip:has(>.raqm-combobox-chip-remove){padding-inline-end:0}.raqm-combobox-chip-label{pointer-events:none}.raqm-combobox-chip-input{flex:1 1 auto;min-inline-size:calc(var(--raqm-spacing) * 16);inline-size:auto;block-size:auto;align-self:center;border:0;border-radius:0;background-color:transparent;box-shadow:none;padding:0;font-size:var(--raqm-font-size-sm);color:var(--raqm-foreground)}.raqm-combobox-chip-input:focus-visible{border-color:transparent;box-shadow:none}.raqm-combobox-chip-input::placeholder{color:var(--raqm-muted-foreground)}.raqm-combobox-trigger{inline-size:calc(var(--raqm-spacing) * 64);justify-content:space-between;font-weight:var(--raqm-font-weight-normal)}.raqm-combobox-trigger-value{display:flex;flex:1 1 auto;text-align:start;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.raqm-combobox-inline{inline-size:auto;max-inline-size:100%}.raqm-button.raqm-combobox-inline-trigger[data-raqm-size],.raqm-button.raqm-combobox-clear[data-raqm-size]{inline-size:calc(var(--raqm-spacing) * 6);padding-inline:0}.raqm-combobox-trigger-icon{color:var(--raqm-muted-foreground)}.raqm-combobox-popup{box-sizing:border-box;position:relative;inline-size:100%;max-block-size:min(var(--raqm-spacing) * 72,var(--raqm-combobox-available-height, 100vh));min-inline-size:calc(var(--raqm-spacing) * 36);overflow:hidden;border-radius:var(--raqm-radius-lg);background-color:color-mix(in oklch,var(--raqm-popover) 70%,transparent);color:var(--raqm-popover-foreground);box-shadow:var(--raqm-shadow-md),0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent);transition-duration:var(--raqm-duration-fast)}.raqm-combobox-popup:before{content:\"\";position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;backdrop-filter:blur(40px) saturate(150%);-webkit-backdrop-filter:blur(40px) saturate(150%)}.raqm-combobox-search{inline-size:auto;margin:var(--raqm-spacing);margin-block-end:0;block-size:calc(var(--raqm-spacing) * 8);box-shadow:none;background-color:color-mix(in oklch,var(--raqm-input) 30%,transparent);border-color:color-mix(in oklch,var(--raqm-input) 30%,transparent)}.raqm-combobox-list{max-block-size:min(var(--raqm-spacing) * 72 - var(--raqm-spacing) * 9,var(--raqm-combobox-available-height, 100vh) - var(--raqm-spacing) * 9);scroll-padding-block:var(--raqm-spacing);overflow-y:auto;overscroll-behavior:contain;padding:var(--raqm-spacing);scrollbar-width:none}.raqm-combobox-list::-webkit-scrollbar{display:none}.raqm-combobox-list[data-raqm-empty]{padding:0}.raqm-combobox-group-label{padding-inline:calc(var(--raqm-spacing) * 2);padding-block:calc(var(--raqm-spacing) * 1.5);font-size:var(--raqm-font-size-xs);color:var(--raqm-muted-foreground)}.raqm-combobox-separator{background-color:var(--raqm-border);block-size:1px;margin-inline:calc(var(--raqm-spacing) * -1);margin-block:var(--raqm-spacing)}.raqm-combobox-option-description{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.raqm-combobox-option{position:relative;display:flex;inline-size:100%;align-items:center;cursor:default;outline:none;-webkit-user-select:none;user-select:none;box-sizing:border-box;gap:calc(var(--raqm-spacing) * 2);border-radius:var(--raqm-radius-md);padding-block:var(--raqm-spacing);padding-inline-start:calc(var(--raqm-spacing) * 1.5);padding-inline-end:calc(var(--raqm-spacing) * 8);font-size:var(--raqm-font-size-sm);line-height:calc(var(--raqm-spacing) * 5)}.raqm-combobox-option[aria-disabled=true]{pointer-events:none;opacity:var(--raqm-disabled-opacity)}.raqm-combobox-option--active,.raqm-combobox-option[data-raqm-highlighted]{background-color:var(--raqm-accent);color:var(--raqm-accent-foreground)}.raqm-combobox-option-indicator{position:absolute;inset-inline-end:calc(var(--raqm-spacing) * 2);display:flex;inline-size:calc(var(--raqm-spacing) * 4);block-size:calc(var(--raqm-spacing) * 4);align-items:center;justify-content:center;pointer-events:none;visibility:hidden}.raqm-combobox-option[aria-selected=true] .raqm-combobox-option-indicator{visibility:visible}.raqm-combobox-option-indicator svg{inline-size:100%;block-size:100%}.raqm-combobox-option-text{display:flex;flex:1 1 auto;gap:calc(var(--raqm-spacing) * 2)}.raqm-combobox-empty{display:flex;inline-size:100%;justify-content:center;padding-block:calc(var(--raqm-spacing) * 2);text-align:center;font-size:var(--raqm-font-size-sm);color:var(--raqm-muted-foreground)}:host{display:inline-block;max-inline-size:100%}.raqm-combobox-label{display:block;margin-block-end:calc(var(--raqm-spacing) * 1.5);font-size:var(--raqm-font-size-sm);font-weight:var(--raqm-font-weight-medium);color:var(--raqm-foreground)}\n"],
|
|
1287
|
+
dependencies: [
|
|
1288
|
+
{
|
|
1289
|
+
kind: "component",
|
|
1290
|
+
type: RaqmButton,
|
|
1291
|
+
selector: "button[raqm-button], a[raqm-button]",
|
|
1292
|
+
inputs: [
|
|
1293
|
+
"raqm-button",
|
|
1294
|
+
"extra-small",
|
|
1295
|
+
"small",
|
|
1296
|
+
"large",
|
|
1297
|
+
"icon",
|
|
1298
|
+
"icon-extra-small",
|
|
1299
|
+
"icon-small",
|
|
1300
|
+
"icon-large",
|
|
1301
|
+
"disabled",
|
|
1302
|
+
"tabindex"
|
|
1303
|
+
]
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
kind: "directive",
|
|
1307
|
+
type: RaqmInput,
|
|
1308
|
+
selector: "input[raqm-input]",
|
|
1309
|
+
inputs: ["raqm-input"]
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
kind: "component",
|
|
1313
|
+
type: i1.RaqmInputGroupComponent,
|
|
1314
|
+
selector: "raqm-input-group"
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
kind: "component",
|
|
1318
|
+
type: i1.RaqmInputGroupAddonComponent,
|
|
1319
|
+
selector: "raqm-input-group-addon",
|
|
1320
|
+
inputs: ["align"]
|
|
1321
|
+
},
|
|
1322
|
+
{
|
|
1323
|
+
kind: "directive",
|
|
1324
|
+
type: i1.RaqmInputGroupButtonDirective,
|
|
1325
|
+
selector: "button[raqm-button][raqm-input-group-button]"
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
kind: "directive",
|
|
1329
|
+
type: NgTemplateOutlet,
|
|
1330
|
+
selector: "[ngTemplateOutlet]",
|
|
1331
|
+
inputs: [
|
|
1332
|
+
"ngTemplateOutletContext",
|
|
1333
|
+
"ngTemplateOutlet",
|
|
1334
|
+
"ngTemplateOutletInjector"
|
|
1335
|
+
]
|
|
1336
|
+
}
|
|
1337
|
+
],
|
|
1338
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
1339
|
+
});
|
|
1340
|
+
};
|
|
1341
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
1342
|
+
minVersion: "12.0.0",
|
|
1343
|
+
version: "22.2.2",
|
|
1344
|
+
ngImport: i0,
|
|
1345
|
+
type: RaqmCombobox,
|
|
1346
|
+
decorators: [{
|
|
1347
|
+
type: Component,
|
|
1348
|
+
args: [{
|
|
1349
|
+
selector: "raqm-combobox",
|
|
1350
|
+
imports: [
|
|
1351
|
+
RaqmButton,
|
|
1352
|
+
RaqmInput,
|
|
1353
|
+
RaqmInputGroup,
|
|
1354
|
+
NgTemplateOutlet
|
|
1355
|
+
],
|
|
1356
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1357
|
+
providers: [{
|
|
1358
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1359
|
+
useExisting: forwardRef(() => RaqmCombobox),
|
|
1360
|
+
multi: true
|
|
1361
|
+
}],
|
|
1362
|
+
host: {
|
|
1363
|
+
class: "raqm-combobox",
|
|
1364
|
+
"[attr.data-raqm-mode]": "mode()",
|
|
1365
|
+
"[attr.data-raqm-disabled]": "effectiveDisabled() ? \"true\" : null",
|
|
1366
|
+
"[attr.data-raqm-invalid]": "invalid() ? \"true\" : null",
|
|
1367
|
+
"[attr.data-raqm-open]": "open() ? \"true\" : null"
|
|
1368
|
+
},
|
|
1369
|
+
template: "@if (label(); as labelText) {\r\n <!-- `for` targets the real control id, not the custom-element host. -->\r\n <label class=\"raqm-combobox-label\" [attr.for]=\"resolvedInputId()\" [attr.id]=\"labelId()\">\r\n {{ labelText }}\r\n </label>\r\n}\r\n\r\n@if (mode() === 'multiple') {\r\n <!-- Multiple chip field: the overlay anchor, owning the focus and invalid boundary. -->\r\n <div\r\n #chips\r\n class=\"raqm-combobox-chips\"\r\n [attr.data-raqm-invalid]=\"invalid() ? 'true' : null\"\r\n (pointerdown)=\"field.onChipsPointerDown($event)\"\r\n >\r\n @for (chip of chipViews(); track chip.value) {\r\n <span class=\"raqm-combobox-chip\">\r\n <span class=\"raqm-combobox-chip-label\">{{ chip.label }}</span>\r\n <button\r\n raqm-button=\"ghost\"\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-chip-remove\"\r\n [disabled]=\"effectiveDisabled() || !chip.removable\"\r\n [attr.aria-label]=\"removeLabel() ? removeLabel() + ' ' + chip.label : null\"\r\n (click)=\"field.onChipRemoveClick($index, $event)\"\r\n (keydown)=\"keyboard.onChipKeydown($index, $event)\"\r\n >\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n </button>\r\n </span>\r\n }\r\n\r\n <!-- The one editable control; `role=\"combobox\"` and `aria-activedescendant` wire the listbox. -->\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input raqm-combobox-chip-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"placeholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"composingValue() ?? query()\"\r\n (pointerdown)=\"field.onInputPointerDown()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n </div>\r\n} @else if (mode() === 'inline') {\r\n <!-- Inline: the Input Group is the anchor; the clear button replaces the chevron trigger. -->\r\n <raqm-input-group #inlineGroup class=\"raqm-combobox-inline\">\r\n @if (inlinePrefix(); as prefix) {\r\n <raqm-input-group-addon align=\"inline-start\">\r\n <ng-container [ngTemplateOutlet]=\"prefix\" />\r\n </raqm-input-group-addon>\r\n }\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"placeholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"inlineValue()\"\r\n (focus)=\"field.onInlineFocus($event)\"\r\n (pointerdown)=\"field.onInputPointerDown()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n <raqm-input-group-addon align=\"inline-end\">\r\n @if (showClear() && selectedLabel() !== null) {\r\n <button\r\n raqm-button=\"ghost\"\r\n raqm-input-group-button\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-clear\"\r\n [attr.aria-label]=\"clearLabel()\"\r\n [disabled]=\"effectiveDisabled() || !selectionRemovable()\"\r\n (click)=\"field.onClearClick($event)\"\r\n >\r\n <svg\r\n class=\"raqm-combobox-clear-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n </button>\r\n } @else if (showTrigger()) {\r\n <button\r\n raqm-button=\"ghost\"\r\n raqm-input-group-button\r\n type=\"button\"\r\n icon-extra-small\r\n class=\"raqm-combobox-inline-trigger\"\r\n aria-haspopup=\"listbox\"\r\n [attr.aria-label]=\"triggerLabel()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [disabled]=\"effectiveDisabled()\"\r\n (click)=\"field.onTriggerClick()\"\r\n (keydown)=\"keyboard.onTriggerKeydown($event)\"\r\n >\r\n <svg\r\n class=\"raqm-combobox-trigger-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n </button>\r\n }\r\n </raqm-input-group-addon>\r\n </raqm-input-group>\r\n} @else {\r\n <!-- Popup trigger; it never holds focus while the search field does. -->\r\n <button\r\n raqm-button=\"outline\"\r\n #trigger\r\n type=\"button\"\r\n class=\"raqm-combobox-trigger\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n [attr.id]=\"resolvedInputId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"open() ? listboxId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [disabled]=\"effectiveDisabled()\"\r\n (click)=\"field.onTriggerClick()\"\r\n (keydown)=\"keyboard.onTriggerKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n >\r\n <span class=\"raqm-combobox-trigger-value\">{{ selectedLabel() ?? placeholder() }}</span>\r\n <svg\r\n class=\"raqm-combobox-trigger-icon\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n aria-hidden=\"true\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n </button>\r\n}\r\n\r\n<!-- Instantiated into a CDK overlay from this view, so component styles apply. -->\r\n<ng-template #popup>\r\n <div\r\n class=\"raqm-combobox-popup\"\r\n [attr.id]=\"popupId()\"\r\n [attr.dir]=\"overlayDir()\"\r\n [attr.data-raqm-anchor]=\"mode()\"\r\n >\r\n @if (mode() === 'popup') {\r\n <!-- Inner search field; deliberately no inner trigger or clear. -->\r\n <raqm-input-group class=\"raqm-combobox-search\">\r\n <input\r\n raqm-input\r\n type=\"text\"\r\n class=\"raqm-combobox-input raqm-combobox-search-input\"\r\n role=\"combobox\"\r\n aria-haspopup=\"listbox\"\r\n aria-autocomplete=\"list\"\r\n autocomplete=\"off\"\r\n [attr.id]=\"searchId()\"\r\n [attr.aria-expanded]=\"open()\"\r\n [attr.aria-controls]=\"listboxId()\"\r\n [attr.aria-activedescendant]=\"open() ? activeId() : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.aria-describedby]=\"describedBy() ?? null\"\r\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\r\n [attr.placeholder]=\"searchPlaceholder()\"\r\n [disabled]=\"effectiveDisabled()\"\r\n [value]=\"composingValue() ?? query()\"\r\n (input)=\"field.onInput($event)\"\r\n (compositionstart)=\"field.onCompositionStart($event)\"\r\n (compositionend)=\"field.onCompositionEnd($event)\"\r\n (keydown)=\"keyboard.onKeydown($event)\"\r\n (focusout)=\"field.onFocusOut($event)\"\r\n />\r\n <raqm-input-group-addon align=\"inline-end\"></raqm-input-group-addon>\r\n </raqm-input-group>\r\n }\r\n\r\n <!-- No-results message; the list collapses to zero padding while it shows. -->\r\n @if (filteredItems().length === 0 && emptyText(); as emptyMessage) {\r\n <div class=\"raqm-combobox-empty\">{{ emptyMessage }}</div>\r\n }\r\n\r\n <!-- Real listbox; `aria-multiselectable` only in Multiple. -->\r\n <div\r\n class=\"raqm-combobox-list\"\r\n role=\"listbox\"\r\n [attr.id]=\"listboxId()\"\r\n [attr.aria-multiselectable]=\"mode() === 'multiple' ? 'true' : null\"\r\n [attr.aria-labelledby]=\"inputLabelledBy()\"\r\n [attr.data-raqm-empty]=\"filteredItems().length === 0 ? '' : null\"\r\n >\r\n @for (entry of renderEntries(); track $index) {\r\n @if (entry.separatorBefore && !$first) {\r\n <div class=\"raqm-combobox-separator\" role=\"presentation\" aria-hidden=\"true\"></div>\r\n }\r\n @if (entry.label !== null) {\r\n <div role=\"group\" [attr.aria-labelledby]=\"entry.id\">\r\n <div class=\"raqm-combobox-group-label\" [attr.id]=\"entry.id\">{{ entry.label }}</div>\r\n @for (view of entry.options; track view.id) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"option\"\r\n [ngTemplateOutletContext]=\"{ $implicit: view }\"\r\n />\r\n }\r\n </div>\r\n } @else {\r\n @for (view of entry.options; track view.id) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"option\"\r\n [ngTemplateOutletContext]=\"{ $implicit: view }\"\r\n />\r\n }\r\n }\r\n }\r\n </div>\r\n </div>\r\n</ng-template>\r\n\r\n<ng-template #option let-view>\r\n <div\r\n class=\"raqm-combobox-option\"\r\n role=\"option\"\r\n [attr.id]=\"view.id\"\r\n [attr.aria-selected]=\"field.isSelected(view.item) ? 'true' : 'false'\"\r\n [attr.aria-disabled]=\"isOptionDisabled(view.item) ? 'true' : null\"\r\n [attr.aria-label]=\"view.item.label\"\r\n [attr.aria-describedby]=\"view.item.description ? view.id + '-description' : null\"\r\n [class.raqm-combobox-option--active]=\"view.id === activeId()\"\r\n [attr.data-raqm-highlighted]=\"view.id === activeId() ? '' : null\"\r\n (pointerdown)=\"$event.preventDefault()\"\r\n (mousedown)=\"$event.preventDefault()\"\r\n (pointermove)=\"field.onOptionPointerMove(view, $event)\"\r\n (pointerleave)=\"field.onOptionPointerLeave($event)\"\r\n (click)=\"field.onOptionClick(view.item)\"\r\n >\r\n @if (view.item.description) {\r\n <span class=\"raqm-combobox-option-description\" [attr.id]=\"view.id + '-description'\">{{\r\n view.item.description\r\n }}</span>\r\n }\r\n <span class=\"raqm-combobox-option-indicator\" aria-hidden=\"true\">\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n focusable=\"false\"\r\n >\r\n <path d=\"M20 6 9 17l-5-5\" />\r\n </svg>\r\n </span>\r\n <span class=\"raqm-combobox-option-text\">\r\n @if (itemTemplate(); as template) {\r\n <ng-container\r\n [ngTemplateOutlet]=\"template\"\r\n [ngTemplateOutletContext]=\"{\r\n $implicit: view.item,\r\n item: view.item,\r\n selected: field.isSelected(view.item),\r\n active: view.id === activeId(),\r\n }\"\r\n />\r\n } @else {\r\n {{ view.item.label }}\r\n }\r\n </span>\r\n </div>\r\n</ng-template>\r\n",
|
|
1370
|
+
styles: [".raqm-combobox-chips{display:flex;flex-wrap:wrap;align-items:center;gap:calc(var(--raqm-spacing) * 1);min-block-size:calc(var(--raqm-spacing) * 8);inline-size:100%;box-sizing:border-box;border:1px solid var(--raqm-input);border-radius:var(--raqm-radius-lg);background-color:var(--raqm-control-bg);background-clip:padding-box;padding-inline:calc(var(--raqm-spacing) * 2.5);padding-block:calc(var(--raqm-spacing) * 1);font-size:var(--raqm-font-size-sm);color:var(--raqm-foreground);transition:color var(--raqm-duration-base) var(--raqm-ease-standard),background-color var(--raqm-duration-base) var(--raqm-ease-standard),border-color var(--raqm-duration-base) var(--raqm-ease-standard),box-shadow var(--raqm-duration-base) var(--raqm-ease-standard)}.raqm-combobox-chips:has(>.raqm-combobox-chip){padding-inline:calc(var(--raqm-spacing) * 1)}.raqm-combobox-chips:focus-within{border-color:var(--raqm-ring);box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-focus-ring-color)}.raqm-combobox-chips[data-raqm-invalid=true]{border-color:var(--raqm-invalid-border);box-shadow:0 0 0 var(--raqm-focus-ring-width) var(--raqm-invalid-ring)}.raqm-combobox-chips:has(>.raqm-combobox-chip-input:disabled){background-color:var(--raqm-input-disabled-bg);opacity:var(--raqm-disabled-opacity);cursor:not-allowed}.raqm-combobox-chip{display:flex;inline-size:fit-content;align-items:center;justify-content:center;gap:calc(var(--raqm-spacing) * 1);block-size:calc(var(--raqm-spacing) * 5.25);border-radius:var(--raqm-radius-sm);padding-inline:calc(var(--raqm-spacing) * 1.5);background-color:var(--raqm-muted);color:var(--raqm-foreground);font-size:var(--raqm-font-size-xs);font-weight:var(--raqm-font-weight-medium);white-space:nowrap}.raqm-combobox-chip:has(>.raqm-combobox-chip-remove){padding-inline-end:0}.raqm-combobox-chip-label{pointer-events:none}.raqm-combobox-chip-input{flex:1 1 auto;min-inline-size:calc(var(--raqm-spacing) * 16);inline-size:auto;block-size:auto;align-self:center;border:0;border-radius:0;background-color:transparent;box-shadow:none;padding:0;font-size:var(--raqm-font-size-sm);color:var(--raqm-foreground)}.raqm-combobox-chip-input:focus-visible{border-color:transparent;box-shadow:none}.raqm-combobox-chip-input::placeholder{color:var(--raqm-muted-foreground)}.raqm-combobox-trigger{inline-size:calc(var(--raqm-spacing) * 64);justify-content:space-between;font-weight:var(--raqm-font-weight-normal)}.raqm-combobox-trigger-value{display:flex;flex:1 1 auto;text-align:start;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.raqm-combobox-inline{inline-size:auto;max-inline-size:100%}.raqm-button.raqm-combobox-inline-trigger[data-raqm-size],.raqm-button.raqm-combobox-clear[data-raqm-size]{inline-size:calc(var(--raqm-spacing) * 6);padding-inline:0}.raqm-combobox-trigger-icon{color:var(--raqm-muted-foreground)}.raqm-combobox-popup{box-sizing:border-box;position:relative;inline-size:100%;max-block-size:min(var(--raqm-spacing) * 72,var(--raqm-combobox-available-height, 100vh));min-inline-size:calc(var(--raqm-spacing) * 36);overflow:hidden;border-radius:var(--raqm-radius-lg);background-color:color-mix(in oklch,var(--raqm-popover) 70%,transparent);color:var(--raqm-popover-foreground);box-shadow:var(--raqm-shadow-md),0 0 0 1px color-mix(in oklch,var(--raqm-foreground) 10%,transparent);transition-duration:var(--raqm-duration-fast)}.raqm-combobox-popup:before{content:\"\";position:absolute;inset:0;z-index:-1;border-radius:inherit;pointer-events:none;backdrop-filter:blur(40px) saturate(150%);-webkit-backdrop-filter:blur(40px) saturate(150%)}.raqm-combobox-search{inline-size:auto;margin:var(--raqm-spacing);margin-block-end:0;block-size:calc(var(--raqm-spacing) * 8);box-shadow:none;background-color:color-mix(in oklch,var(--raqm-input) 30%,transparent);border-color:color-mix(in oklch,var(--raqm-input) 30%,transparent)}.raqm-combobox-list{max-block-size:min(var(--raqm-spacing) * 72 - var(--raqm-spacing) * 9,var(--raqm-combobox-available-height, 100vh) - var(--raqm-spacing) * 9);scroll-padding-block:var(--raqm-spacing);overflow-y:auto;overscroll-behavior:contain;padding:var(--raqm-spacing);scrollbar-width:none}.raqm-combobox-list::-webkit-scrollbar{display:none}.raqm-combobox-list[data-raqm-empty]{padding:0}.raqm-combobox-group-label{padding-inline:calc(var(--raqm-spacing) * 2);padding-block:calc(var(--raqm-spacing) * 1.5);font-size:var(--raqm-font-size-xs);color:var(--raqm-muted-foreground)}.raqm-combobox-separator{background-color:var(--raqm-border);block-size:1px;margin-inline:calc(var(--raqm-spacing) * -1);margin-block:var(--raqm-spacing)}.raqm-combobox-option-description{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.raqm-combobox-option{position:relative;display:flex;inline-size:100%;align-items:center;cursor:default;outline:none;-webkit-user-select:none;user-select:none;box-sizing:border-box;gap:calc(var(--raqm-spacing) * 2);border-radius:var(--raqm-radius-md);padding-block:var(--raqm-spacing);padding-inline-start:calc(var(--raqm-spacing) * 1.5);padding-inline-end:calc(var(--raqm-spacing) * 8);font-size:var(--raqm-font-size-sm);line-height:calc(var(--raqm-spacing) * 5)}.raqm-combobox-option[aria-disabled=true]{pointer-events:none;opacity:var(--raqm-disabled-opacity)}.raqm-combobox-option--active,.raqm-combobox-option[data-raqm-highlighted]{background-color:var(--raqm-accent);color:var(--raqm-accent-foreground)}.raqm-combobox-option-indicator{position:absolute;inset-inline-end:calc(var(--raqm-spacing) * 2);display:flex;inline-size:calc(var(--raqm-spacing) * 4);block-size:calc(var(--raqm-spacing) * 4);align-items:center;justify-content:center;pointer-events:none;visibility:hidden}.raqm-combobox-option[aria-selected=true] .raqm-combobox-option-indicator{visibility:visible}.raqm-combobox-option-indicator svg{inline-size:100%;block-size:100%}.raqm-combobox-option-text{display:flex;flex:1 1 auto;gap:calc(var(--raqm-spacing) * 2)}.raqm-combobox-empty{display:flex;inline-size:100%;justify-content:center;padding-block:calc(var(--raqm-spacing) * 2);text-align:center;font-size:var(--raqm-font-size-sm);color:var(--raqm-muted-foreground)}:host{display:inline-block;max-inline-size:100%}.raqm-combobox-label{display:block;margin-block-end:calc(var(--raqm-spacing) * 1.5);font-size:var(--raqm-font-size-sm);font-weight:var(--raqm-font-weight-medium);color:var(--raqm-foreground)}\n"]
|
|
1371
|
+
}]
|
|
1372
|
+
}],
|
|
1373
|
+
ctorParameters: () => [],
|
|
1374
|
+
propDecorators: {
|
|
1375
|
+
popupTemplate: [{
|
|
1376
|
+
type: i0.ViewChild,
|
|
1377
|
+
args: ["popup", {
|
|
1378
|
+
read: TemplateRef,
|
|
1379
|
+
isSignal: true
|
|
1380
|
+
}]
|
|
1381
|
+
}],
|
|
1382
|
+
itemTemplateDirective: [{
|
|
1383
|
+
type: i0.ContentChild,
|
|
1384
|
+
args: [i0.forwardRef(() => RaqmComboboxItemDirective), { isSignal: true }]
|
|
1385
|
+
}],
|
|
1386
|
+
inlinePrefixDirective: [{
|
|
1387
|
+
type: i0.ContentChild,
|
|
1388
|
+
args: [i0.forwardRef(() => RaqmComboboxPrefixDirective), { isSignal: true }]
|
|
1389
|
+
}],
|
|
1390
|
+
chipsRef: [{
|
|
1391
|
+
type: i0.ViewChild,
|
|
1392
|
+
args: ["chips", { isSignal: true }]
|
|
1393
|
+
}],
|
|
1394
|
+
triggerRef: [{
|
|
1395
|
+
type: i0.ViewChild,
|
|
1396
|
+
args: ["trigger", {
|
|
1397
|
+
read: ElementRef,
|
|
1398
|
+
isSignal: true
|
|
1399
|
+
}]
|
|
1400
|
+
}],
|
|
1401
|
+
inlineGroupRef: [{
|
|
1402
|
+
type: i0.ViewChild,
|
|
1403
|
+
args: ["inlineGroup", {
|
|
1404
|
+
read: ElementRef,
|
|
1405
|
+
isSignal: true
|
|
1406
|
+
}]
|
|
1407
|
+
}],
|
|
1408
|
+
mode: [{
|
|
1409
|
+
type: i0.Input,
|
|
1410
|
+
args: [{
|
|
1411
|
+
isSignal: true,
|
|
1412
|
+
alias: "mode",
|
|
1413
|
+
required: false
|
|
1414
|
+
}]
|
|
1415
|
+
}],
|
|
1416
|
+
items: [{
|
|
1417
|
+
type: i0.Input,
|
|
1418
|
+
args: [{
|
|
1419
|
+
isSignal: true,
|
|
1420
|
+
alias: "items",
|
|
1421
|
+
required: true
|
|
1422
|
+
}]
|
|
1423
|
+
}],
|
|
1424
|
+
popupWidth: [{
|
|
1425
|
+
type: i0.Input,
|
|
1426
|
+
args: [{
|
|
1427
|
+
isSignal: true,
|
|
1428
|
+
alias: "popupWidth",
|
|
1429
|
+
required: false
|
|
1430
|
+
}]
|
|
1431
|
+
}],
|
|
1432
|
+
popupAlignOffset: [{
|
|
1433
|
+
type: i0.Input,
|
|
1434
|
+
args: [{
|
|
1435
|
+
isSignal: true,
|
|
1436
|
+
alias: "popupAlignOffset",
|
|
1437
|
+
required: false
|
|
1438
|
+
}]
|
|
1439
|
+
}],
|
|
1440
|
+
value: [{
|
|
1441
|
+
type: i0.Input,
|
|
1442
|
+
args: [{
|
|
1443
|
+
isSignal: true,
|
|
1444
|
+
alias: "value",
|
|
1445
|
+
required: false
|
|
1446
|
+
}]
|
|
1447
|
+
}],
|
|
1448
|
+
valueChange: [{
|
|
1449
|
+
type: i0.Output,
|
|
1450
|
+
args: ["valueChange"]
|
|
1451
|
+
}],
|
|
1452
|
+
disabled: [{
|
|
1453
|
+
type: i0.Input,
|
|
1454
|
+
args: [{
|
|
1455
|
+
isSignal: true,
|
|
1456
|
+
alias: "disabled",
|
|
1457
|
+
required: false
|
|
1458
|
+
}]
|
|
1459
|
+
}],
|
|
1460
|
+
invalid: [{
|
|
1461
|
+
type: i0.Input,
|
|
1462
|
+
args: [{
|
|
1463
|
+
isSignal: true,
|
|
1464
|
+
alias: "invalid",
|
|
1465
|
+
required: false
|
|
1466
|
+
}]
|
|
1467
|
+
}],
|
|
1468
|
+
inputId: [{
|
|
1469
|
+
type: i0.Input,
|
|
1470
|
+
args: [{
|
|
1471
|
+
isSignal: true,
|
|
1472
|
+
alias: "inputId",
|
|
1473
|
+
required: false
|
|
1474
|
+
}]
|
|
1475
|
+
}],
|
|
1476
|
+
label: [{
|
|
1477
|
+
type: i0.Input,
|
|
1478
|
+
args: [{
|
|
1479
|
+
isSignal: true,
|
|
1480
|
+
alias: "label",
|
|
1481
|
+
required: false
|
|
1482
|
+
}]
|
|
1483
|
+
}],
|
|
1484
|
+
labelledBy: [{
|
|
1485
|
+
type: i0.Input,
|
|
1486
|
+
args: [{
|
|
1487
|
+
isSignal: true,
|
|
1488
|
+
alias: "labelledBy",
|
|
1489
|
+
required: false
|
|
1490
|
+
}]
|
|
1491
|
+
}],
|
|
1492
|
+
describedBy: [{
|
|
1493
|
+
type: i0.Input,
|
|
1494
|
+
args: [{
|
|
1495
|
+
isSignal: true,
|
|
1496
|
+
alias: "describedBy",
|
|
1497
|
+
required: false
|
|
1498
|
+
}]
|
|
1499
|
+
}],
|
|
1500
|
+
placeholder: [{
|
|
1501
|
+
type: i0.Input,
|
|
1502
|
+
args: [{
|
|
1503
|
+
isSignal: true,
|
|
1504
|
+
alias: "placeholder",
|
|
1505
|
+
required: false
|
|
1506
|
+
}]
|
|
1507
|
+
}],
|
|
1508
|
+
searchPlaceholder: [{
|
|
1509
|
+
type: i0.Input,
|
|
1510
|
+
args: [{
|
|
1511
|
+
isSignal: true,
|
|
1512
|
+
alias: "searchPlaceholder",
|
|
1513
|
+
required: false
|
|
1514
|
+
}]
|
|
1515
|
+
}],
|
|
1516
|
+
emptyText: [{
|
|
1517
|
+
type: i0.Input,
|
|
1518
|
+
args: [{
|
|
1519
|
+
isSignal: true,
|
|
1520
|
+
alias: "emptyText",
|
|
1521
|
+
required: false
|
|
1522
|
+
}]
|
|
1523
|
+
}],
|
|
1524
|
+
removeLabel: [{
|
|
1525
|
+
type: i0.Input,
|
|
1526
|
+
args: [{
|
|
1527
|
+
isSignal: true,
|
|
1528
|
+
alias: "removeLabel",
|
|
1529
|
+
required: false
|
|
1530
|
+
}]
|
|
1531
|
+
}],
|
|
1532
|
+
dir: [{
|
|
1533
|
+
type: i0.Input,
|
|
1534
|
+
args: [{
|
|
1535
|
+
isSignal: true,
|
|
1536
|
+
alias: "dir",
|
|
1537
|
+
required: false
|
|
1538
|
+
}]
|
|
1539
|
+
}],
|
|
1540
|
+
autoHighlight: [{
|
|
1541
|
+
type: i0.Input,
|
|
1542
|
+
args: [{
|
|
1543
|
+
isSignal: true,
|
|
1544
|
+
alias: "autoHighlight",
|
|
1545
|
+
required: false
|
|
1546
|
+
}]
|
|
1547
|
+
}],
|
|
1548
|
+
showTrigger: [{
|
|
1549
|
+
type: i0.Input,
|
|
1550
|
+
args: [{
|
|
1551
|
+
isSignal: true,
|
|
1552
|
+
alias: "showTrigger",
|
|
1553
|
+
required: false
|
|
1554
|
+
}]
|
|
1555
|
+
}],
|
|
1556
|
+
showClear: [{
|
|
1557
|
+
type: i0.Input,
|
|
1558
|
+
args: [{
|
|
1559
|
+
isSignal: true,
|
|
1560
|
+
alias: "showClear",
|
|
1561
|
+
required: false
|
|
1562
|
+
}]
|
|
1563
|
+
}],
|
|
1564
|
+
clearLabel: [{
|
|
1565
|
+
type: i0.Input,
|
|
1566
|
+
args: [{
|
|
1567
|
+
isSignal: true,
|
|
1568
|
+
alias: "clearLabel",
|
|
1569
|
+
required: false
|
|
1570
|
+
}]
|
|
1571
|
+
}],
|
|
1572
|
+
triggerLabel: [{
|
|
1573
|
+
type: i0.Input,
|
|
1574
|
+
args: [{
|
|
1575
|
+
isSignal: true,
|
|
1576
|
+
alias: "triggerLabel",
|
|
1577
|
+
required: false
|
|
1578
|
+
}]
|
|
1579
|
+
}]
|
|
1580
|
+
}
|
|
1581
|
+
});
|
|
1582
|
+
export { RaqmCombobox, RaqmComboboxItemDirective, RaqmComboboxPrefixDirective };
|
|
1583
|
+
|
|
1584
|
+
//# sourceMappingURL=raqm-ui-combobox.mjs.map
|