@kirbydesign/designsystem 5.3.1 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6008,15 +6008,8 @@
6008
6008
  enumerable: false,
6009
6009
  configurable: true
6010
6010
  });
6011
- PopoverComponent.prototype._backdropClick = function () {
6012
- this.willHide.emit();
6013
- this.hide();
6014
- };
6015
6011
  PopoverComponent.prototype._onWindowResize = function () {
6016
- if (this.isShowing) {
6017
- this.willHide.emit();
6018
- this.hide();
6019
- }
6012
+ this.hide();
6020
6013
  };
6021
6014
  PopoverComponent.prototype.ngAfterViewInit = function () {
6022
6015
  this.placePopoverAboveClosestModal();
@@ -6036,8 +6029,13 @@
6036
6029
  }
6037
6030
  };
6038
6031
  // document.removeEventListener needs the exact same event handler & options reference:
6039
- PopoverComponent.prototype.preventEvent = function (event) {
6040
- event.preventDefault();
6032
+ PopoverComponent.preventEventOutsidePopover = function (event) {
6033
+ if (event.target instanceof HTMLElement) {
6034
+ var targetIsInPopover = !!event.target.closest('kirby-popover');
6035
+ if (!targetIsInPopover) {
6036
+ event.preventDefault();
6037
+ }
6038
+ }
6041
6039
  };
6042
6040
  PopoverComponent.prototype.preventScroll = function () {
6043
6041
  this.isFirstToLockScroll = !this.document.body.classList.contains('backdrop-no-scroll');
@@ -6045,13 +6043,13 @@
6045
6043
  this.renderer.addClass(this.document.body, 'backdrop-no-scroll');
6046
6044
  }
6047
6045
  // preventDefault does not work with Renderer2.listen method; add event listener directly to document instead
6048
- this.document.addEventListener('touchmove', this.preventEvent, this.preventScrollEventListenerOptions);
6046
+ this.document.addEventListener('touchmove', PopoverComponent.preventEventOutsidePopover, this.preventScrollEventListenerOptions);
6049
6047
  };
6050
6048
  PopoverComponent.prototype.releaseScroll = function () {
6051
6049
  if (this.isFirstToLockScroll) {
6052
6050
  this.renderer.removeClass(this.document.body, 'backdrop-no-scroll');
6053
6051
  }
6054
- this.document.removeEventListener('touchmove', this.preventEvent, this.preventScrollEventListenerOptions);
6052
+ this.document.removeEventListener('touchmove', PopoverComponent.preventEventOutsidePopover, this.preventScrollEventListenerOptions);
6055
6053
  };
6056
6054
  PopoverComponent.prototype.show = function () {
6057
6055
  this.renderer.addClass(this.elementRef.nativeElement, 'is-opening');
@@ -6063,7 +6061,10 @@
6063
6061
  this.isShowing = true;
6064
6062
  };
6065
6063
  PopoverComponent.prototype.hide = function () {
6066
- this.renderer.removeChild(this.document.body, this.elementRef.nativeElement);
6064
+ if (!this.isShowing)
6065
+ return;
6066
+ this.willHide.emit();
6067
+ this.renderer.removeChild(this.elementRef.nativeElement.parentElement, this.elementRef.nativeElement);
6067
6068
  this.releaseScroll();
6068
6069
  this.renderer.removeStyle(this.targetElement, 'z-index');
6069
6070
  this.renderer.removeStyle(this.targetElement, 'pointer-events');
@@ -6130,7 +6131,6 @@
6130
6131
  popout: [{ type: i0.Input }],
6131
6132
  target: [{ type: i0.Input }],
6132
6133
  willHide: [{ type: i0.Output }],
6133
- _backdropClick: [{ type: i0.HostListener, args: ['click',] }],
6134
6134
  _onWindowResize: [{ type: i0.HostListener, args: ['window:resize',] }]
6135
6135
  };
6136
6136
 
@@ -6631,7 +6631,7 @@
6631
6631
  multi: true,
6632
6632
  },
6633
6633
  ],
