@ngb-bootstrap/core 0.0.0 → 0.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +18 -0
- package/README.md +26 -0
- package/fesm2022/ngb-bootstrap-core-alert.mjs +154 -0
- package/fesm2022/ngb-bootstrap-core-alert.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-badge.mjs +100 -0
- package/fesm2022/ngb-bootstrap-core-badge.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-breadcrumb.mjs +135 -0
- package/fesm2022/ngb-bootstrap-core-breadcrumb.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-button.mjs +513 -0
- package/fesm2022/ngb-bootstrap-core-button.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-card.mjs +540 -0
- package/fesm2022/ngb-bootstrap-core-card.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-cdk.mjs +282 -0
- package/fesm2022/ngb-bootstrap-core-cdk.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-checkbox.mjs +165 -0
- package/fesm2022/ngb-bootstrap-core-checkbox.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-chips.mjs +512 -0
- package/fesm2022/ngb-bootstrap-core-chips.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-floating-label.mjs +83 -0
- package/fesm2022/ngb-bootstrap-core-floating-label.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-footer.mjs +48 -0
- package/fesm2022/ngb-bootstrap-core-footer.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-icon.mjs +243 -0
- package/fesm2022/ngb-bootstrap-core-icon.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-input.mjs +540 -0
- package/fesm2022/ngb-bootstrap-core-input.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-layout.mjs +272 -0
- package/fesm2022/ngb-bootstrap-core-layout.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-navbar.mjs +150 -0
- package/fesm2022/ngb-bootstrap-core-navbar.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-radio.mjs +279 -0
- package/fesm2022/ngb-bootstrap-core-radio.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-sidebar.mjs +425 -0
- package/fesm2022/ngb-bootstrap-core-sidebar.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-spinner.mjs +126 -0
- package/fesm2022/ngb-bootstrap-core-spinner.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core-switch.mjs +147 -0
- package/fesm2022/ngb-bootstrap-core-switch.mjs.map +1 -0
- package/fesm2022/ngb-bootstrap-core.mjs +69 -0
- package/fesm2022/ngb-bootstrap-core.mjs.map +1 -0
- package/ngb-bootstrap.css +827 -0
- package/package.json +118 -4
- package/styles/_breadcrumb.scss +9 -0
- package/styles/_button.scss +14 -0
- package/styles/_card.scss +86 -0
- package/styles/_chip.scss +10 -0
- package/styles/_choice.scss +14 -0
- package/styles/_contrast.scss +23 -0
- package/styles/_icon.scss +62 -0
- package/styles/_index.scss +33 -0
- package/styles/_input.scss +9 -0
- package/styles/_layout.scss +602 -0
- package/styles/_overlay.scss +14 -0
- package/styles/_tokens.scss +29 -0
- package/styles/_typography.scss +77 -0
- package/styles/ngb-bootstrap.scss +2 -0
- package/types/ngb-bootstrap-core-alert.d.ts +65 -0
- package/types/ngb-bootstrap-core-badge.d.ts +38 -0
- package/types/ngb-bootstrap-core-breadcrumb.d.ts +32 -0
- package/types/ngb-bootstrap-core-button.d.ts +177 -0
- package/types/ngb-bootstrap-core-card.d.ts +154 -0
- package/types/ngb-bootstrap-core-cdk.d.ts +165 -0
- package/types/ngb-bootstrap-core-checkbox.d.ts +53 -0
- package/types/ngb-bootstrap-core-chips.d.ts +170 -0
- package/types/ngb-bootstrap-core-floating-label.d.ts +22 -0
- package/types/ngb-bootstrap-core-footer.d.ts +16 -0
- package/types/ngb-bootstrap-core-icon.d.ts +99 -0
- package/types/ngb-bootstrap-core-input.d.ts +208 -0
- package/types/ngb-bootstrap-core-layout.d.ts +102 -0
- package/types/ngb-bootstrap-core-navbar.d.ts +33 -0
- package/types/ngb-bootstrap-core-radio.d.ts +96 -0
- package/types/ngb-bootstrap-core-sidebar.d.ts +62 -0
- package/types/ngb-bootstrap-core-spinner.d.ts +49 -0
- package/types/ngb-bootstrap-core-switch.d.ts +44 -0
- package/types/ngb-bootstrap-core.d.ts +82 -0
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, InjectionToken, Injector, booleanAttribute, computed, contentChildren, inject, input, model, output, signal, viewChild } from "@angular/core";
|
|
3
|
+
import { NGB_I18N } from "@ngb-bootstrap/core";
|
|
4
|
+
import { NgbIcon } from "@ngb-bootstrap/core/icon";
|
|
5
|
+
import { ngbIconClose } from "@ngb-bootstrap/icons";
|
|
6
|
+
import { FocusKeyManager } from "@angular/cdk/a11y";
|
|
7
|
+
import { Directionality } from "@angular/cdk/bidi";
|
|
8
|
+
import { NgbValueAccessor, provideNgbValueAccessor } from "@ngb-bootstrap/core/cdk";
|
|
9
|
+
const NGB_CHIP_GROUP = new InjectionToken("NGB_CHIP_GROUP");
|
|
10
|
+
var NgbChip = class NgbChip {
|
|
11
|
+
el = inject(ElementRef);
|
|
12
|
+
i18n = inject(NGB_I18N);
|
|
13
|
+
group = inject(NGB_CHIP_GROUP, { optional: true });
|
|
14
|
+
dismiss = viewChild("dismiss", ...ngDevMode ? [{ debugName: "dismiss" }] : /* istanbul ignore next */ []);
|
|
15
|
+
closeIcon = ngbIconClose;
|
|
16
|
+
color = input(...ngDevMode ? [void 0, { debugName: "color" }] : /* istanbul ignore next */ []);
|
|
17
|
+
icon = input(...ngDevMode ? [void 0, { debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
18
|
+
selectable = input(false, {
|
|
19
|
+
...ngDevMode ? { debugName: "selectable" } : /* istanbul ignore next */ {},
|
|
20
|
+
transform: booleanAttribute
|
|
21
|
+
});
|
|
22
|
+
selected = model(false, ...ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []);
|
|
23
|
+
value = input(...ngDevMode ? [void 0, { debugName: "value" }] : /* istanbul ignore next */ []);
|
|
24
|
+
removable = input(false, {
|
|
25
|
+
...ngDevMode ? { debugName: "removable" } : /* istanbul ignore next */ {},
|
|
26
|
+
transform: booleanAttribute
|
|
27
|
+
});
|
|
28
|
+
disabled = input(false, {
|
|
29
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
30
|
+
transform: booleanAttribute
|
|
31
|
+
});
|
|
32
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
33
|
+
removed = output();
|
|
34
|
+
isDisabled = computed(() => this.disabled() || (this.group?.isDisabled() ?? false), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
35
|
+
isSelected = computed(() => this.group ? this.group.isSelected(this.value()) : this.selected(), ...ngDevMode ? [{ debugName: "isSelected" }] : /* istanbul ignore next */ []);
|
|
36
|
+
classes = computed(() => {
|
|
37
|
+
const classes = ["chip"];
|
|
38
|
+
const color = this.color();
|
|
39
|
+
if (color) classes.push(`theme-${color}`);
|
|
40
|
+
if (this.selectable() && this.isSelected()) classes.push("active");
|
|
41
|
+
if (this.isDisabled()) classes.push("disabled");
|
|
42
|
+
return classes.join(" ");
|
|
43
|
+
}, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
|
|
44
|
+
tabIndex = computed(() => {
|
|
45
|
+
if (!this.selectable() || this.isDisabled()) return null;
|
|
46
|
+
return this.group && !this.group.isTabbable(this) ? -1 : 0;
|
|
47
|
+
}, ...ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []);
|
|
48
|
+
removeLabel() {
|
|
49
|
+
return this.i18n.chip.remove.replace("{label}", this.label() ?? this.textLabel());
|
|
50
|
+
}
|
|
51
|
+
textLabel() {
|
|
52
|
+
const clone = this.el.nativeElement.cloneNode(true);
|
|
53
|
+
clone.querySelectorAll(".chip-dismiss").forEach((node) => node.remove());
|
|
54
|
+
return (clone.textContent ?? "").trim().replace(/\s+/g, " ");
|
|
55
|
+
}
|
|
56
|
+
focus() {
|
|
57
|
+
(this.selectable() ? this.el.nativeElement : this.dismiss()?.nativeElement)?.focus();
|
|
58
|
+
}
|
|
59
|
+
onClick() {
|
|
60
|
+
if (this.selectable()) this.toggle();
|
|
61
|
+
}
|
|
62
|
+
onKeydown(event) {
|
|
63
|
+
this.group?.activate(this);
|
|
64
|
+
if (event.target !== this.el.nativeElement || !this.selectable()) return;
|
|
65
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
this.toggle();
|
|
68
|
+
} else if ((event.key === "Delete" || event.key === "Backspace") && this.removable()) {
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
this.remove();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
onDismiss(event) {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
this.remove();
|
|
76
|
+
}
|
|
77
|
+
toggle() {
|
|
78
|
+
if (this.isDisabled()) return;
|
|
79
|
+
if (this.group) this.group.toggle(this.value());
|
|
80
|
+
else this.selected.update((selected) => !selected);
|
|
81
|
+
}
|
|
82
|
+
remove() {
|
|
83
|
+
if (this.isDisabled()) return;
|
|
84
|
+
this.moveFocusToNeighbour();
|
|
85
|
+
this.removed.emit();
|
|
86
|
+
}
|
|
87
|
+
moveFocusToNeighbour() {
|
|
88
|
+
const host = this.el.nativeElement;
|
|
89
|
+
if (!host.contains(host.ownerDocument.activeElement)) return;
|
|
90
|
+
for (let node = host; node && node !== host.ownerDocument.body;) {
|
|
91
|
+
for (const sibling of [node.nextElementSibling, node.previousElementSibling]) {
|
|
92
|
+
const chip = sibling?.matches("ngb-chip") ? sibling : sibling?.querySelector("ngb-chip");
|
|
93
|
+
if (chip?.closest("ngb-chip-group") !== host.closest("ngb-chip-group")) continue;
|
|
94
|
+
const target = chip?.matches("[role=button]:not([aria-disabled])") ? chip : chip?.querySelector(".chip-dismiss:not(:disabled)");
|
|
95
|
+
if (target instanceof HTMLElement) {
|
|
96
|
+
target.focus();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
node = node === host ? host.parentElement : null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
104
|
+
minVersion: "12.0.0",
|
|
105
|
+
version: "22.2.3",
|
|
106
|
+
ngImport: i0,
|
|
107
|
+
type: NgbChip,
|
|
108
|
+
deps: [],
|
|
109
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
110
|
+
});
|
|
111
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
112
|
+
minVersion: "17.0.0",
|
|
113
|
+
version: "22.2.3",
|
|
114
|
+
type: NgbChip,
|
|
115
|
+
isStandalone: true,
|
|
116
|
+
selector: "ngb-chip",
|
|
117
|
+
inputs: {
|
|
118
|
+
color: {
|
|
119
|
+
classPropertyName: "color",
|
|
120
|
+
publicName: "color",
|
|
121
|
+
isSignal: true,
|
|
122
|
+
isRequired: false,
|
|
123
|
+
transformFunction: null
|
|
124
|
+
},
|
|
125
|
+
icon: {
|
|
126
|
+
classPropertyName: "icon",
|
|
127
|
+
publicName: "icon",
|
|
128
|
+
isSignal: true,
|
|
129
|
+
isRequired: false,
|
|
130
|
+
transformFunction: null
|
|
131
|
+
},
|
|
132
|
+
selectable: {
|
|
133
|
+
classPropertyName: "selectable",
|
|
134
|
+
publicName: "selectable",
|
|
135
|
+
isSignal: true,
|
|
136
|
+
isRequired: false,
|
|
137
|
+
transformFunction: null
|
|
138
|
+
},
|
|
139
|
+
selected: {
|
|
140
|
+
classPropertyName: "selected",
|
|
141
|
+
publicName: "selected",
|
|
142
|
+
isSignal: true,
|
|
143
|
+
isRequired: false,
|
|
144
|
+
transformFunction: null
|
|
145
|
+
},
|
|
146
|
+
value: {
|
|
147
|
+
classPropertyName: "value",
|
|
148
|
+
publicName: "value",
|
|
149
|
+
isSignal: true,
|
|
150
|
+
isRequired: false,
|
|
151
|
+
transformFunction: null
|
|
152
|
+
},
|
|
153
|
+
removable: {
|
|
154
|
+
classPropertyName: "removable",
|
|
155
|
+
publicName: "removable",
|
|
156
|
+
isSignal: true,
|
|
157
|
+
isRequired: false,
|
|
158
|
+
transformFunction: null
|
|
159
|
+
},
|
|
160
|
+
disabled: {
|
|
161
|
+
classPropertyName: "disabled",
|
|
162
|
+
publicName: "disabled",
|
|
163
|
+
isSignal: true,
|
|
164
|
+
isRequired: false,
|
|
165
|
+
transformFunction: null
|
|
166
|
+
},
|
|
167
|
+
label: {
|
|
168
|
+
classPropertyName: "label",
|
|
169
|
+
publicName: "label",
|
|
170
|
+
isSignal: true,
|
|
171
|
+
isRequired: false,
|
|
172
|
+
transformFunction: null
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
outputs: {
|
|
176
|
+
selected: "selectedChange",
|
|
177
|
+
removed: "removed"
|
|
178
|
+
},
|
|
179
|
+
host: {
|
|
180
|
+
listeners: {
|
|
181
|
+
"click": "onClick()",
|
|
182
|
+
"keydown": "onKeydown($event)",
|
|
183
|
+
"focus": "group?.activate(this)"
|
|
184
|
+
},
|
|
185
|
+
properties: {
|
|
186
|
+
"class": "classes()",
|
|
187
|
+
"attr.role": "selectable() ? \"button\" : null",
|
|
188
|
+
"attr.aria-pressed": "selectable() ? isSelected() : null",
|
|
189
|
+
"attr.aria-disabled": "selectable() && isDisabled() ? \"true\" : null",
|
|
190
|
+
"attr.tabindex": "tabIndex()"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
viewQueries: [{
|
|
194
|
+
propertyName: "dismiss",
|
|
195
|
+
first: true,
|
|
196
|
+
predicate: ["dismiss"],
|
|
197
|
+
descendants: true,
|
|
198
|
+
isSignal: true
|
|
199
|
+
}],
|
|
200
|
+
ngImport: i0,
|
|
201
|
+
template: `
|
|
202
|
+
@if (icon(); as icon) {
|
|
203
|
+
<ngb-icon class="chip-icon" [icon]="icon" />
|
|
204
|
+
}
|
|
205
|
+
<ng-content />
|
|
206
|
+
@if (removable()) {
|
|
207
|
+
<button
|
|
208
|
+
#dismiss
|
|
209
|
+
type="button"
|
|
210
|
+
class="chip-dismiss"
|
|
211
|
+
[disabled]="isDisabled()"
|
|
212
|
+
[attr.tabindex]="selectable() ? -1 : null"
|
|
213
|
+
[attr.aria-hidden]="selectable() ? 'true' : null"
|
|
214
|
+
[attr.aria-label]="removeLabel()"
|
|
215
|
+
(click)="onDismiss($event)"
|
|
216
|
+
>
|
|
217
|
+
<ngb-icon [icon]="closeIcon" size="1rem" />
|
|
218
|
+
</button>
|
|
219
|
+
}
|
|
220
|
+
`,
|
|
221
|
+
isInline: true,
|
|
222
|
+
dependencies: [{
|
|
223
|
+
kind: "component",
|
|
224
|
+
type: NgbIcon,
|
|
225
|
+
selector: "ngb-icon",
|
|
226
|
+
inputs: [
|
|
227
|
+
"name",
|
|
228
|
+
"icon",
|
|
229
|
+
"theme",
|
|
230
|
+
"size",
|
|
231
|
+
"strokeWidth",
|
|
232
|
+
"label"
|
|
233
|
+
]
|
|
234
|
+
}],
|
|
235
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
236
|
+
});
|
|
237
|
+
};
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
239
|
+
minVersion: "12.0.0",
|
|
240
|
+
version: "22.2.3",
|
|
241
|
+
ngImport: i0,
|
|
242
|
+
type: NgbChip,
|
|
243
|
+
decorators: [{
|
|
244
|
+
type: Component,
|
|
245
|
+
args: [{
|
|
246
|
+
selector: "ngb-chip",
|
|
247
|
+
imports: [NgbIcon],
|
|
248
|
+
template: `
|
|
249
|
+
@if (icon(); as icon) {
|
|
250
|
+
<ngb-icon class="chip-icon" [icon]="icon" />
|
|
251
|
+
}
|
|
252
|
+
<ng-content />
|
|
253
|
+
@if (removable()) {
|
|
254
|
+
<button
|
|
255
|
+
#dismiss
|
|
256
|
+
type="button"
|
|
257
|
+
class="chip-dismiss"
|
|
258
|
+
[disabled]="isDisabled()"
|
|
259
|
+
[attr.tabindex]="selectable() ? -1 : null"
|
|
260
|
+
[attr.aria-hidden]="selectable() ? 'true' : null"
|
|
261
|
+
[attr.aria-label]="removeLabel()"
|
|
262
|
+
(click)="onDismiss($event)"
|
|
263
|
+
>
|
|
264
|
+
<ngb-icon [icon]="closeIcon" size="1rem" />
|
|
265
|
+
</button>
|
|
266
|
+
}
|
|
267
|
+
`,
|
|
268
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
269
|
+
host: {
|
|
270
|
+
"[class]": "classes()",
|
|
271
|
+
"[attr.role]": "selectable() ? \"button\" : null",
|
|
272
|
+
"[attr.aria-pressed]": "selectable() ? isSelected() : null",
|
|
273
|
+
"[attr.aria-disabled]": "selectable() && isDisabled() ? \"true\" : null",
|
|
274
|
+
"[attr.tabindex]": "tabIndex()",
|
|
275
|
+
"(click)": "onClick()",
|
|
276
|
+
"(keydown)": "onKeydown($event)",
|
|
277
|
+
"(focus)": "group?.activate(this)"
|
|
278
|
+
}
|
|
279
|
+
}]
|
|
280
|
+
}],
|
|
281
|
+
propDecorators: {
|
|
282
|
+
dismiss: [{
|
|
283
|
+
type: i0.ViewChild,
|
|
284
|
+
args: ["dismiss", { isSignal: true }]
|
|
285
|
+
}],
|
|
286
|
+
color: [{
|
|
287
|
+
type: i0.Input,
|
|
288
|
+
args: [{
|
|
289
|
+
isSignal: true,
|
|
290
|
+
alias: "color",
|
|
291
|
+
required: false
|
|
292
|
+
}]
|
|
293
|
+
}],
|
|
294
|
+
icon: [{
|
|
295
|
+
type: i0.Input,
|
|
296
|
+
args: [{
|
|
297
|
+
isSignal: true,
|
|
298
|
+
alias: "icon",
|
|
299
|
+
required: false
|
|
300
|
+
}]
|
|
301
|
+
}],
|
|
302
|
+
selectable: [{
|
|
303
|
+
type: i0.Input,
|
|
304
|
+
args: [{
|
|
305
|
+
isSignal: true,
|
|
306
|
+
alias: "selectable",
|
|
307
|
+
required: false
|
|
308
|
+
}]
|
|
309
|
+
}],
|
|
310
|
+
selected: [{
|
|
311
|
+
type: i0.Input,
|
|
312
|
+
args: [{
|
|
313
|
+
isSignal: true,
|
|
314
|
+
alias: "selected",
|
|
315
|
+
required: false
|
|
316
|
+
}]
|
|
317
|
+
}, {
|
|
318
|
+
type: i0.Output,
|
|
319
|
+
args: ["selectedChange"]
|
|
320
|
+
}],
|
|
321
|
+
value: [{
|
|
322
|
+
type: i0.Input,
|
|
323
|
+
args: [{
|
|
324
|
+
isSignal: true,
|
|
325
|
+
alias: "value",
|
|
326
|
+
required: false
|
|
327
|
+
}]
|
|
328
|
+
}],
|
|
329
|
+
removable: [{
|
|
330
|
+
type: i0.Input,
|
|
331
|
+
args: [{
|
|
332
|
+
isSignal: true,
|
|
333
|
+
alias: "removable",
|
|
334
|
+
required: false
|
|
335
|
+
}]
|
|
336
|
+
}],
|
|
337
|
+
disabled: [{
|
|
338
|
+
type: i0.Input,
|
|
339
|
+
args: [{
|
|
340
|
+
isSignal: true,
|
|
341
|
+
alias: "disabled",
|
|
342
|
+
required: false
|
|
343
|
+
}]
|
|
344
|
+
}],
|
|
345
|
+
label: [{
|
|
346
|
+
type: i0.Input,
|
|
347
|
+
args: [{
|
|
348
|
+
isSignal: true,
|
|
349
|
+
alias: "label",
|
|
350
|
+
required: false
|
|
351
|
+
}]
|
|
352
|
+
}],
|
|
353
|
+
removed: [{
|
|
354
|
+
type: i0.Output,
|
|
355
|
+
args: ["removed"]
|
|
356
|
+
}]
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
var NgbChipGroup = class NgbChipGroup extends NgbValueAccessor {
|
|
360
|
+
label = input(...ngDevMode ? [void 0, { debugName: "label" }] : /* istanbul ignore next */ []);
|
|
361
|
+
multiple = input(false, {
|
|
362
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
363
|
+
transform: booleanAttribute
|
|
364
|
+
});
|
|
365
|
+
chips = contentChildren(NgbChip, {
|
|
366
|
+
...ngDevMode ? { debugName: "chips" } : /* istanbul ignore next */ {},
|
|
367
|
+
descendants: true
|
|
368
|
+
});
|
|
369
|
+
options = /* @__PURE__ */ new WeakMap();
|
|
370
|
+
focusable = computed(() => this.chips().filter((chip) => chip.selectable() && !chip.isDisabled()), ...ngDevMode ? [{ debugName: "focusable" }] : /* istanbul ignore next */ []);
|
|
371
|
+
focusableOptions = computed(() => this.focusable().map((c) => this.option(c)), ...ngDevMode ? [{ debugName: "focusableOptions" }] : /* istanbul ignore next */ []);
|
|
372
|
+
active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
373
|
+
keyManager = new FocusKeyManager(this.focusableOptions, inject(Injector)).withWrap().withHomeAndEnd().withHorizontalOrientation(inject(Directionality).value);
|
|
374
|
+
tabbable = computed(() => {
|
|
375
|
+
const chips = this.focusable();
|
|
376
|
+
const active = this.active();
|
|
377
|
+
return (active && chips.includes(active) ? active : null) ?? chips.find((chip) => this.isSelected(chip.value())) ?? chips[0] ?? null;
|
|
378
|
+
}, ...ngDevMode ? [{ debugName: "tabbable" }] : /* istanbul ignore next */ []);
|
|
379
|
+
isSelected(value) {
|
|
380
|
+
const current = this.value();
|
|
381
|
+
return this.multiple() ? Array.isArray(current) && current.includes(value) : current !== null && current === value;
|
|
382
|
+
}
|
|
383
|
+
toggle(value) {
|
|
384
|
+
if (!this.multiple()) {
|
|
385
|
+
this.setValue(this.isSelected(value) ? null : value);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const current = this.value();
|
|
389
|
+
const list = Array.isArray(current) ? current : [];
|
|
390
|
+
this.setValue(list.includes(value) ? list.filter((item) => item !== value) : [...list, value]);
|
|
391
|
+
}
|
|
392
|
+
isTabbable(chip) {
|
|
393
|
+
return this.tabbable() === chip;
|
|
394
|
+
}
|
|
395
|
+
activate(chip) {
|
|
396
|
+
this.active.set(chip);
|
|
397
|
+
this.keyManager.updateActiveItem(this.option(chip));
|
|
398
|
+
}
|
|
399
|
+
option(chip) {
|
|
400
|
+
let option = this.options.get(chip);
|
|
401
|
+
if (!option) this.options.set(chip, option = { focus: () => chip.focus() });
|
|
402
|
+
return option;
|
|
403
|
+
}
|
|
404
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
405
|
+
minVersion: "12.0.0",
|
|
406
|
+
version: "22.2.3",
|
|
407
|
+
ngImport: i0,
|
|
408
|
+
type: NgbChipGroup,
|
|
409
|
+
deps: null,
|
|
410
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
411
|
+
});
|
|
412
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
413
|
+
minVersion: "17.2.0",
|
|
414
|
+
version: "22.2.3",
|
|
415
|
+
type: NgbChipGroup,
|
|
416
|
+
isStandalone: true,
|
|
417
|
+
selector: "ngb-chip-group",
|
|
418
|
+
inputs: {
|
|
419
|
+
label: {
|
|
420
|
+
classPropertyName: "label",
|
|
421
|
+
publicName: "label",
|
|
422
|
+
isSignal: true,
|
|
423
|
+
isRequired: false,
|
|
424
|
+
transformFunction: null
|
|
425
|
+
},
|
|
426
|
+
multiple: {
|
|
427
|
+
classPropertyName: "multiple",
|
|
428
|
+
publicName: "multiple",
|
|
429
|
+
isSignal: true,
|
|
430
|
+
isRequired: false,
|
|
431
|
+
transformFunction: null
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
host: {
|
|
435
|
+
attributes: { "role": "group" },
|
|
436
|
+
listeners: {
|
|
437
|
+
"keydown": "keyManager.onKeydown($event)",
|
|
438
|
+
"focusout": "markTouched()"
|
|
439
|
+
},
|
|
440
|
+
properties: { "attr.aria-label": "label()" },
|
|
441
|
+
classAttribute: "chip-group"
|
|
442
|
+
},
|
|
443
|
+
providers: [provideNgbValueAccessor(() => NgbChipGroup), {
|
|
444
|
+
provide: NGB_CHIP_GROUP,
|
|
445
|
+
useExisting: NgbChipGroup
|
|
446
|
+
}],
|
|
447
|
+
queries: [{
|
|
448
|
+
propertyName: "chips",
|
|
449
|
+
predicate: NgbChip,
|
|
450
|
+
descendants: true,
|
|
451
|
+
isSignal: true
|
|
452
|
+
}],
|
|
453
|
+
usesInheritance: true,
|
|
454
|
+
ngImport: i0,
|
|
455
|
+
template: "<ng-content />",
|
|
456
|
+
isInline: true,
|
|
457
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
461
|
+
minVersion: "12.0.0",
|
|
462
|
+
version: "22.2.3",
|
|
463
|
+
ngImport: i0,
|
|
464
|
+
type: NgbChipGroup,
|
|
465
|
+
decorators: [{
|
|
466
|
+
type: Component,
|
|
467
|
+
args: [{
|
|
468
|
+
selector: "ngb-chip-group",
|
|
469
|
+
template: "<ng-content />",
|
|
470
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
471
|
+
providers: [provideNgbValueAccessor(() => NgbChipGroup), {
|
|
472
|
+
provide: NGB_CHIP_GROUP,
|
|
473
|
+
useExisting: NgbChipGroup
|
|
474
|
+
}],
|
|
475
|
+
host: {
|
|
476
|
+
class: "chip-group",
|
|
477
|
+
role: "group",
|
|
478
|
+
"[attr.aria-label]": "label()",
|
|
479
|
+
"(keydown)": "keyManager.onKeydown($event)",
|
|
480
|
+
"(focusout)": "markTouched()"
|
|
481
|
+
}
|
|
482
|
+
}]
|
|
483
|
+
}],
|
|
484
|
+
propDecorators: {
|
|
485
|
+
label: [{
|
|
486
|
+
type: i0.Input,
|
|
487
|
+
args: [{
|
|
488
|
+
isSignal: true,
|
|
489
|
+
alias: "label",
|
|
490
|
+
required: false
|
|
491
|
+
}]
|
|
492
|
+
}],
|
|
493
|
+
multiple: [{
|
|
494
|
+
type: i0.Input,
|
|
495
|
+
args: [{
|
|
496
|
+
isSignal: true,
|
|
497
|
+
alias: "multiple",
|
|
498
|
+
required: false
|
|
499
|
+
}]
|
|
500
|
+
}],
|
|
501
|
+
chips: [{
|
|
502
|
+
type: i0.ContentChildren,
|
|
503
|
+
args: [i0.forwardRef(() => NgbChip), {
|
|
504
|
+
descendants: true,
|
|
505
|
+
isSignal: true
|
|
506
|
+
}]
|
|
507
|
+
}]
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
export { NGB_CHIP_GROUP, NgbChip, NgbChipGroup };
|
|
511
|
+
|
|
512
|
+
//# sourceMappingURL=ngb-bootstrap-core-chips.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngb-bootstrap-core-chips.mjs","names":[],"sources":["../../../../projects/core/chips/chip.ts","../../../../projects/core/chips/chip-group.ts"],"sourcesContent":["// API adapted from Taiga UI (Apache-2.0), see NOTICE.\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n InjectionToken,\n Signal,\n booleanAttribute,\n computed,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport { NGB_I18N, NgbThemeColor } from '@ngb-bootstrap/core';\nimport { NgbIcon } from '@ngb-bootstrap/core/icon';\nimport { NgbIconDefinition, ngbIconClose } from '@ngb-bootstrap/icons';\n\n/** What a chip needs from the `ngb-chip-group` it sits in. Implemented by `NgbChipGroup`. */\nexport interface NgbChipGroupRef {\n isSelected(value: unknown): boolean;\n toggle(value: unknown): void;\n /** True for the one chip that is in the tab order (roving tabindex). */\n isTabbable(chip: unknown): boolean;\n /** Called when a chip receives focus, so arrow keys continue from it. */\n activate(chip: unknown): void;\n readonly isDisabled: Signal<boolean>;\n}\n\n/** Lets chips find their group without importing it, which would be circular. */\nexport const NGB_CHIP_GROUP = new InjectionToken<NgbChipGroupRef>('NGB_CHIP_GROUP');\n\n/**\n * Compact label, built on Bootstrap 6 `.chip`. A chip is static by default; make it `selectable`\n * to toggle it (`aria-pressed`) or `removable` to add a dismiss button that emits `removed`.\n *\n * ```html\n * <ngb-chip color=\"success\" [icon]=\"ngbIconCheck\">Done</ngb-chip>\n * <ngb-chip selectable [(selected)]=\"on\">Filter</ngb-chip>\n * <ngb-chip removable (removed)=\"remove(tag)\">{{ tag }}</ngb-chip>\n * ```\n *\n * Inside an `ngb-chip-group` the chip's `value` is what the group selects. A selectable chip is a\n * focusable toggle; its dismiss button then leaves the tab order and Delete or Backspace removes\n * the chip instead.\n */\n@Component({\n selector: 'ngb-chip',\n imports: [NgbIcon],\n template: `\n @if (icon(); as icon) {\n <ngb-icon class=\"chip-icon\" [icon]=\"icon\" />\n }\n <ng-content />\n @if (removable()) {\n <button\n #dismiss\n type=\"button\"\n class=\"chip-dismiss\"\n [disabled]=\"isDisabled()\"\n [attr.tabindex]=\"selectable() ? -1 : null\"\n [attr.aria-hidden]=\"selectable() ? 'true' : null\"\n [attr.aria-label]=\"removeLabel()\"\n (click)=\"onDismiss($event)\"\n >\n <ngb-icon [icon]=\"closeIcon\" size=\"1rem\" />\n </button>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'classes()',\n '[attr.role]': 'selectable() ? \"button\" : null',\n '[attr.aria-pressed]': 'selectable() ? isSelected() : null',\n '[attr.aria-disabled]': 'selectable() && isDisabled() ? \"true\" : null',\n '[attr.tabindex]': 'tabIndex()',\n '(click)': 'onClick()',\n '(keydown)': 'onKeydown($event)',\n '(focus)': 'group?.activate(this)',\n },\n})\nexport class NgbChip {\n private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly i18n = inject(NGB_I18N);\n private readonly group = inject(NGB_CHIP_GROUP, { optional: true });\n private readonly dismiss = viewChild<ElementRef<HTMLElement>>('dismiss');\n\n protected readonly closeIcon = ngbIconClose;\n\n /** Theme colour (Bootstrap `.theme-*`). Defaults to Bootstrap's neutral chip. */\n readonly color = input<NgbThemeColor>();\n /** Leading icon from `@ngb-bootstrap/icons`. */\n readonly icon = input<NgbIconDefinition>();\n /** Makes the chip a toggle button with `aria-pressed`. */\n readonly selectable = input(false, { transform: booleanAttribute });\n /** Selected state of a selectable chip outside a group; two-way bindable. */\n readonly selected = model(false);\n /** What the surrounding `ngb-chip-group` selects when this chip is toggled. */\n readonly value = input<unknown>();\n /** Adds a dismiss button. */\n readonly removable = input(false, { transform: booleanAttribute });\n /** Disables the chip and its dismiss button. */\n readonly disabled = input(false, { transform: booleanAttribute });\n /**\n * Text used in the dismiss button's name (\"Remove {label}\"). Defaults to the chip's text.\n * Set it when the content isn't plain text.\n */\n readonly label = input<string>();\n /** Emits when the dismiss button is pressed, or on Delete / Backspace in a selectable chip. */\n readonly removed = output<void>();\n\n /** True when disabled by the input or by its group. */\n readonly isDisabled = computed(() => this.disabled() || (this.group?.isDisabled() ?? false));\n\n protected readonly isSelected = computed(() =>\n this.group ? this.group.isSelected(this.value()) : this.selected(),\n );\n\n protected readonly classes = computed(() => {\n const classes = ['chip'];\n const color = this.color();\n if (color) classes.push(`theme-${color}`);\n if (this.selectable() && this.isSelected()) classes.push('active');\n if (this.isDisabled()) classes.push('disabled');\n return classes.join(' ');\n });\n\n protected readonly tabIndex = computed(() => {\n if (!this.selectable() || this.isDisabled()) return null;\n return this.group && !this.group.isTabbable(this) ? -1 : 0;\n });\n\n /** Accessible name of the dismiss button. Reads the chip's text when `label` isn't set. */\n protected removeLabel(): string {\n return this.i18n.chip.remove.replace('{label}', this.label() ?? this.textLabel());\n }\n\n private textLabel(): string {\n const clone = this.el.nativeElement.cloneNode(true) as HTMLElement;\n clone.querySelectorAll('.chip-dismiss').forEach((node) => node.remove());\n return (clone.textContent ?? '').trim().replace(/\\s+/g, ' ');\n }\n\n /** Focuses the chip, or its dismiss button if it isn't selectable. Used by the group's key manager. */\n focus(): void {\n (this.selectable() ? this.el.nativeElement : this.dismiss()?.nativeElement)?.focus();\n }\n\n protected onClick(): void {\n if (this.selectable()) this.toggle();\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n // Runs before the group's own keydown handler, so arrow keys start from this chip.\n this.group?.activate(this);\n if (event.target !== this.el.nativeElement || !this.selectable()) return;\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.toggle();\n } else if ((event.key === 'Delete' || event.key === 'Backspace') && this.removable()) {\n event.preventDefault();\n this.remove();\n }\n }\n\n protected onDismiss(event: Event): void {\n event.stopPropagation();\n this.remove();\n }\n\n private toggle(): void {\n if (this.isDisabled()) return;\n if (this.group) this.group.toggle(this.value());\n else this.selected.update((selected) => !selected);\n }\n\n private remove(): void {\n if (this.isDisabled()) return;\n this.moveFocusToNeighbour();\n this.removed.emit();\n }\n\n /**\n * The chip is about to leave the DOM: hand focus to the next chip, else the previous one. Chips\n * may sit directly next to each other or each inside a wrapper such as a grid column.\n */\n private moveFocusToNeighbour(): void {\n const host = this.el.nativeElement;\n if (!host.contains(host.ownerDocument.activeElement)) return;\n for (let node: Element | null = host; node && node !== host.ownerDocument.body;) {\n for (const sibling of [node.nextElementSibling, node.previousElementSibling]) {\n const chip = sibling?.matches('ngb-chip') ? sibling : sibling?.querySelector('ngb-chip');\n // Never hand focus to a chip in another group.\n if (chip?.closest('ngb-chip-group') !== host.closest('ngb-chip-group')) continue;\n const target = chip?.matches('[role=button]:not([aria-disabled])')\n ? chip\n : chip?.querySelector('.chip-dismiss:not(:disabled)');\n if (target instanceof HTMLElement) {\n target.focus();\n return;\n }\n }\n node = node === host ? host.parentElement : null;\n }\n }\n}\n","// API adapted from Taiga UI (Apache-2.0), see NOTICE.\nimport { FocusKeyManager, FocusableOption } from '@angular/cdk/a11y';\nimport { Directionality } from '@angular/cdk/bidi';\nimport {\n ChangeDetectionStrategy,\n Component,\n Injector,\n booleanAttribute,\n computed,\n contentChildren,\n inject,\n input,\n signal,\n} from '@angular/core';\nimport { NgbValueAccessor, provideNgbValueAccessor } from '@ngb-bootstrap/core/cdk';\nimport { NGB_CHIP_GROUP, NgbChip, NgbChipGroupRef } from './chip';\n\n/**\n * Group of chips. It is a single tab stop: arrow keys, Home and End move between the selectable\n * chips and Enter or Space toggles one. The value is the `value` of the selected chip, or an array\n * of them with `multiple`. Works with `[(value)]`, `ngModel` and reactive forms.\n *\n * ```html\n * <ngb-chip-group label=\"Topics\" multiple [(value)]=\"topics\">\n * <ngb-chip selectable value=\"a11y\">Accessibility</ngb-chip>\n * <ngb-chip selectable value=\"i18n\">Internationalisation</ngb-chip>\n * </ngb-chip-group>\n * ```\n */\n@Component({\n selector: 'ngb-chip-group',\n template: '<ng-content />',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n provideNgbValueAccessor(() => NgbChipGroup),\n { provide: NGB_CHIP_GROUP, useExisting: NgbChipGroup },\n ],\n host: {\n class: 'chip-group',\n role: 'group',\n '[attr.aria-label]': 'label()',\n '(keydown)': 'keyManager.onKeydown($event)',\n '(focusout)': 'markTouched()',\n },\n})\nexport class NgbChipGroup extends NgbValueAccessor<unknown> implements NgbChipGroupRef {\n /** Accessible name of the group. */\n readonly label = input<string>();\n /** Allows several chips to be selected; the value is then an array. */\n readonly multiple = input(false, { transform: booleanAttribute });\n\n private readonly chips = contentChildren(NgbChip, { descendants: true });\n // The key manager wants `FocusableOption`s; a chip's `disabled` is an input signal, so wrap it.\n private readonly options = new WeakMap<NgbChip, FocusableOption>();\n private readonly focusable = computed(() =>\n this.chips().filter((chip) => chip.selectable() && !chip.isDisabled()),\n );\n private readonly focusableOptions = computed(() => this.focusable().map((c) => this.option(c)));\n private readonly active = signal<NgbChip | null>(null);\n\n protected readonly keyManager = new FocusKeyManager(this.focusableOptions, inject(Injector))\n .withWrap()\n .withHomeAndEnd()\n .withHorizontalOrientation(inject(Directionality).value);\n\n /** The chip in the tab order: the last focused one, else the first selected, else the first. */\n private readonly tabbable = computed(() => {\n const chips = this.focusable();\n const active = this.active();\n return (\n (active && chips.includes(active) ? active : null) ??\n chips.find((chip) => this.isSelected(chip.value())) ??\n chips[0] ??\n null\n );\n });\n\n isSelected(value: unknown): boolean {\n const current = this.value();\n return this.multiple()\n ? Array.isArray(current) && current.includes(value)\n : current !== null && current === value;\n }\n\n toggle(value: unknown): void {\n if (!this.multiple()) {\n this.setValue(this.isSelected(value) ? null : value);\n return;\n }\n const current = this.value();\n const list = Array.isArray(current) ? current : [];\n this.setValue(list.includes(value) ? list.filter((item) => item !== value) : [...list, value]);\n }\n\n isTabbable(chip: unknown): boolean {\n return this.tabbable() === chip;\n }\n\n activate(chip: unknown): void {\n this.active.set(chip as NgbChip);\n this.keyManager.updateActiveItem(this.option(chip as NgbChip));\n }\n\n private option(chip: NgbChip): FocusableOption {\n let option = this.options.get(chip);\n if (!option) this.options.set(chip, (option = { focus: () => chip.focus() }));\n return option;\n }\n}\n"],"mappings":";;;;;;;;AA+BA,MAAa,iBAAiB,IAAI,eAAgC,gBAAgB;AAmDlF,IAAa,UAAb,MAAa,QAAO;CACD,KAAK,OAAgC,UAAU;CAC/C,OAAO,OAAO,QAAQ;CACtB,QAAQ,OAAO,gBAAgB,EAAE,UAAU,KAAI,CAAE;CACjD,UAAU,UAAmC,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAErD,YAAY;CAGtB,QAAQ,MAAsB,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAE9B,OAAO,MAA0B,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAEjC,aAAa,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,aAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAEvD,WAAW,MAAM,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAEvB,QAAQ,MAAgB,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAExB,YAAY,MAAM,OAAK;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AhBxB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,iBAAiB,wBAAwB;GACzC,WAAW,CACT,8BAA6B,YAAa,GAC1C;IAAE,SAAS;IAAgB,aAAW;GAAc,CACrD;GACD,MAAM;IACJ,OAAO;IACP,MAAM;IACN,qBAAqB;IACrB,aAAa;IACb,cAAc;GACf;EACF,CAAA;CAO0C,CAAA;CAAA,gBAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,OAAO,GAAA;IAAI,aAAa;IAAM,UAAA;GAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, forwardRef } from "@angular/core";
|
|
3
|
+
import { NGB_INPUT_FIELD, NgbField } from "@ngb-bootstrap/core/input";
|
|
4
|
+
var NgbFloatingLabel = class NgbFloatingLabel extends NgbField {
|
|
5
|
+
placeholder = " ";
|
|
6
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
7
|
+
minVersion: "12.0.0",
|
|
8
|
+
version: "22.2.3",
|
|
9
|
+
ngImport: i0,
|
|
10
|
+
type: NgbFloatingLabel,
|
|
11
|
+
deps: null,
|
|
12
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
13
|
+
});
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
15
|
+
minVersion: "17.0.0",
|
|
16
|
+
version: "22.2.3",
|
|
17
|
+
type: NgbFloatingLabel,
|
|
18
|
+
isStandalone: true,
|
|
19
|
+
selector: "ngb-floating-label",
|
|
20
|
+
host: { classAttribute: "form-field" },
|
|
21
|
+
providers: [{
|
|
22
|
+
provide: NGB_INPUT_FIELD,
|
|
23
|
+
useExisting: forwardRef(() => NgbFloatingLabel)
|
|
24
|
+
}],
|
|
25
|
+
usesInheritance: true,
|
|
26
|
+
ngImport: i0,
|
|
27
|
+
template: `
|
|
28
|
+
<div class="input-group">
|
|
29
|
+
<div class="form-floating">
|
|
30
|
+
@if (label()) {
|
|
31
|
+
<label [attr.for]="labelFor()">{{ label() }}</label>
|
|
32
|
+
}
|
|
33
|
+
<ng-content />
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
@if (hint()) {
|
|
37
|
+
<div class="form-text" [id]="hintId">{{ hint() }}</div>
|
|
38
|
+
}
|
|
39
|
+
@if (showError()) {
|
|
40
|
+
<div class="invalid-feedback" [id]="errorId">{{ error() }}</div>
|
|
41
|
+
}
|
|
42
|
+
`,
|
|
43
|
+
isInline: true,
|
|
44
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
48
|
+
minVersion: "12.0.0",
|
|
49
|
+
version: "22.2.3",
|
|
50
|
+
ngImport: i0,
|
|
51
|
+
type: NgbFloatingLabel,
|
|
52
|
+
decorators: [{
|
|
53
|
+
type: Component,
|
|
54
|
+
args: [{
|
|
55
|
+
selector: "ngb-floating-label",
|
|
56
|
+
template: `
|
|
57
|
+
<div class="input-group">
|
|
58
|
+
<div class="form-floating">
|
|
59
|
+
@if (label()) {
|
|
60
|
+
<label [attr.for]="labelFor()">{{ label() }}</label>
|
|
61
|
+
}
|
|
62
|
+
<ng-content />
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
@if (hint()) {
|
|
66
|
+
<div class="form-text" [id]="hintId">{{ hint() }}</div>
|
|
67
|
+
}
|
|
68
|
+
@if (showError()) {
|
|
69
|
+
<div class="invalid-feedback" [id]="errorId">{{ error() }}</div>
|
|
70
|
+
}
|
|
71
|
+
`,
|
|
72
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
73
|
+
providers: [{
|
|
74
|
+
provide: NGB_INPUT_FIELD,
|
|
75
|
+
useExisting: forwardRef(() => NgbFloatingLabel)
|
|
76
|
+
}],
|
|
77
|
+
host: { class: "form-field" }
|
|
78
|
+
}]
|
|
79
|
+
}]
|
|
80
|
+
});
|
|
81
|
+
export { NgbFloatingLabel };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=ngb-bootstrap-core-floating-label.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngb-bootstrap-core-floating-label.mjs","names":[],"sources":["../../../../projects/core/floating-label/floating-label.ts"],"sourcesContent":["// API adapted from Bootstrap 6 `.form-floating`, see NOTICE.\nimport { ChangeDetectionStrategy, Component, forwardRef } from '@angular/core';\nimport { NGB_INPUT_FIELD, NgbField } from '@ngb-bootstrap/core/input';\n\n/**\n * Floating label built on Bootstrap 6 `.form-floating`. The label sits inside the control and\n * moves up once the control has focus or a value. It works with `<input>`, `<textarea>` and\n * `<select>`: put an `ngbInput` inside.\n *\n * Bootstrap detects a value with `:placeholder-shown`, so the control needs a `placeholder`. The\n * input gets a single space by default; set `placeholder` to show a hint once it has focus.\n *\n * ```html\n * <ngb-floating-label label=\"Email\" hint=\"We never share it.\" error=\"Enter a valid email.\">\n * <input ngbInput type=\"email\" formControlName=\"email\" />\n * </ngb-floating-label>\n * ```\n */\n@Component({\n selector: 'ngb-floating-label',\n template: `\n <div class=\"input-group\">\n <div class=\"form-floating\">\n @if (label()) {\n <label [attr.for]=\"labelFor()\">{{ label() }}</label>\n }\n <ng-content />\n </div>\n </div>\n @if (hint()) {\n <div class=\"form-text\" [id]=\"hintId\">{{ hint() }}</div>\n }\n @if (showError()) {\n <div class=\"invalid-feedback\" [id]=\"errorId\">{{ error() }}</div>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NGB_INPUT_FIELD, useExisting: forwardRef(() => NgbFloatingLabel) }],\n host: {\n class: 'form-field',\n },\n})\nexport class NgbFloatingLabel extends NgbField {\n /** Default placeholder handed to the input: a space, so `:placeholder-shown` works. */\n readonly placeholder = ' ';\n}\n"],"mappings":";;;AA0CA,IAAa,mBAAb,MAAa,yBAAyB,SAAQ;CAEnC,cAAc;CAFZ,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,aAAA;EAAA,WALhB,CAAC;GAAE,SAAS;GAAiB,aAAa,iBAAiB,gBAAgB;EAAC,CAAE;EAAC,iBAAA;EAAA,UAAA;EAAA,UAjBhF;;;;;;;;;;;;;;;;EAeT,UAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAOU,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAxB5B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;;;;;;;;;;;;;;;;GAgBV,iBAAiB,wBAAwB;GACzC,WAAW,CAAC;IAAE,SAAS;IAAiB,aAAa,iBAAgB,gBAAiB;GAAC,CAAE;GACzF,MAAM,EACJ,OAAO,aACR;EACF,CAAA"}
|