@kirbydesign/designsystem 11.5.0 → 11.6.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/fesm2022/kirbydesign-designsystem-accordion.mjs +11 -11
- package/fesm2022/kirbydesign-designsystem-action-group.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-avatar.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-badge.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-button.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-calendar.mjs +12 -9
- package/fesm2022/kirbydesign-designsystem-calendar.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-card.mjs +16 -16
- package/fesm2022/kirbydesign-designsystem-chart.mjs +22 -22
- package/fesm2022/kirbydesign-designsystem-checkbox.mjs +5 -5
- package/fesm2022/kirbydesign-designsystem-checkbox.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-config.mjs +1 -1
- package/fesm2022/kirbydesign-designsystem-data-table.mjs +8 -8
- package/fesm2022/kirbydesign-designsystem-data-table.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-divider.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-dropdown.mjs +43 -122
- package/fesm2022/kirbydesign-designsystem-dropdown.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-empty-state.mjs +7 -7
- package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-flag.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-form-field.mjs +28 -28
- package/fesm2022/kirbydesign-designsystem-header.mjs +19 -19
- package/fesm2022/kirbydesign-designsystem-helpers.mjs +9 -9
- package/fesm2022/kirbydesign-designsystem-icon.mjs +14 -10
- package/fesm2022/kirbydesign-designsystem-icon.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-item-group.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-item-sliding.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-item.mjs +10 -10
- package/fesm2022/kirbydesign-designsystem-kirby-app.mjs +7 -7
- package/fesm2022/kirbydesign-designsystem-list.mjs +40 -40
- package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs +6 -6
- package/fesm2022/kirbydesign-designsystem-menu.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-modal.mjs +44 -44
- package/fesm2022/kirbydesign-designsystem-modal.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-page.mjs +40 -40
- package/fesm2022/kirbydesign-designsystem-popover.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-progress-circle.mjs +6 -6
- package/fesm2022/kirbydesign-designsystem-radio.mjs +11 -11
- package/fesm2022/kirbydesign-designsystem-radio.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-range.mjs +5 -5
- package/fesm2022/kirbydesign-designsystem-range.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-reorder-list.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-router-outlet.mjs +7 -7
- package/fesm2022/kirbydesign-designsystem-section-header.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-shared-floating.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-shared-portal.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem-shared.mjs +18 -18
- package/fesm2022/kirbydesign-designsystem-slide-button.mjs +4 -4
- package/fesm2022/kirbydesign-designsystem-slide-button.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-slide.mjs +13 -13
- package/fesm2022/kirbydesign-designsystem-spinner.mjs +7 -7
- package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs +10 -10
- package/fesm2022/kirbydesign-designsystem-tabs.mjs +13 -13
- package/fesm2022/kirbydesign-designsystem-testing-base.mjs +286 -286
- package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs +4 -4
- package/fesm2022/kirbydesign-designsystem-testing-jest.mjs +4 -4
- package/fesm2022/kirbydesign-designsystem-testing.mjs +4 -4
- package/fesm2022/kirbydesign-designsystem-toast.mjs +13 -13
- package/fesm2022/kirbydesign-designsystem-toast.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-toggle-button.mjs +7 -7
- package/fesm2022/kirbydesign-designsystem-toggle.mjs +5 -5
- package/fesm2022/kirbydesign-designsystem-toggle.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-types.mjs +3 -3
- package/fesm2022/kirbydesign-designsystem.mjs +15 -15
- package/fesm2022/kirbydesign-designsystem.mjs.map +1 -1
- package/icons/svg/id-card.svg +3 -0
- package/icons/svg/maintenance.svg +3 -0
- package/icons/svg/message-read.svg +3 -0
- package/icons/svg/ownership.svg +3 -0
- package/icons/svg/top-up.svg +3 -1
- package/package.json +3 -4
- package/types/kirbydesign-designsystem-action-group.d.ts +1 -1
- package/types/kirbydesign-designsystem-calendar.d.ts +5 -1
- package/types/kirbydesign-designsystem-calendar.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-config.d.ts +1 -1
- package/types/kirbydesign-designsystem-dropdown.d.ts +9 -17
- package/types/kirbydesign-designsystem-dropdown.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-icon.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-page.d.ts +1 -1
- package/types/kirbydesign-designsystem-slide.d.ts +1 -1
- package/types/kirbydesign-designsystem-toast.d.ts +2 -2
- package/types/kirbydesign-designsystem-toast.d.ts.map +1 -1
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, EventEmitter, RendererStyleFlags2, ElementRef, TemplateRef, forwardRef, HostListener, ContentChildren, ViewChildren, ViewChild, ContentChild, HostBinding, Output, Input, Component, NgModule } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
4
|
import { CardComponent, CardModule } from '@kirbydesign/designsystem/card';
|
|
5
|
-
import { UniqueIdGenerator,
|
|
5
|
+
import { UniqueIdGenerator, StringSearchHelper } from '@kirbydesign/designsystem/helpers';
|
|
6
6
|
import { ItemComponent, ItemModule } from '@kirbydesign/designsystem/item';
|
|
7
7
|
import { ListItemTemplateDirective, ListModule } from '@kirbydesign/designsystem/list';
|
|
8
8
|
import { HorizontalDirection, PopoverComponent } from '@kirbydesign/designsystem/popover';
|
|
@@ -18,11 +18,6 @@ var OpenState;
|
|
|
18
18
|
OpenState[OpenState["opening"] = 1] = "opening";
|
|
19
19
|
OpenState[OpenState["open"] = 2] = "open";
|
|
20
20
|
})(OpenState || (OpenState = {}));
|
|
21
|
-
var VerticalDirection;
|
|
22
|
-
(function (VerticalDirection) {
|
|
23
|
-
VerticalDirection[VerticalDirection["up"] = 0] = "up";
|
|
24
|
-
VerticalDirection[VerticalDirection["down"] = 1] = "down";
|
|
25
|
-
})(VerticalDirection || (VerticalDirection = {}));
|
|
26
21
|
|
|
27
22
|
class KeyboardHandlerService {
|
|
28
23
|
handle(event, selectedIndex, maxIndex, cyclicIndex = false) {
|
|
@@ -62,10 +57,10 @@ class KeyboardHandlerService {
|
|
|
62
57
|
}
|
|
63
58
|
return newIndex;
|
|
64
59
|
}
|
|
65
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
66
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.
|
|
60
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: KeyboardHandlerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
61
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: KeyboardHandlerService, providedIn: 'root' }); }
|
|
67
62
|
}
|
|
68
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: KeyboardHandlerService, decorators: [{
|
|
69
64
|
type: Injectable,
|
|
70
65
|
args: [{
|
|
71
66
|
providedIn: 'root',
|
|
@@ -101,10 +96,10 @@ class DropdownComponent {
|
|
|
101
96
|
}
|
|
102
97
|
}
|
|
103
98
|
set popout(direction) {
|
|
104
|
-
this.
|
|
99
|
+
this._popout = direction || HorizontalDirection.right;
|
|
105
100
|
}
|
|
106
101
|
get popout() {
|
|
107
|
-
return this.
|
|
102
|
+
return this._popout;
|
|
108
103
|
}
|
|
109
104
|
get _isDisabled() {
|
|
110
105
|
return this.disabled ? 'disabled' : null;
|
|
@@ -118,6 +113,14 @@ class DropdownComponent {
|
|
|
118
113
|
this.hasErrorChange.emit(this._hasError);
|
|
119
114
|
}
|
|
120
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated This input is no longer needed. The dropdown now always uses popover positioning.
|
|
118
|
+
* This input will be removed in a future major version.
|
|
119
|
+
*/
|
|
120
|
+
set usePopover(_value) {
|
|
121
|
+
console.warn(`[Kirby Dropdown] The 'usePopover' input is deprecated and no longer has any effect.
|
|
122
|
+
The dropdown now always uses popover positioning. This input will be removed in a future major version.`);
|
|
123
|
+
}
|
|
121
124
|
get _tabindex() {
|
|
122
125
|
return this.disabled ? -1 : this.tabindex;
|
|
123
126
|
}
|
|
@@ -140,12 +143,6 @@ class DropdownComponent {
|
|
|
140
143
|
get isOpen() {
|
|
141
144
|
return this.state === OpenState.open;
|
|
142
145
|
}
|
|
143
|
-
get _popoutLeft() {
|
|
144
|
-
return this.horizontalDirection === HorizontalDirection.left;
|
|
145
|
-
}
|
|
146
|
-
get _popoutUp() {
|
|
147
|
-
return this.verticalDirection === VerticalDirection.up;
|
|
148
|
-
}
|
|
149
146
|
forwardAriaLabelToDropdownButton() {
|
|
150
147
|
forwardAttributes(this.elementRef.nativeElement, this._attributesToForward, this.renderer, this.buttonElement.nativeElement);
|
|
151
148
|
}
|
|
@@ -174,8 +171,7 @@ class DropdownComponent {
|
|
|
174
171
|
this.keyboardHandlerService = keyboardHandlerService;
|
|
175
172
|
this.resizeObserverService = resizeObserverService;
|
|
176
173
|
this.state = OpenState.closed;
|
|
177
|
-
this.
|
|
178
|
-
this.verticalDirection = VerticalDirection.down;
|
|
174
|
+
this._popout = HorizontalDirection.right;
|
|
179
175
|
this._attributesToForward = ['aria-label', 'aria-labelledby'];
|
|
180
176
|
this._listboxId = UniqueIdGenerator.scopedTo('kirby-dropdown').next();
|
|
181
177
|
this._comboboxId = UniqueIdGenerator.scopedTo('kirby-button').next();
|
|
@@ -193,7 +189,6 @@ class DropdownComponent {
|
|
|
193
189
|
// Tabindex defaults to 0 instead of no value to align tabbing behavior in Safari
|
|
194
190
|
// with other browsers and the default select behavior: https://mayank.co/blog/safari-focus/
|
|
195
191
|
this.tabindex = 0;
|
|
196
|
-
this.usePopover = false;
|
|
197
192
|
/**
|
|
198
193
|
* Emitted when an item is selected (tap on mobile, click/keypress on web)
|
|
199
194
|
*/
|
|
@@ -227,15 +222,12 @@ class DropdownComponent {
|
|
|
227
222
|
}
|
|
228
223
|
this.isOpen ? this.close() : this.open();
|
|
229
224
|
}
|
|
230
|
-
/* Utility that makes it easier to set styles on card element
|
|
231
|
-
when using popover*/
|
|
225
|
+
/* Utility that makes it easier to set styles on card element */
|
|
232
226
|
setPopoverCardStyle(style, value) {
|
|
233
|
-
if (!this.usePopover)
|
|
234
|
-
return;
|
|
235
227
|
this.renderer.setStyle(this.cardElement.nativeElement, style, value, RendererStyleFlags2.DashCase);
|
|
236
228
|
}
|
|
237
229
|
ngAfterViewInit() {
|
|
238
|
-
if (this.
|
|
230
|
+
if (this.expand === 'block') {
|
|
239
231
|
const { width: initialWidth } = this.elementRef.nativeElement.getBoundingClientRect();
|
|
240
232
|
this.setPopoverCardStyle('max-width', 'initial');
|
|
241
233
|
this.setPopoverCardStyle('min-width', 'initial');
|
|
@@ -249,71 +241,6 @@ class DropdownComponent {
|
|
|
249
241
|
});
|
|
250
242
|
}
|
|
251
243
|
this.forwardAriaLabelToDropdownButton();
|
|
252
|
-
this.initializeAlignment();
|
|
253
|
-
}
|
|
254
|
-
initializeAlignment() {
|
|
255
|
-
if (this.usePopover)
|
|
256
|
-
return;
|
|
257
|
-
if (!this.intersectionObserverRef) {
|
|
258
|
-
// Get the design token size of the button. In the button stylesheet a medium button height is utils.size(xl)
|
|
259
|
-
// and a small button height is utils.size("l")
|
|
260
|
-
const designTokenSizeHeight = this.size === 'md' ? 'xl' : 'l';
|
|
261
|
-
// Setting the rootMargin equal to the height of the button
|
|
262
|
-
// allows the Intersection Observer Callback to be called
|
|
263
|
-
// even if the dropdown button is intersecting with the viewport
|
|
264
|
-
const options = {
|
|
265
|
-
rootMargin: DesignTokenHelper.size(designTokenSizeHeight),
|
|
266
|
-
};
|
|
267
|
-
const callback = (entries) => {
|
|
268
|
-
// Only apply alignment when opening:
|
|
269
|
-
if (this.state !== OpenState.opening) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
// Cancel any pending timer to show dropdown:
|
|
273
|
-
clearTimeout(this.showDropdownTimeoutId);
|
|
274
|
-
const entry = entries[0];
|
|
275
|
-
const isVisible = entry.boundingClientRect.width > 0;
|
|
276
|
-
if (isVisible && entry.intersectionRatio < 1) {
|
|
277
|
-
this.setHorizontalDirection(entry);
|
|
278
|
-
this.setVerticalDirection(entry);
|
|
279
|
-
}
|
|
280
|
-
this.showDropdown();
|
|
281
|
-
this.cdr.markForCheck();
|
|
282
|
-
};
|
|
283
|
-
this.intersectionObserverRef = new IntersectionObserver(callback, options);
|
|
284
|
-
this.intersectionObserverRef.observe(this.cardElement.nativeElement);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
setHorizontalDirection(entry) {
|
|
288
|
-
// If popout direction is set to right, and the entry is cut off to the right by ${entry.boundingClientRect.right - entry.intersectionRect.right}px
|
|
289
|
-
// it is set to popout left instead, and vice versa for popout direction left
|
|
290
|
-
if (this.horizontalDirection === HorizontalDirection.right) {
|
|
291
|
-
if (entry.boundingClientRect.right > entry.rootBounds.right) {
|
|
292
|
-
this.horizontalDirection = HorizontalDirection.left;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
if (entry.boundingClientRect.left < entry.rootBounds.left) {
|
|
297
|
-
this.horizontalDirection = HorizontalDirection.right;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
setVerticalDirection(entry) {
|
|
302
|
-
if (entry.boundingClientRect.top < 0) {
|
|
303
|
-
// entry is cut off at the top by ${entry.boundingClientRect.top}px
|
|
304
|
-
// open downwards:
|
|
305
|
-
this.verticalDirection = VerticalDirection.down;
|
|
306
|
-
}
|
|
307
|
-
if (entry.boundingClientRect.bottom > entry.rootBounds.bottom) {
|
|
308
|
-
// entry is cut off at the bottom by ${entry.boundingClientRect.bottom - entry.intersectionRect.bottom}px
|
|
309
|
-
const containerOffsetTop = this.elementRef.nativeElement.getBoundingClientRect().top;
|
|
310
|
-
const SPACING = 5; //TODO: Get from SCSS
|
|
311
|
-
// Check if the card can fit on top of button:
|
|
312
|
-
if (containerOffsetTop > entry.target.clientHeight + SPACING) {
|
|
313
|
-
// open upwards:
|
|
314
|
-
this.verticalDirection = VerticalDirection.up;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
244
|
}
|
|
318
245
|
open() {
|
|
319
246
|
if (this.disabled) {
|
|
@@ -322,7 +249,7 @@ class DropdownComponent {
|
|
|
322
249
|
if (!this.isOpen) {
|
|
323
250
|
this.state = OpenState.opening;
|
|
324
251
|
// ensures that the dropdown is opened in case the IntersectionObserverCallback isn't invoked
|
|
325
|
-
|
|
252
|
+
setTimeout(() => this.showDropdown(), DropdownComponent.OPEN_DELAY_IN_MS);
|
|
326
253
|
// Move focus to selected item (if any) or first item
|
|
327
254
|
this.focusedIndex = this.selectedIndex > -1 ? this.selectedIndex : 0;
|
|
328
255
|
}
|
|
@@ -341,8 +268,6 @@ class DropdownComponent {
|
|
|
341
268
|
}
|
|
342
269
|
if (this.isOpen) {
|
|
343
270
|
this.state = OpenState.closed;
|
|
344
|
-
// Reset vertical direction to default
|
|
345
|
-
this.verticalDirection = VerticalDirection.down;
|
|
346
271
|
this.popover?.hide();
|
|
347
272
|
}
|
|
348
273
|
}
|
|
@@ -551,20 +476,25 @@ class DropdownComponent {
|
|
|
551
476
|
_onPopoverWillHide() {
|
|
552
477
|
this.state = OpenState.closed;
|
|
553
478
|
this.buttonElement.nativeElement.focus();
|
|
479
|
+
this._onTouched();
|
|
480
|
+
}
|
|
481
|
+
_onFocusOut(event) {
|
|
482
|
+
const relatedTarget = event.relatedTarget; // relatedTarget is the element receiving focus
|
|
483
|
+
const isOnTriggerButton = relatedTarget && this.elementRef.nativeElement.contains(relatedTarget);
|
|
484
|
+
const isInsidePopover = relatedTarget && relatedTarget.closest('kirby-popover');
|
|
485
|
+
if (!isOnTriggerButton && !isInsidePopover) {
|
|
486
|
+
if (this.isOpen) {
|
|
487
|
+
this.close();
|
|
488
|
+
}
|
|
489
|
+
this._onTouched();
|
|
490
|
+
}
|
|
554
491
|
}
|
|
555
492
|
_onEnterOrEscape() {
|
|
556
493
|
this.close();
|
|
557
|
-
this._onTouched();
|
|
558
494
|
}
|
|
559
495
|
_onPopoverClick() {
|
|
560
496
|
this.close();
|
|
561
497
|
}
|
|
562
|
-
_onBlur() {
|
|
563
|
-
if (this.usePopover)
|
|
564
|
-
return;
|
|
565
|
-
this.close();
|
|
566
|
-
this._onTouched();
|
|
567
|
-
}
|
|
568
498
|
_onEnterOrSpace(event) {
|
|
569
499
|
event.preventDefault();
|
|
570
500
|
event.stopPropagation();
|
|
@@ -627,20 +557,17 @@ class DropdownComponent {
|
|
|
627
557
|
ngOnDestroy() {
|
|
628
558
|
this.unlistenAllSlottedItems();
|
|
629
559
|
this.resizeObserverService.unobserve(this.elementRef);
|
|
630
|
-
if (this.intersectionObserverRef) {
|
|
631
|
-
this.intersectionObserverRef.disconnect();
|
|
632
|
-
}
|
|
633
560
|
}
|
|
634
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
635
|
-
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.
|
|
561
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: DropdownComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: KeyboardHandlerService }, { token: i2.ResizeObserverService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
562
|
+
/** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.4", type: DropdownComponent, isStandalone: true, selector: "kirby-dropdown", inputs: { items: "items", selectedIndex: "selectedIndex", focusedIndex: "focusedIndex", itemTextProperty: "itemTextProperty", placeholder: "placeholder", popout: "popout", attentionLevel: "attentionLevel", expand: "expand", disabled: "disabled", hasError: "hasError", size: "size", tabindex: "tabindex", usePopover: "usePopover" }, outputs: { hasErrorChange: "hasErrorChange", change: "change" }, host: { listeners: { "keydown.tab": "_onTab()", "keydown": "_onKeydown($event)", "mousedown": "_onMouseDown($event)", "touchstart": "_onTouchStart($event)", "focusout": "_onFocusOut($event)", "keydown.enter": "_onEnterOrSpace($event)", "keydown.escape": "_onEnterOrEscape()", "keydown.space": "_onEnterOrSpace($event)", "keydown.arrowup": "_onArrowKeys($event)", "keydown.arrowdown": "_onArrowKeys($event)", "keydown.arrowleft": "_onArrowKeys($event)", "keydown.arrowright": "_onArrowKeys($event)", "keydown.home": "_onHomeEndKeys($event)", "keydown.end": "_onHomeEndKeys($event)" }, properties: { "attr.disabled": "this._isDisabled", "class.error": "this.hasError", "attr.no-blur": "this._noBlurOnScroll", "class.expand": "this._isBlockLevel", "class.is-opening": "this._isOpening", "class.is-open": "this.isOpen", "class.clicked": "this.clicked" } }, providers: [
|
|
636
563
|
{
|
|
637
564
|
provide: NG_VALUE_ACCESSOR,
|
|
638
565
|
useExisting: forwardRef((() => DropdownComponent)),
|
|
639
566
|
multi: true,
|
|
640
567
|
},
|
|
641
|
-
], queries: [{ propertyName: "itemTemplate", first: true, predicate: ListItemTemplateDirective, descendants: true, read: TemplateRef, static: true }, { propertyName: "slottedItems", predicate: ListItemTemplateDirective, read: ElementRef }, { propertyName: "kirbyItemsSlotted", predicate: ItemComponent, read: ElementRef }], viewQueries: [{ propertyName: "cardElement", first: true, predicate: CardComponent, descendants: true, read: ElementRef }, { propertyName: "popover", first: true, predicate: PopoverComponent, descendants: true }, { propertyName: "buttonElement", first: true, predicate: ButtonComponent, descendants: true, read: ElementRef, static: true }, { propertyName: "kirbyItemsDefault", predicate: ItemComponent, descendants: true, read: ElementRef }], ngImport: i0, template: "<button\n kirby-button\n type=\"button\"\n [attr.id]=\"_comboboxId\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"_listboxId\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-activedescendant]=\"_listboxId + '-item-' + focusedIndex\"\n [attr.aria-invalid]=\"hasError\"\n [size]=\"size\"\n [attentionLevel]=\"attentionLevel\"\n (click)=\"onToggle($event)\"\n
|
|
568
|
+
], queries: [{ propertyName: "itemTemplate", first: true, predicate: ListItemTemplateDirective, descendants: true, read: TemplateRef, static: true }, { propertyName: "slottedItems", predicate: ListItemTemplateDirective, read: ElementRef }, { propertyName: "kirbyItemsSlotted", predicate: ItemComponent, read: ElementRef }], viewQueries: [{ propertyName: "cardElement", first: true, predicate: CardComponent, descendants: true, read: ElementRef }, { propertyName: "popover", first: true, predicate: PopoverComponent, descendants: true }, { propertyName: "buttonElement", first: true, predicate: ButtonComponent, descendants: true, read: ElementRef, static: true }, { propertyName: "kirbyItemsDefault", predicate: ItemComponent, descendants: true, read: ElementRef }], ngImport: i0, template: "<button\n kirby-button\n type=\"button\"\n [attr.id]=\"_comboboxId\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"_listboxId\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-activedescendant]=\"isOpen ? _listboxId + '-item-' + focusedIndex : null\"\n [attr.aria-invalid]=\"hasError\"\n [size]=\"size\"\n [attentionLevel]=\"attentionLevel\"\n (click)=\"onToggle($event)\"\n [disabled]=\"disabled\"\n [tabindex]=\"_tabindex\"\n>\n <span class=\"text\">{{ selectedText || placeholder }}</span>\n <kirby-icon [name]=\"isOpen ? 'arrow-up' : 'arrow-down'\"></kirby-icon>\n</button>\n\n<kirby-popover\n [target]=\"buttonElement\"\n [popout]=\"popout\"\n (click)=\"_onPopoverClick()\"\n (willHide)=\"_onPopoverWillHide()\"\n>\n <kirby-card role=\"listbox\" [attr.id]=\"_listboxId\" [attr.aria-labelledby]=\"_comboboxId\">\n @for (item of items; track item; let i = $index) {\n <ng-container\n *ngTemplateOutlet=\"\n itemTemplate || defaultItemTemplate;\n context: {\n $implicit: item,\n selected: i === selectedIndex,\n focused: i === focusedIndex,\n index: i,\n }\n \"\n ></ng-container>\n }\n </kirby-card>\n</kirby-popover>\n\n<ng-template\n #defaultItemTemplate\n let-item\n let-selected=\"selected\"\n let-index=\"index\"\n let-focused=\"focused\"\n>\n <kirby-item\n [selectable]=\"true\"\n [selected]=\"selected\"\n (click)=\"onItemSelect(index)\"\n [class.focused]=\"focused\"\n role=\"option\"\n [attr.id]=\"_listboxId + '-item-' + index\"\n [attr.aria-selected]=\"selected\"\n >\n <p class=\"kirby-item-title\">{{ getTextFromItem(item) }}</p>\n @if (selected) {\n <kirby-icon name=\"checkmark-selected\" slot=\"end\"></kirby-icon>\n }\n </kirby-item>\n</ng-template>\n", styles: ["@media(hover:hover)and (pointer:fine){:host{outline:none;border-radius:999px}:host:focus{transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}:host:focus:not(:focus-visible){box-shadow:0 0 0 0 transparent}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}:host{display:inline-block;position:relative;max-width:calc(100vw - 32px)}:host.clicked{box-shadow:none}:host.expand{display:block}:host.expand kirby-card{width:100%;min-width:initial;max-width:initial}:host.error>button,:host.ng-touched.ng-invalid>button{outline-color:var(--kirby-danger)}:host>button{position:relative;margin:0;width:100%;min-width:0;outline:1px solid transparent}:host>button .text{overflow:hidden;text-overflow:ellipsis}:host.is-open>button{box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26}kirby-popover{--max-height: 352px}kirby-card{max-height:352px;overflow-y:auto;box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26;max-width:calc(100vw - 32px);min-width:288px}@media(min-width:321px){kirby-card{min-width:343px}}@media(hover:hover){:host-context(kirby-calendar)>button:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer}}:host-context(kirby-calendar)>button:active,:host-context(kirby-calendar)>button.interaction-state-active{--state-layer-opacity: .16;--state-layer-background-color: var(--kirby-black)}:host-context(kirby-calendar)>button{border-color:transparent;font-weight:700;font-size:initial}:host-context(kirby-calendar).is-open>button{box-shadow:none}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "button[kirby-button],Button[kirby-button],a[kirby-button]", inputs: ["attentionLevel", "noDecoration", "themeColor", "expand", "isFloating", "size", "showIconOnly"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PopoverComponent, selector: "kirby-popover", inputs: ["popout", "target"], outputs: ["willHide"] }, { kind: "component", type: CardComponent, selector: "kirby-card", inputs: ["title", "subtitle", "backgroundImageUrl", "hasPadding", "sizes", "variant"] }, { kind: "component", type: ItemComponent, selector: "kirby-item", inputs: ["disabled", "selected", "disclosure", "selectable", "reorderable", "size", "href", "rotateIcon"] }, { kind: "component", type: IconComponent, selector: "kirby-icon", inputs: ["size", "name"] }] }); }
|
|
642
569
|
}
|
|
643
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
570
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: DropdownComponent, decorators: [{
|
|
644
571
|
type: Component,
|
|
645
572
|
args: [{ selector: 'kirby-dropdown', providers: [
|
|
646
573
|
{
|
|
@@ -655,7 +582,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
655
582
|
CardComponent,
|
|
656
583
|
ItemComponent,
|
|
657
584
|
IconComponent,
|
|
658
|
-
], template: "<button\n kirby-button\n type=\"button\"\n [attr.id]=\"_comboboxId\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"_listboxId\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-activedescendant]=\"_listboxId + '-item-' + focusedIndex\"\n [attr.aria-invalid]=\"hasError\"\n [size]=\"size\"\n [attentionLevel]=\"attentionLevel\"\n (click)=\"onToggle($event)\"\n
|
|
585
|
+
], template: "<button\n kirby-button\n type=\"button\"\n [attr.id]=\"_comboboxId\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"_listboxId\"\n [attr.aria-expanded]=\"isOpen\"\n [attr.aria-activedescendant]=\"isOpen ? _listboxId + '-item-' + focusedIndex : null\"\n [attr.aria-invalid]=\"hasError\"\n [size]=\"size\"\n [attentionLevel]=\"attentionLevel\"\n (click)=\"onToggle($event)\"\n [disabled]=\"disabled\"\n [tabindex]=\"_tabindex\"\n>\n <span class=\"text\">{{ selectedText || placeholder }}</span>\n <kirby-icon [name]=\"isOpen ? 'arrow-up' : 'arrow-down'\"></kirby-icon>\n</button>\n\n<kirby-popover\n [target]=\"buttonElement\"\n [popout]=\"popout\"\n (click)=\"_onPopoverClick()\"\n (willHide)=\"_onPopoverWillHide()\"\n>\n <kirby-card role=\"listbox\" [attr.id]=\"_listboxId\" [attr.aria-labelledby]=\"_comboboxId\">\n @for (item of items; track item; let i = $index) {\n <ng-container\n *ngTemplateOutlet=\"\n itemTemplate || defaultItemTemplate;\n context: {\n $implicit: item,\n selected: i === selectedIndex,\n focused: i === focusedIndex,\n index: i,\n }\n \"\n ></ng-container>\n }\n </kirby-card>\n</kirby-popover>\n\n<ng-template\n #defaultItemTemplate\n let-item\n let-selected=\"selected\"\n let-index=\"index\"\n let-focused=\"focused\"\n>\n <kirby-item\n [selectable]=\"true\"\n [selected]=\"selected\"\n (click)=\"onItemSelect(index)\"\n [class.focused]=\"focused\"\n role=\"option\"\n [attr.id]=\"_listboxId + '-item-' + index\"\n [attr.aria-selected]=\"selected\"\n >\n <p class=\"kirby-item-title\">{{ getTextFromItem(item) }}</p>\n @if (selected) {\n <kirby-icon name=\"checkmark-selected\" slot=\"end\"></kirby-icon>\n }\n </kirby-item>\n</ng-template>\n", styles: ["@media(hover:hover)and (pointer:fine){:host{outline:none;border-radius:999px}:host:focus{transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}:host:focus:not(:focus-visible){box-shadow:0 0 0 0 transparent}:host:focus-visible{transition:all 80ms linear 0ms;box-shadow:0 0 0 2px var(--kirby-background-color),0 0 0 4px #4d90fe}}:host{display:inline-block;position:relative;max-width:calc(100vw - 32px)}:host.clicked{box-shadow:none}:host.expand{display:block}:host.expand kirby-card{width:100%;min-width:initial;max-width:initial}:host.error>button,:host.ng-touched.ng-invalid>button{outline-color:var(--kirby-danger)}:host>button{position:relative;margin:0;width:100%;min-width:0;outline:1px solid transparent}:host>button .text{overflow:hidden;text-overflow:ellipsis}:host.is-open>button{box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26}kirby-popover{--max-height: 352px}kirby-card{max-height:352px;overflow-y:auto;box-shadow:0 0 5px #1c1c1c0a,0 10px 15px -10px #1c1c1c26;max-width:calc(100vw - 32px);min-width:288px}@media(min-width:321px){kirby-card{min-width:343px}}@media(hover:hover){:host-context(kirby-calendar)>button:hover{--state-layer-opacity: .08;--state-layer-background-color: var(--kirby-black);cursor:pointer}}:host-context(kirby-calendar)>button:active,:host-context(kirby-calendar)>button.interaction-state-active{--state-layer-opacity: .16;--state-layer-background-color: var(--kirby-black)}:host-context(kirby-calendar)>button{border-color:transparent;font-weight:700;font-size:initial}:host-context(kirby-calendar).is-open>button{box-shadow:none}\n"] }]
|
|
659
586
|
}], ctorParameters: () => [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: KeyboardHandlerService }, { type: i2.ResizeObserverService }], propDecorators: { items: [{
|
|
660
587
|
type: Input
|
|
661
588
|
}], selectedIndex: [{
|
|
@@ -689,9 +616,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
689
616
|
}], tabindex: [{
|
|
690
617
|
type: Input
|
|
691
618
|
}], usePopover: [{
|
|
692
|
-
type: HostBinding,
|
|
693
|
-
args: ['class.with-popover']
|
|
694
|
-
}, {
|
|
695
619
|
type: Input
|
|
696
620
|
}], _noBlurOnScroll: [{
|
|
697
621
|
type: HostBinding,
|
|
@@ -707,12 +631,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
707
631
|
}], isOpen: [{
|
|
708
632
|
type: HostBinding,
|
|
709
633
|
args: ['class.is-open']
|
|
710
|
-
}], _popoutLeft: [{
|
|
711
|
-
type: HostBinding,
|
|
712
|
-
args: ['class.popout-left']
|
|
713
|
-
}], _popoutUp: [{
|
|
714
|
-
type: HostBinding,
|
|
715
|
-
args: ['class.popout-up']
|
|
716
634
|
}], clicked: [{
|
|
717
635
|
type: HostBinding,
|
|
718
636
|
args: ['class.clicked']
|
|
@@ -749,6 +667,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
749
667
|
}], _onTouchStart: [{
|
|
750
668
|
type: HostListener,
|
|
751
669
|
args: ['touchstart', ['$event']]
|
|
670
|
+
}], _onFocusOut: [{
|
|
671
|
+
type: HostListener,
|
|
672
|
+
args: ['focusout', ['$event']]
|
|
752
673
|
}], _onEnterOrEscape: [{
|
|
753
674
|
type: HostListener,
|
|
754
675
|
args: ['keydown.enter']
|
|
@@ -782,8 +703,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
782
703
|
}] } });
|
|
783
704
|
|
|
784
705
|
class DropdownModule {
|
|
785
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.
|
|
786
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.
|
|
706
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: DropdownModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
707
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.1.4", ngImport: i0, type: DropdownModule, imports: [CardModule,
|
|
787
708
|
IconModule,
|
|
788
709
|
ItemModule,
|
|
789
710
|
PopoverComponent,
|
|
@@ -791,7 +712,7 @@ class DropdownModule {
|
|
|
791
712
|
CommonModule,
|
|
792
713
|
ListModule,
|
|
793
714
|
DropdownComponent], exports: [DropdownComponent, ListItemTemplateDirective] }); }
|
|
794
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.
|
|
715
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: DropdownModule, providers: [KeyboardHandlerService], imports: [CardModule,
|
|
795
716
|
IconModule,
|
|
796
717
|
ItemModule,
|
|
797
718
|
PopoverComponent,
|
|
@@ -800,7 +721,7 @@ class DropdownModule {
|
|
|
800
721
|
ListModule,
|
|
801
722
|
DropdownComponent] }); }
|
|
802
723
|
}
|
|
803
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.
|
|
724
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.4", ngImport: i0, type: DropdownModule, decorators: [{
|
|
804
725
|
type: NgModule,
|
|
805
726
|
args: [{
|
|
806
727
|
imports: [
|
|
@@ -822,5 +743,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImpor
|
|
|
822
743
|
* Generated bundle index. Do not edit.
|
|
823
744
|
*/
|
|
824
745
|
|
|
825
|
-
export { DropdownComponent, DropdownModule, KeyboardHandlerService, OpenState
|
|
746
|
+
export { DropdownComponent, DropdownModule, KeyboardHandlerService, OpenState };
|
|
826
747
|
//# sourceMappingURL=kirbydesign-designsystem-dropdown.mjs.map
|