6634
- styles: [":host{display:inline-block;position:relative;max-width:calc(100vw - 32px);outline:none}:host.expand{display:block}:host.expand kirby-card{width:100%;min-width:0;max-width:none}@media (hover:hover){:host:focus>button,:host:focus>button.attention-level3{border-color:#4d90fe}}:host.error>button,:host.ng-touched.ng-invalid>button{border-color:var(--kirby-danger)}:host>button{position:relative;margin:0;outline:none;width:100%;transition:box-shadow .2s,border-color .2s}:host>button.attention-level2{border:1px solid transparent}:host>button .text{overflow:hidden;text-overflow:ellipsis}kirby-popover{--max-height:352px}kirby-card{max-height:352px;margin-top:4px;margin-bottom:4px;overflow-y:auto;box-shadow:0 20px 30px -15px rgba(28,28,28,.3),0 0 5px 0 rgba(28,28,28,.08);min-width:288px;max-width:calc(100vw - 32px)}@media (min-width:321px){kirby-card{min-width:343px}}:host(:not(.with-popover)) kirby-card{display:none;opacity:0;position:absolute;z-index:800}:host(:not(.with-popover)).is-opening kirby-card{display:block}:host(:not(.with-popover)).is-open kirby-card{display:block;opacity:1}:host(:not(.with-popover)).popout-left kirby-card{right:0}:host(:not(.with-popover)).popout-up kirby-card{top:0;margin-top:-4px;transform:translateY(-100%)}:host(:not(.with-popover)).popout-up.is-open>button{z-index:801}:host(.is-open)>button{box-shadow:0 20px 30px -15px rgba(28,28,28,.3),0 0 5px 0 rgba(28,28,28,.08)}:host-context(kirby-calendar)>button{border-color:transparent;font-weight:700;font-size:medium}:host-context(kirby-calendar).is-open>button{box-shadow:none}"]
6634
+ styles: [":host{display:inline-block;position:relative;max-width:calc(100vw - 32px);outline:none}:host.expand{display:block}:host.expand kirby-card{width:100%;min-width:0;max-width:none}@media (hover:hover){:host:focus>button,:host:focus>button.attention-level3{border-color:#4d90fe}}:host.error>button,:host.ng-touched.ng-invalid>button{border-color:var(--kirby-danger)}:host>button{position:relative;margin:0;outline:none;width:100%;transition:box-shadow .2s,border-color .2s}:host>button.attention-level2{border:1px solid transparent}:host>button .text{overflow:hidden;text-overflow:ellipsis}kirby-popover{--max-height:352px}kirby-card{max-height:352px;margin-top:4px;margin-bottom:4px;overflow-y:auto;box-shadow:0 20px 30px -15px rgba(28,28,28,.3),0 0 5px 0 rgba(28,28,28,.08);min-width:288px;max-width:calc(100vw - 32px)}@media (min-width:321px){kirby-card{min-width:343px}}:host(:not(.with-popover)) kirby-card{display:none;opacity:0;position:absolute;z-index:800}:host(:not(.with-popover)).is-opening kirby-card{display:block}:host(:not(.with-popover)).is-open kirby-card{display:block;opacity:1}:host(:not(.with-popover)).popout-left kirby-card{right:0}:host(:not(.with-popover)).popout-up kirby-card{top:0;margin-top:-4px;transform:translateY(-100%)}:host(:not(.with-popover)).popout-up.is-open>button{z-index:801}:host(.with-popover).is-open kirby-card{display:block}:host(.is-open)>button{box-shadow:0 20px 30px -15px rgba(28,28,28,.3),0 0 5px 0 rgba(28,28,28,.08)}:host-context(kirby-calendar)>button{border-color:transparent;font-weight:700;font-size:medium}:host-context(kirby-calendar).is-open>button{box-shadow:none}"]
6635
6635
  },] }
6636
6636
  ];
6637
6637
  /** @nocollapse */
@@ -9243,6 +9243,7 @@
9243
9243
  this.mode = exports.SegmentedControlMode.default;
9244
9244
  this._items = [];
9245
9245
  this._selectedIndex = -1;
9246
+ this._disableChangeOnSwipe = false;
9246
9247
  this.segmentSelect = new i0.EventEmitter();
9247
9248
  }
9248
9249
  SegmentedControlComponent.prototype.preventWrapperClick = function (event) {
@@ -9319,6 +9320,16 @@
9319
9320
  enumerable: false,
9320
9321
  configurable: true
9321
9322
  });
