@kirbydesign/designsystem 11.11.3 → 12.0.0-dev-67d5287
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 +246 -135
- package/fesm2022/kirbydesign-designsystem-accordion.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-action-group.mjs +229 -134
- package/fesm2022/kirbydesign-designsystem-action-group.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-avatar.mjs +102 -55
- package/fesm2022/kirbydesign-designsystem-avatar.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-badge.mjs +85 -42
- package/fesm2022/kirbydesign-designsystem-badge.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-button.mjs +203 -170
- package/fesm2022/kirbydesign-designsystem-button.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-calendar.mjs +524 -516
- package/fesm2022/kirbydesign-designsystem-calendar.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-card.mjs +439 -205
- package/fesm2022/kirbydesign-designsystem-card.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-chart.mjs +1388 -1469
- package/fesm2022/kirbydesign-designsystem-chart.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-checkbox.mjs +215 -176
- package/fesm2022/kirbydesign-designsystem-checkbox.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-config.mjs +50 -96
- package/fesm2022/kirbydesign-designsystem-config.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-data-table.mjs +180 -83
- package/fesm2022/kirbydesign-designsystem-data-table.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-divider.mjs +46 -19
- package/fesm2022/kirbydesign-designsystem-divider.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-dropdown.mjs +878 -752
- package/fesm2022/kirbydesign-designsystem-dropdown.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-empty-state.mjs +164 -91
- package/fesm2022/kirbydesign-designsystem-empty-state.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs +213 -85
- package/fesm2022/kirbydesign-designsystem-fab-sheet.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-flag.mjs +67 -33
- package/fesm2022/kirbydesign-designsystem-flag.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-form-field.mjs +1260 -901
- package/fesm2022/kirbydesign-designsystem-form-field.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-gesture.mjs +38 -23
- package/fesm2022/kirbydesign-designsystem-gesture.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-header.mjs +422 -182
- package/fesm2022/kirbydesign-designsystem-header.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs +16 -14
- package/fesm2022/kirbydesign-designsystem-helpers-scss.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-helpers.mjs +251 -361
- package/fesm2022/kirbydesign-designsystem-helpers.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-icon.mjs +881 -303
- package/fesm2022/kirbydesign-designsystem-icon.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-item-group.mjs +52 -23
- package/fesm2022/kirbydesign-designsystem-item-group.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-item-sliding.mjs +147 -43
- package/fesm2022/kirbydesign-designsystem-item-sliding.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-item.mjs +395 -151
- package/fesm2022/kirbydesign-designsystem-item.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-kirby-app.mjs +136 -54
- package/fesm2022/kirbydesign-designsystem-kirby-app.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-list.mjs +1185 -697
- package/fesm2022/kirbydesign-designsystem-list.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs +166 -76
- package/fesm2022/kirbydesign-designsystem-loading-overlay.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-menu.mjs +420 -311
- package/fesm2022/kirbydesign-designsystem-menu.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-modal.mjs +2467 -1912
- package/fesm2022/kirbydesign-designsystem-modal.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-page.mjs +1505 -905
- package/fesm2022/kirbydesign-designsystem-page.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-popover.mjs +203 -183
- package/fesm2022/kirbydesign-designsystem-popover.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-progress-circle.mjs +209 -121
- package/fesm2022/kirbydesign-designsystem-progress-circle.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-radio.mjs +537 -365
- package/fesm2022/kirbydesign-designsystem-radio.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-range.mjs +207 -150
- package/fesm2022/kirbydesign-designsystem-range.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-reorder-list.mjs +217 -104
- package/fesm2022/kirbydesign-designsystem-reorder-list.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-router-outlet.mjs +113 -38
- package/fesm2022/kirbydesign-designsystem-router-outlet.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-section-header.mjs +56 -18
- package/fesm2022/kirbydesign-designsystem-section-header.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-segmented-control.mjs +276 -232
- package/fesm2022/kirbydesign-designsystem-segmented-control.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-shared-floating.mjs +319 -382
- package/fesm2022/kirbydesign-designsystem-shared-floating.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-shared-portal.mjs +73 -84
- package/fesm2022/kirbydesign-designsystem-shared-portal.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-shared.mjs +665 -529
- package/fesm2022/kirbydesign-designsystem-shared.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-slide-button.mjs +140 -91
- package/fesm2022/kirbydesign-designsystem-slide-button.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-slide.mjs +360 -158
- package/fesm2022/kirbydesign-designsystem-slide.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-spinner.mjs +90 -32
- package/fesm2022/kirbydesign-designsystem-spinner.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs +348 -181
- package/fesm2022/kirbydesign-designsystem-tab-navigation.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-tabs.mjs +286 -121
- package/fesm2022/kirbydesign-designsystem-tabs.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-testing-base.mjs +6232 -3164
- package/fesm2022/kirbydesign-designsystem-testing-base.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs +118 -95
- package/fesm2022/kirbydesign-designsystem-testing-jasmine.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-testing-jest.mjs +128 -101
- package/fesm2022/kirbydesign-designsystem-testing-jest.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-testing.mjs +236 -243
- package/fesm2022/kirbydesign-designsystem-testing.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-toast.mjs +98 -62
- package/fesm2022/kirbydesign-designsystem-toast.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-toggle-button.mjs +155 -127
- package/fesm2022/kirbydesign-designsystem-toggle-button.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-toggle.mjs +180 -150
- package/fesm2022/kirbydesign-designsystem-toggle.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem-types.mjs +39 -24
- package/fesm2022/kirbydesign-designsystem-types.mjs.map +1 -1
- package/fesm2022/kirbydesign-designsystem.mjs +516 -407
- package/fesm2022/kirbydesign-designsystem.mjs.map +1 -1
- package/icons/svg/megaphone.svg +3 -0
- package/package.json +10 -10
- package/readme.md +37 -0
- package/types/kirbydesign-designsystem-accordion.d.ts +72 -39
- package/types/kirbydesign-designsystem-accordion.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-action-group.d.ts +46 -39
- package/types/kirbydesign-designsystem-action-group.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-avatar.d.ts +62 -26
- package/types/kirbydesign-designsystem-avatar.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-badge.d.ts +30 -19
- package/types/kirbydesign-designsystem-badge.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-button.d.ts +70 -45
- package/types/kirbydesign-designsystem-button.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-calendar.d.ts +193 -132
- package/types/kirbydesign-designsystem-calendar.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-card.d.ts +130 -66
- package/types/kirbydesign-designsystem-card.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-chart.d.ts +198 -172
- package/types/kirbydesign-designsystem-chart.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-checkbox.d.ts +96 -68
- package/types/kirbydesign-designsystem-checkbox.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-config.d.ts +17 -21
- package/types/kirbydesign-designsystem-config.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-data-table.d.ts +46 -26
- package/types/kirbydesign-designsystem-data-table.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-divider.d.ts +11 -9
- package/types/kirbydesign-designsystem-divider.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-dropdown.d.ts +219 -166
- package/types/kirbydesign-designsystem-dropdown.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-empty-state.d.ts +47 -35
- package/types/kirbydesign-designsystem-empty-state.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-fab-sheet.d.ts +34 -28
- package/types/kirbydesign-designsystem-fab-sheet.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-flag.d.ts +18 -13
- package/types/kirbydesign-designsystem-flag.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-form-field.d.ts +409 -242
- package/types/kirbydesign-designsystem-form-field.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-gesture.d.ts +41 -46
- package/types/kirbydesign-designsystem-gesture.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-header.d.ts +102 -64
- package/types/kirbydesign-designsystem-header.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-helpers-scss.d.ts +6 -8
- package/types/kirbydesign-designsystem-helpers-scss.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-helpers.d.ts +83 -97
- package/types/kirbydesign-designsystem-helpers.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-icon.d.ts +63 -59
- package/types/kirbydesign-designsystem-icon.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-item-group.d.ts +6 -9
- package/types/kirbydesign-designsystem-item-group.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-item-sliding.d.ts +30 -26
- package/types/kirbydesign-designsystem-item-sliding.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-item.d.ts +93 -54
- package/types/kirbydesign-designsystem-item.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-kirby-app.d.ts +18 -19
- package/types/kirbydesign-designsystem-kirby-app.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-list.d.ts +387 -263
- package/types/kirbydesign-designsystem-list.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-loading-overlay.d.ts +35 -24
- package/types/kirbydesign-designsystem-loading-overlay.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-menu.d.ts +119 -69
- package/types/kirbydesign-designsystem-menu.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-modal.d.ts +577 -455
- package/types/kirbydesign-designsystem-modal.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-page.d.ts +304 -226
- package/types/kirbydesign-designsystem-page.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-popover.d.ts +48 -40
- package/types/kirbydesign-designsystem-popover.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-progress-circle.d.ts +60 -38
- package/types/kirbydesign-designsystem-progress-circle.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-radio.d.ts +147 -98
- package/types/kirbydesign-designsystem-radio.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-range.d.ts +90 -45
- package/types/kirbydesign-designsystem-range.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-reorder-list.d.ts +44 -32
- package/types/kirbydesign-designsystem-reorder-list.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-router-outlet.d.ts +23 -18
- package/types/kirbydesign-designsystem-router-outlet.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-section-header.d.ts +5 -8
- package/types/kirbydesign-designsystem-section-header.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-segmented-control.d.ts +123 -100
- package/types/kirbydesign-designsystem-segmented-control.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-shared-floating.d.ts +183 -128
- package/types/kirbydesign-designsystem-shared-floating.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-shared-portal.d.ts +29 -28
- package/types/kirbydesign-designsystem-shared-portal.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-shared.d.ts +143 -139
- package/types/kirbydesign-designsystem-shared.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-slide-button.d.ts +43 -34
- package/types/kirbydesign-designsystem-slide-button.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-slide.d.ts +80 -59
- package/types/kirbydesign-designsystem-slide.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-spinner.d.ts +13 -14
- package/types/kirbydesign-designsystem-spinner.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-tab-navigation.d.ts +78 -55
- package/types/kirbydesign-designsystem-tab-navigation.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-tabs.d.ts +50 -45
- package/types/kirbydesign-designsystem-tabs.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-testing-base.d.ts +2430 -815
- package/types/kirbydesign-designsystem-testing-base.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-testing-jasmine.d.ts +9 -10
- package/types/kirbydesign-designsystem-testing-jasmine.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-testing-jest.d.ts +9 -10
- package/types/kirbydesign-designsystem-testing-jest.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-testing.d.ts +52 -58
- package/types/kirbydesign-designsystem-testing.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-toast.d.ts +25 -31
- package/types/kirbydesign-designsystem-toast.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-toggle-button.d.ts +62 -56
- package/types/kirbydesign-designsystem-toggle-button.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-toggle.d.ts +71 -63
- package/types/kirbydesign-designsystem-toggle.d.ts.map +1 -1
- package/types/kirbydesign-designsystem-types.d.ts +15 -22
- package/types/kirbydesign-designsystem-types.d.ts.map +1 -1
- package/types/kirbydesign-designsystem.d.ts +135 -123
- package/types/kirbydesign-designsystem.d.ts.map +1 -1
- package/accordion/package.json +0 -4
- package/action-group/package.json +0 -4
- package/avatar/package.json +0 -4
- package/badge/package.json +0 -4
- package/button/package.json +0 -4
- package/calendar/package.json +0 -4
- package/card/package.json +0 -4
- package/chart/package.json +0 -4
- package/checkbox/package.json +0 -4
- package/config/package.json +0 -4
- package/data-table/package.json +0 -4
- package/divider/package.json +0 -4
- package/dropdown/package.json +0 -4
- package/empty-state/package.json +0 -4
- package/fab-sheet/package.json +0 -4
- package/flag/package.json +0 -4
- package/form-field/package.json +0 -4
- package/gesture/package.json +0 -4
- package/header/package.json +0 -4
- package/helpers/package.json +0 -4
- package/helpers/scss/package.json +0 -4
- package/icon/package.json +0 -4
- package/item/package.json +0 -4
- package/item-group/package.json +0 -4
- package/item-sliding/package.json +0 -4
- package/kirby-app/package.json +0 -4
- package/list/package.json +0 -4
- package/loading-overlay/package.json +0 -4
- package/menu/package.json +0 -4
- package/modal/package.json +0 -4
- package/page/package.json +0 -4
- package/popover/package.json +0 -4
- package/progress-circle/package.json +0 -4
- package/radio/package.json +0 -4
- package/range/package.json +0 -4
- package/reorder-list/package.json +0 -4
- package/router-outlet/package.json +0 -4
- package/section-header/package.json +0 -4
- package/segmented-control/package.json +0 -4
- package/shared/floating/package.json +0 -4
- package/shared/package.json +0 -4
- package/shared/portal/package.json +0 -4
- package/slide/package.json +0 -4
- package/slide-button/package.json +0 -4
- package/spinner/package.json +0 -4
- package/tab-navigation/package.json +0 -4
- package/tabs/package.json +0 -4
- package/testing/package.json +0 -4
- package/testing-base/package.json +0 -4
- package/testing-jasmine/package.json +0 -4
- package/testing-jest/package.json +0 -4
- package/toast/package.json +0 -4
- package/toggle/package.json +0 -4
- package/toggle-button/package.json +0 -4
- package/types/package.json +0 -4
|
@@ -1,189 +1,209 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { ElementRef, EventEmitter,
|
|
3
|
-
import { DesignTokenHelper } from
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
offsetFromEdge: offset,
|
|
15
|
-
availableMaxHeightInDirection: availableSpace - bodyPadding,
|
|
16
|
-
};
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, HostListener, Input, Output, RendererStyleFlags2, ViewChild } from "@angular/core";
|
|
3
|
+
import { DesignTokenHelper } from "@kirbydesign/designsystem/helpers";
|
|
4
|
+
function calculateVerticalPopoverPosition({ viewportHeight, targetTop, targetBottom, contentHeight, bodyPadding }) {
|
|
5
|
+
const availableSpaceBelow = viewportHeight - targetBottom;
|
|
6
|
+
const availableSpaceAbove = targetTop;
|
|
7
|
+
const opensUpwards = !(availableSpaceBelow >= contentHeight + bodyPadding) && availableSpaceBelow < availableSpaceAbove;
|
|
8
|
+
const availableSpace = opensUpwards ? availableSpaceAbove : availableSpaceBelow;
|
|
9
|
+
return {
|
|
10
|
+
opensUpwards,
|
|
11
|
+
offsetFromEdge: opensUpwards ? viewportHeight - targetTop : targetBottom,
|
|
12
|
+
availableMaxHeightInDirection: availableSpace - bodyPadding
|
|
13
|
+
};
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
var HorizontalDirection;
|
|
20
|
-
(function
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
(function(HorizontalDirection) {
|
|
17
|
+
HorizontalDirection["right"] = "right";
|
|
18
|
+
HorizontalDirection["left"] = "left";
|
|
23
19
|
})(HorizontalDirection || (HorizontalDirection = {}));
|
|
24
|
-
class PopoverComponent {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
20
|
+
var PopoverComponent = class PopoverComponent {
|
|
21
|
+
get targetElement() {
|
|
22
|
+
if (this.target instanceof ElementRef) return this.target.nativeElement;
|
|
23
|
+
else return this.target;
|
|
24
|
+
}
|
|
25
|
+
_onWindowResize() {
|
|
26
|
+
this.hide();
|
|
27
|
+
}
|
|
28
|
+
constructor(elementRef, renderer) {
|
|
29
|
+
this.elementRef = elementRef;
|
|
30
|
+
this.renderer = renderer;
|
|
31
|
+
this.preventScrollEventListenerOptions = { passive: false };
|
|
32
|
+
this.POPOVER_BODY_PADDING = 12;
|
|
33
|
+
this.isShowing = false;
|
|
34
|
+
this.openingFrameId = null;
|
|
35
|
+
this.popout = HorizontalDirection.right;
|
|
36
|
+
this.willHide = new EventEmitter();
|
|
37
|
+
this.document = elementRef.nativeElement.ownerDocument;
|
|
38
|
+
}
|
|
39
|
+
ngAfterViewInit() {
|
|
40
|
+
this.placePopoverAboveClosestModal();
|
|
41
|
+
this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
|
|
42
|
+
}
|
|
43
|
+
ngOnDestroy() {
|
|
44
|
+
this.hide();
|
|
45
|
+
}
|
|
46
|
+
placePopoverAboveClosestModal() {
|
|
47
|
+
const closestIonModal = this.elementRef.nativeElement.closest("ion-modal");
|
|
48
|
+
if (closestIonModal) {
|
|
49
|
+
this.zIndex = parseInt(closestIonModal.style.zIndex) + 1;
|
|
50
|
+
this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;
|
|
51
|
+
} else this.zIndex = parseInt(DesignTokenHelper.zLayer("popover"));
|
|
52
|
+
}
|
|
53
|
+
static preventEventOutsidePopover(event) {
|
|
54
|
+
if (event.target instanceof HTMLElement) {
|
|
55
|
+
if (!!!event.target.closest("kirby-popover")) event.preventDefault();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
preventScroll() {
|
|
59
|
+
this.isFirstToLockScroll = !this.document.body.classList.contains("backdrop-no-scroll");
|
|
60
|
+
if (this.isFirstToLockScroll) this.renderer.addClass(this.document.body, "backdrop-no-scroll");
|
|
61
|
+
this.disposeTouchMoveListener = this.renderer.listen(this.document, "touchmove", PopoverComponent.preventEventOutsidePopover, this.preventScrollEventListenerOptions);
|
|
62
|
+
}
|
|
63
|
+
releaseScroll() {
|
|
64
|
+
if (this.isFirstToLockScroll) this.renderer.removeClass(this.document.body, "backdrop-no-scroll");
|
|
65
|
+
this.disposeTouchMoveListener?.();
|
|
66
|
+
}
|
|
67
|
+
show() {
|
|
68
|
+
this.renderer.addClass(this.elementRef.nativeElement, "is-opening");
|
|
69
|
+
this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
|
|
70
|
+
this.preventScroll();
|
|
71
|
+
this.isShowing = true;
|
|
72
|
+
this.openingFrameId = requestAnimationFrame(() => {
|
|
73
|
+
this.openingFrameId = null;
|
|
74
|
+
if (!this.isShowing) return;
|
|
75
|
+
this.positionWrapper();
|
|
76
|
+
this.renderer.addClass(this.elementRef.nativeElement, "is-open");
|
|
77
|
+
this.renderer.removeClass(this.elementRef.nativeElement, "is-opening");
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
hide() {
|
|
81
|
+
if (!this.isShowing) return;
|
|
82
|
+
if (this.openingFrameId !== null) {
|
|
83
|
+
cancelAnimationFrame(this.openingFrameId);
|
|
84
|
+
this.openingFrameId = null;
|
|
85
|
+
this.renderer.removeClass(this.elementRef.nativeElement, "is-opening");
|
|
86
|
+
}
|
|
87
|
+
this.willHide.emit();
|
|
88
|
+
this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
|
|
89
|
+
this.releaseScroll();
|
|
90
|
+
this.renderer.removeStyle(this.targetElement, "z-index");
|
|
91
|
+
this.renderer.removeStyle(this.targetElement, "pointer-events");
|
|
92
|
+
this.isShowing = false;
|
|
93
|
+
}
|
|
94
|
+
positionWrapper() {
|
|
95
|
+
const targetDimensions = this.targetElement.getBoundingClientRect();
|
|
96
|
+
this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);
|
|
97
|
+
const wrapperElement = this.wrapperElement.nativeElement;
|
|
98
|
+
const wrapperDimensions = wrapperElement.getBoundingClientRect();
|
|
99
|
+
const viewport = wrapperElement.ownerDocument.defaultView;
|
|
100
|
+
this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);
|
|
101
|
+
this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);
|
|
102
|
+
}
|
|
103
|
+
positionHorizontally(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
|
|
104
|
+
const viewPortWidth = viewPort.innerWidth;
|
|
105
|
+
const contentWidth = wrapperDimensions.width;
|
|
106
|
+
const availableSpaceRight = viewPortWidth - targetDimensions.left;
|
|
107
|
+
const availableSpaceLeft = targetDimensions.right;
|
|
108
|
+
const openRight = availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING || availableSpaceRight >= availableSpaceLeft;
|
|
109
|
+
const [direction, oppositeDirection] = this.popout === HorizontalDirection.left || !openRight ? ["left", "right"] : ["right", "left"];
|
|
110
|
+
const pxValue = direction === "left" ? viewPortWidth - targetDimensions.right : targetDimensions.left;
|
|
111
|
+
this.renderer.removeStyle(wrapperElement, direction);
|
|
112
|
+
this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);
|
|
113
|
+
}
|
|
114
|
+
positionVertically(viewPort, wrapperElement, targetDimensions, wrapperDimensions) {
|
|
115
|
+
const { opensUpwards, offsetFromEdge, availableMaxHeightInDirection } = calculateVerticalPopoverPosition({
|
|
116
|
+
viewportHeight: viewPort.innerHeight,
|
|
117
|
+
targetTop: targetDimensions.top,
|
|
118
|
+
targetBottom: targetDimensions.bottom,
|
|
119
|
+
contentHeight: wrapperDimensions.height,
|
|
120
|
+
bodyPadding: this.POPOVER_BODY_PADDING
|
|
121
|
+
});
|
|
122
|
+
const anchoredEdge = opensUpwards ? "bottom" : "top";
|
|
123
|
+
const oppositeEdge = opensUpwards ? "top" : "bottom";
|
|
124
|
+
this.renderer.removeStyle(wrapperElement, oppositeEdge);
|
|
125
|
+
this.renderer.setStyle(wrapperElement, anchoredEdge, `${offsetFromEdge}px`);
|
|
126
|
+
this.renderer.setStyle(wrapperElement, "--kirby-popover-available-max-height", `${availableMaxHeightInDirection}px`, RendererStyleFlags2.DashCase);
|
|
127
|
+
if (opensUpwards) {
|
|
128
|
+
this.renderer.setStyle(this.targetElement, "z-index", `${this.zIndex + 1}`);
|
|
129
|
+
this.renderer.setStyle(this.targetElement, "pointer-events", "none");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
static {
|
|
133
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
134
|
+
minVersion: "12.0.0",
|
|
135
|
+
version: "22.2.2",
|
|
136
|
+
ngImport: i0,
|
|
137
|
+
type: PopoverComponent,
|
|
138
|
+
deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }],
|
|
139
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
static {
|
|
143
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
144
|
+
minVersion: "14.0.0",
|
|
145
|
+
version: "22.2.2",
|
|
146
|
+
type: PopoverComponent,
|
|
147
|
+
isStandalone: true,
|
|
148
|
+
selector: "kirby-popover",
|
|
149
|
+
inputs: {
|
|
150
|
+
popout: "popout",
|
|
151
|
+
target: "target"
|
|
152
|
+
},
|
|
153
|
+
outputs: { willHide: "willHide" },
|
|
154
|
+
host: { listeners: { "window:resize": "_onWindowResize()" } },
|
|
155
|
+
viewQueries: [{
|
|
156
|
+
propertyName: "wrapperElement",
|
|
157
|
+
first: true,
|
|
158
|
+
predicate: ["wrapper"],
|
|
159
|
+
descendants: true,
|
|
160
|
+
read: ElementRef,
|
|
161
|
+
static: true
|
|
162
|
+
}],
|
|
163
|
+
ngImport: i0,
|
|
164
|
+
template: `
|
|
162
165
|
<div #wrapper class="wrapper"><ng-content></ng-content></div>
|
|
163
|
-
`,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
`,
|
|
167
|
+
isInline: true,
|
|
168
|
+
styles: [":host{display:none;position:fixed;inset:0;z-index:var(--kirby-z-index-popover)}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:var(--kirby-spacing-xxxs);margin-bottom:var(--kirby-spacing-xxxs)}\n"],
|
|
169
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
174
|
+
minVersion: "12.0.0",
|
|
175
|
+
version: "22.2.2",
|
|
176
|
+
ngImport: i0,
|
|
177
|
+
type: PopoverComponent,
|
|
178
|
+
decorators: [{
|
|
179
|
+
type: Component,
|
|
180
|
+
args: [{
|
|
181
|
+
selector: "kirby-popover",
|
|
182
|
+
template: `
|
|
168
183
|
<div #wrapper class="wrapper"><ng-content></ng-content></div>
|
|
169
|
-
`,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
`,
|
|
185
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
186
|
+
styles: [":host{display:none;position:fixed;inset:0;z-index:var(--kirby-z-index-popover)}:host(.is-opening){display:block;visibility:hidden}:host(.is-open){display:block}.wrapper{position:fixed;margin-top:var(--kirby-spacing-xxxs);margin-bottom:var(--kirby-spacing-xxxs)}\n"]
|
|
187
|
+
}]
|
|
188
|
+
}],
|
|
189
|
+
ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }],
|
|
190
|
+
propDecorators: {
|
|
191
|
+
wrapperElement: [{
|
|
192
|
+
type: ViewChild,
|
|
193
|
+
args: ["wrapper", {
|
|
194
|
+
static: true,
|
|
195
|
+
read: ElementRef
|
|
196
|
+
}]
|
|
197
|
+
}],
|
|
198
|
+
popout: [{ type: Input }],
|
|
199
|
+
target: [{ type: Input }],
|
|
200
|
+
willHide: [{ type: Output }],
|
|
201
|
+
_onWindowResize: [{
|
|
202
|
+
type: HostListener,
|
|
203
|
+
args: ["window:resize"]
|
|
204
|
+
}]
|
|
205
|
+
}
|
|
206
|
+
});
|
|
188
207
|
export { HorizontalDirection, PopoverComponent };
|
|
189
|
-
|
|
208
|
+
|
|
209
|
+
//# sourceMappingURL=kirbydesign-designsystem-popover.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kirbydesign-designsystem-popover.mjs","sources":["../../popover/src/popover.helper.ts","../../popover/src/popover.component.ts","../../popover/src/kirbydesign-designsystem-popover.ts"],"sourcesContent":["export interface VerticalPositionInput {\n viewportHeight: number;\n targetTop: number;\n targetBottom: number;\n contentHeight: number;\n bodyPadding: number;\n}\n\nexport interface VerticalPosition {\n opensUpwards: boolean;\n offsetFromEdge: number;\n availableMaxHeightInDirection: number;\n}\n\nexport function calculateVerticalPopoverPosition({\n viewportHeight,\n targetTop,\n targetBottom,\n contentHeight,\n bodyPadding,\n}: VerticalPositionInput): VerticalPosition {\n const availableSpaceBelow = viewportHeight - targetBottom;\n const availableSpaceAbove = targetTop;\n const contentFitsBelow = availableSpaceBelow >= contentHeight + bodyPadding;\n const opensUpwards = !contentFitsBelow && availableSpaceBelow < availableSpaceAbove;\n\n const availableSpace = opensUpwards ? availableSpaceAbove : availableSpaceBelow;\n const offset = opensUpwards ? viewportHeight - targetTop : targetBottom;\n\n return {\n opensUpwards,\n offsetFromEdge: offset,\n availableMaxHeightInDirection: availableSpace - bodyPadding,\n };\n}\n","import {\n AfterViewInit,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnDestroy,\n Output,\n Renderer2,\n RendererStyleFlags2,\n ViewChild,\n} from '@angular/core';\nimport { EventListenerDisposeFn } from '@kirbydesign/designsystem/types';\nimport { DesignTokenHelper } from '@kirbydesign/designsystem/helpers';\n\nimport { calculateVerticalPopoverPosition } from './popover.helper';\n\nexport enum HorizontalDirection {\n right = 'right',\n left = 'left',\n}\n\n@Component({\n selector: 'kirby-popover',\n template: `\n <div #wrapper class=\"wrapper\"><ng-content></ng-content></div>\n `,\n styleUrls: ['./popover.component.scss'],\n})\nexport class PopoverComponent implements AfterViewInit, OnDestroy {\n // removeEventListener same instance of event handler & options\n private readonly preventScrollEventListenerOptions = {\n passive: false,\n } as EventListenerOptions;\n\n private readonly POPOVER_BODY_PADDING = 12;\n\n private isShowing: boolean = false;\n private isFirstToLockScroll: boolean;\n private zIndex: number;\n private document: Document;\n private openingFrameId: ReturnType<typeof requestAnimationFrame> | null = null;\n\n @ViewChild('wrapper', { static: true, read: ElementRef })\n wrapperElement: ElementRef<HTMLDivElement>;\n\n @Input()\n popout: HorizontalDirection | `${HorizontalDirection}` = HorizontalDirection.right;\n\n @Input()\n target: HTMLElement | ElementRef<HTMLElement>;\n\n @Output()\n willHide = new EventEmitter<void>();\n\n private get targetElement(): HTMLElement {\n if (this.target instanceof ElementRef) {\n return this.target.nativeElement;\n } else {\n return this.target;\n }\n }\n\n @HostListener('window:resize')\n _onWindowResize() {\n this.hide();\n }\n\n private disposeTouchMoveListener: EventListenerDisposeFn;\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private renderer: Renderer2\n ) {\n this.document = elementRef.nativeElement.ownerDocument;\n }\n\n ngAfterViewInit(): void {\n this.placePopoverAboveClosestModal();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n }\n\n ngOnDestroy(): void {\n this.hide();\n }\n\n private placePopoverAboveClosestModal() {\n const closestIonModal = this.elementRef.nativeElement.closest('ion-modal');\n if (closestIonModal) {\n this.zIndex = parseInt((closestIonModal as HTMLElement).style.zIndex) + 1;\n this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;\n } else {\n this.zIndex = parseInt(DesignTokenHelper.zLayer('popover'));\n }\n }\n\n private static preventEventOutsidePopover(event: TouchEvent) {\n if (event.target instanceof HTMLElement) {\n const targetIsInPopover = !!event.target.closest('kirby-popover');\n if (!targetIsInPopover) {\n event.preventDefault();\n }\n }\n }\n\n private preventScroll() {\n this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');\n if (this.isFirstToLockScroll) {\n this.renderer.addClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener = this.renderer.listen(\n this.document,\n 'touchmove',\n PopoverComponent.preventEventOutsidePopover,\n this.preventScrollEventListenerOptions\n );\n }\n\n private releaseScroll() {\n if (this.isFirstToLockScroll) {\n this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener?.();\n }\n\n show() {\n this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n this.preventScroll();\n this.isShowing = true;\n\n this.openingFrameId = requestAnimationFrame(() => {\n this.openingFrameId = null;\n if (!this.isShowing) return;\n this.positionWrapper();\n this.renderer.addClass(this.elementRef.nativeElement, 'is-open');\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n });\n }\n\n hide() {\n if (!this.isShowing) return;\n\n if (this.openingFrameId !== null) {\n cancelAnimationFrame(this.openingFrameId);\n this.openingFrameId = null;\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n }\n\n this.willHide.emit();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n this.releaseScroll();\n\n this.renderer.removeStyle(this.targetElement, 'z-index');\n this.renderer.removeStyle(this.targetElement, 'pointer-events');\n this.isShowing = false;\n }\n\n private positionWrapper() {\n const targetDimensions = this.targetElement.getBoundingClientRect();\n\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n const wrapperElement = this.wrapperElement.nativeElement;\n const wrapperDimensions = wrapperElement.getBoundingClientRect();\n const viewport = wrapperElement.ownerDocument.defaultView;\n this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n }\n\n private positionHorizontally(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const viewPortWidth = viewPort.innerWidth;\n const contentWidth = wrapperDimensions.width;\n const availableSpaceRight = viewPortWidth - targetDimensions.left;\n const availableSpaceLeft = targetDimensions.right;\n const contentCanFitRightOfTarget =\n availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING;\n const openRight = contentCanFitRightOfTarget || availableSpaceRight >= availableSpaceLeft;\n\n const [direction, oppositeDirection] =\n this.popout === HorizontalDirection.left || !openRight\n ? ['left', 'right']\n : ['right', 'left'];\n\n const pxValue =\n direction === 'left' ? viewPortWidth - targetDimensions.right : targetDimensions.left;\n\n this.renderer.removeStyle(wrapperElement, direction);\n this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);\n }\n\n private positionVertically(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const { opensUpwards, offsetFromEdge, availableMaxHeightInDirection } =\n calculateVerticalPopoverPosition({\n viewportHeight: viewPort.innerHeight,\n targetTop: targetDimensions.top,\n targetBottom: targetDimensions.bottom,\n contentHeight: wrapperDimensions.height,\n bodyPadding: this.POPOVER_BODY_PADDING,\n });\n\n const anchoredEdge = opensUpwards ? 'bottom' : 'top';\n const oppositeEdge = opensUpwards ? 'top' : 'bottom';\n\n this.renderer.removeStyle(wrapperElement, oppositeEdge);\n this.renderer.setStyle(wrapperElement, anchoredEdge, `${offsetFromEdge}px`);\n\n // Constrain content to the space available in the chosen direction so it can't grow outside the viewport.\n this.renderer.setStyle(\n wrapperElement,\n '--kirby-popover-available-max-height',\n `${availableMaxHeightInDirection}px`,\n RendererStyleFlags2.DashCase\n );\n\n if (opensUpwards) {\n // Ensure target is elevated above shadows in popover, i.e. content wrapped in Card:\n this.renderer.setStyle(this.targetElement, 'z-index', `${this.zIndex + 1}`);\n this.renderer.setStyle(this.targetElement, 'pointer-events', 'none');\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;AAcM,SAAU,gCAAgC,CAAC,EAC/C,cAAc,EACd,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,GACW,EAAA;AACtB,IAA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EAAA,MAAA,EAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,QAAA,EAAA,EAAA,OAAA,EAAA,EAAA,QAAA,EAAA,UAAA,EAAA,EAAA,IAAA,EAAA,EAAA,SAAA,EAAA,EAAA,eAAA,EAAA,mBAAA,EAAA,EAAA,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,gBAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,SAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,IAAA,EAciB,UAAU,EAAA,MAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAnB5C;;AAET,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,yQAAA,CAAA,EAAA,CAAA,CAAA;;4FAGU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAP5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,eAAe,EAAA,QAAA,EACf;;AAET,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,yQAAA,CAAA,EAAA;;sBAiBA,SAAS;uBAAC,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE;;sBAGvD;;sBAGA;;sBAGA;;sBAWA,YAAY;uBAAC,eAAe;;;AChE/B;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"kirbydesign-designsystem-popover.mjs","names":[],"sources":["../../popover/src/popover.helper.ts","../../popover/src/popover.component.ts"],"sourcesContent":["export interface VerticalPositionInput {\n viewportHeight: number;\n targetTop: number;\n targetBottom: number;\n contentHeight: number;\n bodyPadding: number;\n}\n\nexport interface VerticalPosition {\n opensUpwards: boolean;\n offsetFromEdge: number;\n availableMaxHeightInDirection: number;\n}\n\nexport function calculateVerticalPopoverPosition({\n viewportHeight,\n targetTop,\n targetBottom,\n contentHeight,\n bodyPadding,\n}: VerticalPositionInput): VerticalPosition {\n const availableSpaceBelow = viewportHeight - targetBottom;\n const availableSpaceAbove = targetTop;\n const contentFitsBelow = availableSpaceBelow >= contentHeight + bodyPadding;\n const opensUpwards = !contentFitsBelow && availableSpaceBelow < availableSpaceAbove;\n\n const availableSpace = opensUpwards ? availableSpaceAbove : availableSpaceBelow;\n const offset = opensUpwards ? viewportHeight - targetTop : targetBottom;\n\n return {\n opensUpwards,\n offsetFromEdge: offset,\n availableMaxHeightInDirection: availableSpace - bodyPadding,\n };\n}\n","import {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n HostListener,\n Input,\n OnDestroy,\n Output,\n Renderer2,\n RendererStyleFlags2,\n ViewChild,\n} from '@angular/core';\nimport { EventListenerDisposeFn } from '@kirbydesign/designsystem/types';\nimport { DesignTokenHelper } from '@kirbydesign/designsystem/helpers';\n\nimport { calculateVerticalPopoverPosition } from './popover.helper';\n\nexport enum HorizontalDirection {\n right = 'right',\n left = 'left',\n}\n\n@Component({\n selector: 'kirby-popover',\n template: `\n <div #wrapper class=\"wrapper\"><ng-content></ng-content></div>\n `,\n styleUrls: ['./popover.component.scss'],\n changeDetection: ChangeDetectionStrategy.Eager,\n})\nexport class PopoverComponent implements AfterViewInit, OnDestroy {\n // removeEventListener same instance of event handler & options\n private readonly preventScrollEventListenerOptions = {\n passive: false,\n } as EventListenerOptions;\n\n private readonly POPOVER_BODY_PADDING = 12;\n\n private isShowing: boolean = false;\n private isFirstToLockScroll: boolean;\n private zIndex: number;\n private document: Document;\n private openingFrameId: ReturnType<typeof requestAnimationFrame> | null = null;\n\n @ViewChild('wrapper', { static: true, read: ElementRef })\n wrapperElement: ElementRef<HTMLDivElement>;\n\n @Input()\n popout: HorizontalDirection | `${HorizontalDirection}` = HorizontalDirection.right;\n\n @Input()\n target: HTMLElement | ElementRef<HTMLElement>;\n\n @Output()\n willHide = new EventEmitter<void>();\n\n private get targetElement(): HTMLElement {\n if (this.target instanceof ElementRef) {\n return this.target.nativeElement;\n } else {\n return this.target;\n }\n }\n\n @HostListener('window:resize')\n _onWindowResize() {\n this.hide();\n }\n\n private disposeTouchMoveListener: EventListenerDisposeFn;\n\n constructor(\n private elementRef: ElementRef<HTMLElement>,\n private renderer: Renderer2\n ) {\n this.document = elementRef.nativeElement.ownerDocument;\n }\n\n ngAfterViewInit(): void {\n this.placePopoverAboveClosestModal();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n }\n\n ngOnDestroy(): void {\n this.hide();\n }\n\n private placePopoverAboveClosestModal() {\n const closestIonModal = this.elementRef.nativeElement.closest('ion-modal');\n if (closestIonModal) {\n this.zIndex = parseInt((closestIonModal as HTMLElement).style.zIndex) + 1;\n this.elementRef.nativeElement.style.zIndex = `${this.zIndex}`;\n } else {\n this.zIndex = parseInt(DesignTokenHelper.zLayer('popover'));\n }\n }\n\n private static preventEventOutsidePopover(event: TouchEvent) {\n if (event.target instanceof HTMLElement) {\n const targetIsInPopover = !!event.target.closest('kirby-popover');\n if (!targetIsInPopover) {\n event.preventDefault();\n }\n }\n }\n\n private preventScroll() {\n this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');\n if (this.isFirstToLockScroll) {\n this.renderer.addClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener = this.renderer.listen(\n this.document,\n 'touchmove',\n PopoverComponent.preventEventOutsidePopover,\n this.preventScrollEventListenerOptions\n );\n }\n\n private releaseScroll() {\n if (this.isFirstToLockScroll) {\n this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');\n }\n\n this.disposeTouchMoveListener?.();\n }\n\n public show() {\n this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n this.preventScroll();\n this.isShowing = true;\n\n this.openingFrameId = requestAnimationFrame(() => {\n this.openingFrameId = null;\n if (!this.isShowing) return;\n this.positionWrapper();\n this.renderer.addClass(this.elementRef.nativeElement, 'is-open');\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n });\n }\n\n public hide() {\n if (!this.isShowing) return;\n\n if (this.openingFrameId !== null) {\n cancelAnimationFrame(this.openingFrameId);\n this.openingFrameId = null;\n this.renderer.removeClass(this.elementRef.nativeElement, 'is-opening');\n }\n\n this.willHide.emit();\n this.renderer.removeChild(\n this.elementRef.nativeElement.parentElement,\n this.elementRef.nativeElement\n );\n this.releaseScroll();\n\n this.renderer.removeStyle(this.targetElement, 'z-index');\n this.renderer.removeStyle(this.targetElement, 'pointer-events');\n this.isShowing = false;\n }\n\n private positionWrapper() {\n const targetDimensions = this.targetElement.getBoundingClientRect();\n\n this.renderer.appendChild(this.document.body, this.elementRef.nativeElement);\n\n const wrapperElement = this.wrapperElement.nativeElement;\n const wrapperDimensions = wrapperElement.getBoundingClientRect();\n const viewport = wrapperElement.ownerDocument.defaultView;\n this.positionHorizontally(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n this.positionVertically(viewport, wrapperElement, targetDimensions, wrapperDimensions);\n }\n\n private positionHorizontally(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const viewPortWidth = viewPort.innerWidth;\n const contentWidth = wrapperDimensions.width;\n const availableSpaceRight = viewPortWidth - targetDimensions.left;\n const availableSpaceLeft = targetDimensions.right;\n const contentCanFitRightOfTarget =\n availableSpaceRight >= contentWidth + this.POPOVER_BODY_PADDING;\n const openRight = contentCanFitRightOfTarget || availableSpaceRight >= availableSpaceLeft;\n\n const [direction, oppositeDirection] =\n this.popout === HorizontalDirection.left || !openRight\n ? ['left', 'right']\n : ['right', 'left'];\n\n const pxValue =\n direction === 'left' ? viewPortWidth - targetDimensions.right : targetDimensions.left;\n\n this.renderer.removeStyle(wrapperElement, direction);\n this.renderer.setStyle(wrapperElement, oppositeDirection, `${pxValue}px`);\n }\n\n private positionVertically(\n viewPort: Window,\n wrapperElement: HTMLDivElement,\n targetDimensions: DOMRect,\n wrapperDimensions: DOMRect\n ) {\n const { opensUpwards, offsetFromEdge, availableMaxHeightInDirection } =\n calculateVerticalPopoverPosition({\n viewportHeight: viewPort.innerHeight,\n targetTop: targetDimensions.top,\n targetBottom: targetDimensions.bottom,\n contentHeight: wrapperDimensions.height,\n bodyPadding: this.POPOVER_BODY_PADDING,\n });\n\n const anchoredEdge = opensUpwards ? 'bottom' : 'top';\n const oppositeEdge = opensUpwards ? 'top' : 'bottom';\n\n this.renderer.removeStyle(wrapperElement, oppositeEdge);\n this.renderer.setStyle(wrapperElement, anchoredEdge, `${offsetFromEdge}px`);\n\n // Constrain content to the space available in the chosen direction so it can't grow outside the viewport.\n this.renderer.setStyle(\n wrapperElement,\n '--kirby-popover-available-max-height',\n `${availableMaxHeightInDirection}px`,\n RendererStyleFlags2.DashCase\n );\n\n if (opensUpwards) {\n // Ensure target is elevated above shadows in popover, i.e. content wrapped in Card:\n this.renderer.setStyle(this.targetElement, 'z-index', `${this.zIndex + 1}`);\n this.renderer.setStyle(this.targetElement, 'pointer-events', 'none');\n }\n }\n}\n"],"mappings":";;;AAcA,SAAgB,iCAAiC,EAC/C,gBACA,WACA,cACA,eACA,eACsB;CACtB,MAAM,sBAAsB,iBAAiB;CAC7C,MAAM,sBAAsB;CAE5B,MAAM,eAAe,EADI,uBAAuB,gBAAgB,gBACtB,sBAAsB;CAEhE,MAAM,iBAAiB,eAAe,sBAAsB;CAG5D,OAAO;EACL;EACA,gBAJa,eAAe,iBAAiB,YAAY;EAKzD,+BAA+B,iBAAiB;CACjD;AACH;ACfA,IAAY;CAAZ,SAAY,qBAAmB;CAC7B,oBAAA,WAAA;CACA,oBAAA,UAAA;AACF,EAAA,CAHY,wBAAA,sBAAmB,CAAA,EAAA;AAa/B,IAAa,mBAAb,MAAa,iBAAgB;CA0B3B,IAAY,gBAAa;EACvB,IAAI,KAAK,kBAAkB,YACzB,OAAO,KAAK,OAAO;OAEnB,OAAO,KAAK;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