@kirbydesign/designsystem 4.0.11 → 4.0.15
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/bundles/kirbydesign-designsystem.umd.js +92 -43
- package/bundles/kirbydesign-designsystem.umd.js.map +1 -1
- package/bundles/kirbydesign-designsystem.umd.min.js +1 -1
- package/bundles/kirbydesign-designsystem.umd.min.js.map +1 -1
- package/esm2015/lib/components/chart/chart.component.js +25 -2
- package/esm2015/lib/components/chart/chart.component.metadata.json +1 -1
- package/esm2015/lib/components/radio/radio-group/radio-group.component.js +8 -4
- package/esm2015/lib/components/radio/radio-group/radio-group.component.metadata.json +1 -1
- package/esm2015/lib/components/segmented-control/segment-item.js +1 -1
- package/esm2015/lib/components/segmented-control/segment-item.metadata.json +1 -1
- package/esm2015/lib/components/segmented-control/segmented-control.component.js +17 -3
- package/esm2015/lib/components/segmented-control/segmented-control.component.metadata.json +1 -1
- package/esm2015/lib/components/tabs/tab-button/tab-button.component.js +1 -1
- package/esm2015/lib/components/tabs/tab-button/tab-button.component.metadata.json +1 -1
- package/fesm2015/kirbydesign-designsystem.js +82 -43
- package/fesm2015/kirbydesign-designsystem.js.map +1 -1
- package/kirbydesign-designsystem.metadata.json +1 -1
- package/lib/components/chart/chart.component.d.ts +1 -0
- package/lib/components/radio/radio-group/radio-group.component.d.ts +1 -0
- package/lib/components/segmented-control/segment-item.d.ts +12 -6
- package/lib/components/segmented-control/segmented-control.component.d.ts +3 -0
- package/package.json +1 -1
|
@@ -3809,6 +3809,42 @@
|
|
|
3809
3809
|
return Array.isArray(value) && value.every(function (item) { return typeof item === 'number'; });
|
|
3810
3810
|
}
|
|
3811
3811
|
|
|
3812
|
+
var ComponentLoaderDirective = /** @class */ (function () {
|
|
3813
|
+
function ComponentLoaderDirective(componentFactoryResolver, viewContainerRef, renderer) {
|
|
3814
|
+
this.componentFactoryResolver = componentFactoryResolver;
|
|
3815
|
+
this.viewContainerRef = viewContainerRef;
|
|
3816
|
+
this.renderer = renderer;
|
|
3817
|
+
}
|
|
3818
|
+
ComponentLoaderDirective.prototype.ngOnInit = function () {
|
|
3819
|
+
this.loadCard();
|
|
3820
|
+
};
|
|
3821
|
+
ComponentLoaderDirective.prototype.loadCard = function () {
|
|
3822
|
+
var componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.configuration.component);
|
|
3823
|
+
this.viewContainerRef.clear();
|
|
3824
|
+
var componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
3825
|
+
if (componentRef && componentRef.location && componentRef.location.nativeElement) {
|
|
3826
|
+
this.renderer.addClass(componentRef.location.nativeElement, this.cssClass);
|
|
3827
|
+
}
|
|
3828
|
+
componentRef.instance.data = this.configuration.data;
|
|
3829
|
+
};
|
|
3830
|
+
return ComponentLoaderDirective;
|
|
3831
|
+
}());
|
|
3832
|
+
ComponentLoaderDirective.decorators = [
|
|
3833
|
+
{ type: i0.Directive, args: [{
|
|
3834
|
+
selector: '[kirbyLoadComponent]',
|
|
3835
|
+
},] }
|
|
3836
|
+
];
|
|
3837
|
+
/** @nocollapse */
|
|
3838
|
+
ComponentLoaderDirective.ctorParameters = function () { return [
|
|
3839
|
+
{ type: i0.ComponentFactoryResolver },
|
|
3840
|
+
{ type: i0.ViewContainerRef },
|
|
3841
|
+
{ type: i0.Renderer2 }
|
|
3842
|
+
]; };
|
|
3843
|
+
ComponentLoaderDirective.propDecorators = {
|
|
3844
|
+
configuration: [{ type: i0.Input, args: ['kirbyLoadComponent',] }],
|
|
3845
|
+
cssClass: [{ type: i0.Input }]
|
|
3846
|
+
};
|
|
3847
|
+
|
|
3812
3848
|
function deepCopy(obj) {
|
|
3813
3849
|
return JSON.parse(JSON.stringify(obj));
|
|
3814
3850
|
}
|
|
@@ -4246,7 +4282,34 @@
|
|
|
4246
4282
|
configurable: true
|
|
4247
4283
|
});
|
|
4248
4284
|
ChartComponent.prototype.ngAfterViewInit = function () {
|
|
4249
|
-
this
|
|
4285
|
+
var _this = this;
|
|
4286
|
+
/*
|
|
4287
|
+
A chart is not rendered until it has both a height and a width.
|
|
4288
|
+
If ChartComponent is slotted in an ionic component it will
|
|
4289
|
+
not have any height or width on afterViewInit. This will cause
|
|
4290
|
+
the animation to not be played on first draw.
|
|
4291
|
+
*/
|
|
4292
|
+
var canvasElement = this.canvasElement.nativeElement;
|
|
4293
|
+
this.whenElementHasHeightAndWidth(canvasElement).then(function () { return _this.renderChart(); });
|
|
4294
|
+
};
|
|
4295
|
+
ChartComponent.prototype.whenElementHasHeightAndWidth = function (element) {
|
|
4296
|
+
var rectIs2D = function (_a) {
|
|
4297
|
+
var width = _a.width, height = _a.height;
|
|
4298
|
+
return height > 0 && width > 0;
|
|
4299
|
+
};
|
|
4300
|
+
return new Promise(function (resolve) {
|
|
4301
|
+
var initialClientRect = element.getBoundingClientRect();
|
|
4302
|
+
if (rectIs2D(initialClientRect))
|
|
4303
|
+
resolve();
|
|
4304
|
+
var resizeObserver = new ResizeObserverFactory().create(function (_a) {
|
|
4305
|
+
var _b = __read(_a, 1), resizeObserverEntry = _b[0];
|
|
4306
|
+
if (rectIs2D(resizeObserverEntry.contentRect)) {
|
|
4307
|
+
resizeObserver.unobserve(element);
|
|
4308
|
+
resolve();
|
|
4309
|
+
}
|
|
4310
|
+
});
|
|
4311
|
+
resizeObserver.observe(element);
|
|
4312
|
+
});
|
|
4250
4313
|
};
|
|
4251
4314
|
ChartComponent.prototype.ngOnChanges = function (simpleChanges) {
|
|
4252
4315
|
var _this = this;
|
|
@@ -6192,6 +6255,13 @@
|
|
|
6192
6255
|
enumerable: false,
|
|
6193
6256
|
configurable: true
|
|
6194
6257
|
});
|
|
6258
|
+
Object.defineProperty(RadioGroupComponent.prototype, "hasValue", {
|
|
6259
|
+
get: function () {
|
|
6260
|
+
return this.value !== undefined && this.value !== null;
|
|
6261
|
+
},
|
|
6262
|
+
enumerable: false,
|
|
6263
|
+
configurable: true
|
|
6264
|
+
});
|
|
6195
6265
|
Object.defineProperty(RadioGroupComponent.prototype, "hasItemsFromContentProjection", {
|
|
6196
6266
|
get: function () {
|
|
6197
6267
|
return (!this.items.length &&
|
|
@@ -6259,7 +6329,7 @@
|
|
|
6259
6329
|
// #endregion "protected" methods used by template
|
|
6260
6330
|
// #region private methods
|
|
6261
6331
|
RadioGroupComponent.prototype.getIndexOfSelectedValue = function () {
|
|
6262
|
-
if (!this.
|
|
6332
|
+
if (!this.hasValue)
|
|
6263
6333
|
return -1;
|
|
6264
6334
|
return this.hasItemsFromContentProjection
|
|
6265
6335
|
? this.getIndexOfProjectedRadio(this.value)
|
|
@@ -6308,10 +6378,11 @@
|
|
|
6308
6378
|
});
|
|
6309
6379
|
};
|
|
6310
6380
|
RadioGroupComponent.prototype.refreshSelectionState = function () {
|
|
6311
|
-
if (this.
|
|
6381
|
+
if (this.hasValue) {
|
|
6312
6382
|
this._selectedIndex = this.getIndexOfSelectedValue(); // Ensure selectedIndex reflects value within items
|
|
6313
6383
|
}
|
|
6314
|
-
|
|
6384
|
+
var valueFromSelectedIndex = this.getValueFromSelectedIndex();
|
|
6385
|
+
this._value = valueFromSelectedIndex !== undefined ? valueFromSelectedIndex : null;
|
|
6315
6386
|
};
|
|
6316
6387
|
RadioGroupComponent.prototype.refreshStateFromProjectedContent = function () {
|
|
6317
6388
|
if (!!this._customItemTemplate)
|
|
@@ -8576,49 +8647,14 @@
|
|
|
8576
8647
|
},] }
|
|
8577
8648
|
];
|
|
8578
8649
|
|
|
8579
|
-
var ComponentLoaderDirective = /** @class */ (function () {
|
|
8580
|
-
function ComponentLoaderDirective(componentFactoryResolver, viewContainerRef, renderer) {
|
|
8581
|
-
this.componentFactoryResolver = componentFactoryResolver;
|
|
8582
|
-
this.viewContainerRef = viewContainerRef;
|
|
8583
|
-
this.renderer = renderer;
|
|
8584
|
-
}
|
|
8585
|
-
ComponentLoaderDirective.prototype.ngOnInit = function () {
|
|
8586
|
-
this.loadCard();
|
|
8587
|
-
};
|
|
8588
|
-
ComponentLoaderDirective.prototype.loadCard = function () {
|
|
8589
|
-
var componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.configuration.component);
|
|
8590
|
-
this.viewContainerRef.clear();
|
|
8591
|
-
var componentRef = this.viewContainerRef.createComponent(componentFactory);
|
|
8592
|
-
if (componentRef && componentRef.location && componentRef.location.nativeElement) {
|
|
8593
|
-
this.renderer.addClass(componentRef.location.nativeElement, this.cssClass);
|
|
8594
|
-
}
|
|
8595
|
-
componentRef.instance.data = this.configuration.data;
|
|
8596
|
-
};
|
|
8597
|
-
return ComponentLoaderDirective;
|
|
8598
|
-
}());
|
|
8599
|
-
ComponentLoaderDirective.decorators = [
|
|
8600
|
-
{ type: i0.Directive, args: [{
|
|
8601
|
-
selector: '[kirbyLoadComponent]',
|
|
8602
|
-
},] }
|
|
8603
|
-
];
|
|
8604
|
-
/** @nocollapse */
|
|
8605
|
-
ComponentLoaderDirective.ctorParameters = function () { return [
|
|
8606
|
-
{ type: i0.ComponentFactoryResolver },
|
|
8607
|
-
{ type: i0.ViewContainerRef },
|
|
8608
|
-
{ type: i0.Renderer2 }
|
|
8609
|
-
]; };
|
|
8610
|
-
ComponentLoaderDirective.propDecorators = {
|
|
8611
|
-
configuration: [{ type: i0.Input, args: ['kirbyLoadComponent',] }],
|
|
8612
|
-
cssClass: [{ type: i0.Input }]
|
|
8613
|
-
};
|
|
8614
|
-
|
|
8615
8650
|
(function (SegmentedControlMode) {
|
|
8616
8651
|
SegmentedControlMode["chip"] = "chip";
|
|
8617
8652
|
SegmentedControlMode["compactChip"] = "compactChip";
|
|
8618
8653
|
SegmentedControlMode["default"] = "default";
|
|
8619
8654
|
})(exports.SegmentedControlMode || (exports.SegmentedControlMode = {}));
|
|
8620
8655
|
var SegmentedControlComponent = /** @class */ (function () {
|
|
8621
|
-
function SegmentedControlComponent() {
|
|
8656
|
+
function SegmentedControlComponent(iconRegistryService) {
|
|
8657
|
+
this.iconRegistryService = iconRegistryService;
|
|
8622
8658
|
this.mode = exports.SegmentedControlMode.default;
|
|
8623
8659
|
this._items = [];
|
|
8624
8660
|
this._selectedIndex = -1;
|
|
@@ -8648,7 +8684,16 @@
|
|
|
8648
8684
|
return this._items;
|
|
8649
8685
|
},
|
|
8650
8686
|
set: function (value) {
|
|
8687
|
+
var _this = this;
|
|
8651
8688
|
this._items = value || [];
|
|
8689
|
+
this._items.forEach(function (item) {
|
|
8690
|
+
if (item.badge === undefined)
|
|
8691
|
+
return;
|
|
8692
|
+
// We need to verify whether badges icon is custom or default, so we can check for it in the template
|
|
8693
|
+
item.badge.isCustomIcon =
|
|
8694
|
+
item.badge.icon !== undefined &&
|
|
8695
|
+
_this.iconRegistryService.getIcon(item.badge.icon) !== undefined;
|
|
8696
|
+
});
|
|
8652
8697
|
var checkedItemIndex = this.items.findIndex(function (item) { return item.checked; });
|
|
8653
8698
|
if (checkedItemIndex > -1) {
|
|
8654
8699
|
console.warn('SegmentItem.checked is deprecated - please remove from your `items` configuration. Use `selectedIndex` or `value` on `<kirby-segmented-control>` instead ');
|
|
@@ -8701,12 +8746,16 @@
|
|
|
8701
8746
|
SegmentedControlComponent.decorators = [
|
|
8702
8747
|
{ type: i0.Component, args: [{
|
|
8703
8748
|
selector: 'kirby-segmented-control',
|
|
8704
|
-
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 <kirby-icon\n
|
|
8749
|
+
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",
|
|
8705
8750
|
// tslint:disable-next-line: no-host-metadata-property
|
|
8706
8751
|
host: { role: 'group' },
|
|
8707
8752
|
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}"]
|
|
8708
8753
|
},] }
|
|
8709
8754
|
];
|
|
8755
|
+
/** @nocollapse */
|
|
8756
|
+
SegmentedControlComponent.ctorParameters = function () { return [
|
|
8757
|
+
{ type: IconRegistryService }
|
|
8758
|
+
]; };
|
|
8710
8759
|
SegmentedControlComponent.propDecorators = {
|
|
8711
8760
|
mode: [{ type: i0.Input }],
|
|
8712
8761
|
_modeCssClass: [{ type: i0.HostBinding, args: ['class',] }],
|
|
@@ -8826,7 +8875,7 @@
|
|
|
8826
8875
|
{ type: i0.Component, args: [{
|
|
8827
8876
|
selector: 'kirby-tab-button',
|
|
8828
8877
|
template: "<ion-tab-button #ionTabButton [tab]=\"routerLink\" (click)=\"onClick($event, ionTabButton.selected)\">\n <div class=\"icon-container\" *ngIf=\"icons.length\">\n <ng-content\n *ngIf=\"icons.length === 1 || !ionTabButton.selected\"\n select=\"kirby-icon[:not([selected-tab])]\"\n ></ng-content>\n <ng-content *ngIf=\"ionTabButton.selected\" select=\"kirby-icon[selected-tab]\"></ng-content>\n <ng-content select=\"kirby-badge\"></ng-content>\n </div>\n <ion-label>\n <ng-content></ng-content>\n </ion-label>\n</ion-tab-button>\n",
|
|
8829
|
-
styles: ["ion-tab-button{height:100%;flex:1 1 0%;max-width:168px;font-size:10px;--color-selected:get-color(\"black\");--kirby-badge-position:absolute;--kirby-badge-
|
|
8878
|
+
styles: ["ion-tab-button{height:100%;flex:1 1 0%;max-width:168px;font-size:10px;--color-selected:get-color(\"black\");--kirby-badge-position:absolute;--kirby-badge-top:0;--kirby-badge-right:0}ion-tab-button ::ng-deep>div kirby-badge.md{--kirby-badge-top:-5px;--kirby-badge-right:-5px}ion-tab-button .icon-container{position:relative}@media (min-width:721px){ion-tab-button{flex:none;padding:0 24px;margin-right:24px;font-size:14px;flex-direction:row}ion-tab-button:last-child{margin-right:0}ion-tab-button .icon-container{margin-right:8px}}@media (min-width:1025px) and (hover:hover) and (pointer:fine){ion-tab-button{padding:0 12px;margin-right:0}}"]
|
|
8830
8879
|
},] }
|
|
8831
8880
|
];
|
|
8832
8881
|
/** @nocollapse */
|