9323
+ Object.defineProperty(SegmentedControlComponent.prototype, "disableChangeOnSwipe", {
9324
+ get: function () {
9325
+ return this._disableChangeOnSwipe;
9326
+ },
9327
+ set: function (value) {
9328
+ this._disableChangeOnSwipe = value;
9329
+ },
9330
+ enumerable: false,
9331
+ configurable: true
9332
+ });
9322
9333
  SegmentedControlComponent.prototype.onSegmentSelect = function (selectedId) {
9323
9334
  var selectedItemIndex = this.items.findIndex(function (item) { return selectedId === item.id; });
9324
9335
  if (selectedItemIndex !== this.selectedIndex) {
@@ -9331,7 +9342,7 @@
9331
9342
  SegmentedControlComponent.decorators = [
9332
9343
  { type: i0.Component, args: [{
9333
9344
  selector: 'kirby-segmented-control',
9334
- template: "<ion-segment\n *ngIf=\"mode === 'default'\"\n [value]=\"value?.id\"\n (ionChange)=\"onSegmentSelect($event.detail.value)\"\n (click)=\"preventWrapperClick($event)\"\n>\n <div *ngFor=\"let item of items\" class=\"segment-btn-wrapper\">\n <ion-segment-button [value]=\"item.id\">{{ item.text }}</ion-segment-button>\n <kirby-badge\n *ngIf=\"item.badge\"\n role=\"text\"\n [attr.aria-label]=\"item.badge.description\"\n [themeColor]=\"item.badge.themeColor\"\n >\n <ng-container *ngIf=\"item.badge.icon; else badgeContent\">\n <kirby-icon\n *ngIf=\"item.badge.isCustomIcon; else defaultIconName\"\n [customName]=\"item.badge.icon\"\n ></kirby-icon>\n <ng-template #defaultIconName>\n <kirby-icon [name]=\"item.badge.icon\"></kirby-icon>\n </ng-template>\n </ng-container>\n <ng-template #badgeContent>\n {{ item.badge.content }}\n </ng-template>\n </kirby-badge>\n </div>\n</ion-segment>\n\n<ng-container *ngIf=\"mode === 'chip' || mode === 'compactChip'\">\n <kirby-chip\n *ngFor=\"let item of items; let index = index\"\n [text]=\"item.text\"\n [isSelected]=\"index === selectedIndex\"\n (click)=\"onSegmentSelect(item.id)\"\n role=\"button\"\n ></kirby-chip>\n</ng-container>\n",
9345
+ template: "<ion-segment\n *ngIf=\"mode === 'default'\"\n [value]=\"value?.id\"\n [scrollable]=\"disableChangeOnSwipe\"\n (ionChange)=\"onSegmentSelect($event.detail.value)\"\n (click)=\"preventWrapperClick($event)\"\n>\n <div *ngFor=\"let item of items\" class=\"segment-btn-wrapper\">\n <ion-segment-button [value]=\"item.id\">{{ item.text }}</ion-segment-button>\n <kirby-badge\n *ngIf=\"item.badge\"\n role=\"text\"\n [attr.aria-label]=\"item.badge.description\"\n [themeColor]=\"item.badge.themeColor\"\n >\n <ng-container *ngIf=\"item.badge.icon; else badgeContent\">\n <kirby-icon\n *ngIf=\"item.badge.isCustomIcon; else defaultIconName\"\n [customName]=\"item.badge.icon\"\n ></kirby-icon>\n <ng-template #defaultIconName>\n <kirby-icon [name]=\"item.badge.icon\"></kirby-icon>\n </ng-template>\n </ng-container>\n <ng-template #badgeContent>\n {{ item.badge.content }}\n </ng-template>\n </kirby-badge>\n </div>\n</ion-segment>\n\n<ng-container *ngIf=\"mode === 'chip' || mode === 'compactChip'\">\n <kirby-chip\n *ngFor=\"let item of items; let index = index\"\n [text]=\"item.text\"\n [isSelected]=\"index === selectedIndex\"\n (click)=\"onSegmentSelect(item.id)\"\n role=\"button\"\n ></kirby-chip>\n</ng-container>\n",
9335
9346
  // tslint:disable-next-line: no-host-metadata-property
9336
9347
  host: { role: 'group' },
9337
9348
  styles: [":host{display:block;-webkit-user-select:none;user-select:none;--kirby-badge-elevation:0 5px 10px -10px rgba(28,28,28,0.3),0 0 5px 0 rgba(28,28,28,0.08);--kirby-badge-position:absolute;--kirby-badge-top:-8px;--kirby-badge-right:8px;--kirby-badge-z-index:2}:host.sm ion-segment-button{min-height:32px;font-size:12px;--padding-start:16px;--padding-end:16px}:host.chip-mode{display:flex;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden}@media (pointer:coarse){:host.chip-mode{scrollbar-width:none}:host.chip-mode::-webkit-scrollbar{display:none}}ion-segment{display:inline-flex;width:auto;overflow:visible;contain:unset;--background:var(--kirby-white);border-radius:999px}ion-segment-button{position:relative;min-height:40px;font-weight:400;font-size:14px;text-transform:none;--border-radius:999px;--border-style:none;--background:none;--color:var(--kirby-white-contrast);--indicator-color:var(--kirby-black);--color-checked:var(--kirby-black-contrast);--color-hover:var(--kirby-black-tint);--indicator-box-shadow:none;--padding-start:24px;--padding-end:24px;--margin-bottom:0;--margin-end:0;--margin-start:0;--margin-top:0;margin:0}ion-segment-button:after{content:\"\";position:absolute;min-height:44px;min-width:44px;width:100%;height:100%;transform:translate(-50%,-50%);left:50%;top:50%}.segment-btn-wrapper{position:relative}:host-context(.plt-desktop) ion-segment-button:focus-within{outline-color:-webkit-focus-ring-color;outline-style:auto}"]
@@ -9349,6 +9360,7 @@
9349
9360
  value: [{ type: i0.Input }],
9350
9361
  isSmallSize: [{ type: i0.HostBinding, args: ['class.sm',] }],
9351
9362
  size: [{ type: i0.Input }],
9363
+ disableChangeOnSwipe: [{ type: i0.Input }],
9352
9364
  segmentSelect: [{ type: i0.Output }]
9353
9365
  };
9354
9366