@3dsource/source-ui 0.0.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.
- package/LICENSE +14 -0
- package/README.md +31 -0
- package/fesm2022/3dsource-source-ui.mjs +402 -0
- package/fesm2022/3dsource-source-ui.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/source-modal/components/source-modal.component.d.ts +20 -0
- package/lib/components/source-modal/constants/sourceModalSize.const.d.ts +5 -0
- package/lib/components/source-modal/index.d.ts +3 -0
- package/lib/components/source-modal/interfaces/index.d.ts +1 -0
- package/lib/components/source-modal/interfaces/sourceModalData.interface.d.ts +20 -0
- package/lib/components/source-popover/components/source-popover-trigger.component.d.ts +30 -0
- package/lib/components/source-popover/components/source-popover.component.d.ts +12 -0
- package/lib/components/source-popover/index.d.ts +4 -0
- package/lib/components/source-popover/interfaces/defaultSourcePopover.config.d.ts +2 -0
- package/lib/components/source-popover/interfaces/index.d.ts +2 -0
- package/lib/components/source-popover/interfaces/sourcePopoverData.interface.d.ts +27 -0
- package/lib/components/source-popover/services/index.d.ts +1 -0
- package/lib/components/source-popover/services/sourcePopover.service.d.ts +19 -0
- package/lib/components/source-popover/tokens/sourcePopoverDataToken.d.ts +3 -0
- package/lib/components/source-tab-line/components/source-tab-line.component.d.ts +26 -0
- package/lib/components/source-tab-line/index.d.ts +1 -0
- package/lib/components/source-tabs/components/source-tab/source-tab.component.d.ts +6 -0
- package/lib/components/source-tabs/components/source-tabs/source-tabs.component.d.ts +19 -0
- package/lib/components/source-tabs/index.d.ts +3 -0
- package/lib/components/source-tabs/interfaces/index.d.ts +1 -0
- package/lib/components/source-tabs/interfaces/sourceTabData.interface.d.ts +6 -0
- package/lib/components/source-ui.component.d.ts +5 -0
- package/package.json +44 -0
- package/public-api.d.ts +5 -0
- package/styles/material/checkbox.scss +48 -0
- package/styles/material/form-field.scss +56 -0
- package/styles/material/radio.scss +37 -0
- package/styles/material/select.scss +97 -0
- package/styles/material/theme.scss +328 -0
- package/styles/material/toggle.scss +47 -0
- package/styles/source.ui.scss +11 -0
- package/styles/toastr/toastr.scss +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) 2025 3dsource
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software and associated documentation files (the “Software”) are proprietary
|
|
5
|
+
and confidential. Unauthorized copying, modification, distribution, or any other
|
|
6
|
+
use of the Software, in whole or in part, without the prior written consent of
|
|
7
|
+
the copyright holder is strictly prohibited.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
10
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
12
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
13
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
14
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @3dsource/source-ui
|
|
2
|
+
|
|
3
|
+
### A bunch of ui elements using angular
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### add peer dependencies
|
|
8
|
+
|
|
9
|
+
_List of peer dependencies_
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"@angular/common": "^19.2.0",
|
|
14
|
+
"@angular/core": "^19.2.0",
|
|
15
|
+
"@angular/material": "19.2.11"
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```shell
|
|
20
|
+
npx install-peerdeps @3dsource/source-ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### add a library
|
|
24
|
+
|
|
25
|
+
```shell
|
|
26
|
+
npm i @3dsource/source-ui
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
todo
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, inject, ChangeDetectionStrategy, ViewEncapsulation, InjectionToken, DestroyRef, signal, Injector, Injectable, TemplateRef, input, output, ViewContainerRef, ViewChild, viewChild, linkedSignal, computed, effect, untracked, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
3
|
+
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
|
|
4
|
+
import { NgClass, NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
import { defaultSourceButtonConfig, SourceIconButtonComponent, SourceButtonComponent } from '@3dsource/source-ui-native';
|
|
6
|
+
import * as i1 from 'ngx-scrollbar';
|
|
7
|
+
import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
8
|
+
import { Overlay, OverlayConfig, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
9
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
10
|
+
import { Subject } from 'rxjs';
|
|
11
|
+
import { BreakpointObserver } from '@angular/cdk/layout';
|
|
12
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
13
|
+
import { take } from 'rxjs/operators';
|
|
14
|
+
import { register } from 'swiper/element/bundle';
|
|
15
|
+
|
|
16
|
+
class SourceUiComponent {
|
|
17
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceUiComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
18
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: SourceUiComponent, isStandalone: true, selector: "lib-source-ui", ngImport: i0, template: ` <p>source-ui works!</p> `, isInline: true, styles: [""] }); }
|
|
19
|
+
}
|
|
20
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceUiComponent, decorators: [{
|
|
21
|
+
type: Component,
|
|
22
|
+
args: [{ selector: 'lib-source-ui', imports: [], template: ` <p>source-ui works!</p> ` }]
|
|
23
|
+
}] });
|
|
24
|
+
|
|
25
|
+
const SourceModalSize = {
|
|
26
|
+
SMALL: 'small',
|
|
27
|
+
DEFAULT: 'default',
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
class SourceModalComponent {
|
|
31
|
+
constructor() {
|
|
32
|
+
this.size = 'default';
|
|
33
|
+
this.testID = 'modal';
|
|
34
|
+
this.stringContent = null;
|
|
35
|
+
this.data = inject(DIALOG_DATA);
|
|
36
|
+
this.dialogRef = inject((DialogRef));
|
|
37
|
+
this.defaultButtonConfig = defaultSourceButtonConfig;
|
|
38
|
+
}
|
|
39
|
+
ngOnInit() {
|
|
40
|
+
this.initModal();
|
|
41
|
+
}
|
|
42
|
+
close(result) {
|
|
43
|
+
this.dialogRef.close(result);
|
|
44
|
+
}
|
|
45
|
+
goBack() {
|
|
46
|
+
this.dialogRef.close();
|
|
47
|
+
}
|
|
48
|
+
initModal() {
|
|
49
|
+
this.size = this.data?.size || SourceModalSize.DEFAULT;
|
|
50
|
+
this.testID = this.data?.testID || this.testID;
|
|
51
|
+
this.stringContent =
|
|
52
|
+
typeof this.data.content === 'string' ? this.data.content : null;
|
|
53
|
+
}
|
|
54
|
+
getButtonConfig(externalConfig) {
|
|
55
|
+
return {
|
|
56
|
+
...this.defaultButtonConfig,
|
|
57
|
+
...externalConfig,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceModalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
61
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: SourceModalComponent, isStandalone: true, selector: "src-modal", ngImport: i0, template: "<div\n class=\"src-modal\"\n [attr.data-testid]=\"testID\"\n [ngClass]=\"{ 'src-modal--small': size === 'small' }\"\n>\n <div class=\"src-modal__header\">\n @if (data['backButton']) {\n <src-icon-button\n class=\"src-modal__back\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID + '-header-back'\"\n (onClick)=\"goBack()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n >\n <path\n d=\"m438-480 164 164q11 11 11 25.5T602-265q-11 11-25.5 11t-25.84-11.34L361-455q-5-5.4-7.5-11.7-2.5-6.3-2.5-13.5t2.5-13.5Q356-500 361-505l189.66-189.66Q562-706 576.5-706t25.5 11q11 11 11 25.5T602-644L438-480Z\"\n />\n </svg>\n </src-icon-button>\n }\n\n <div class=\"src-modal__title\" [attr.data-testid]=\"testID + '-header-title'\">\n {{ data['headerTitle'] }}\n </div>\n\n @if (data['closeButton']) {\n <src-icon-button\n class=\"src-modal__close\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID + '-header-close'\"\n (onClick)=\"close()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n d=\"M10.0001 11.229L6.68618 14.5429C6.51951 14.7096 6.31818 14.7896 6.08218 14.7829C5.84618 14.7756 5.64485 14.6886 5.47818 14.5219C5.31151 14.3553 5.22818 14.1506 5.22818 13.9079C5.22818 13.6646 5.31151 13.4596 5.47818 13.2929L8.77107 10L5.45718 6.68615C5.29051 6.51949 5.21051 6.31482 5.21718 6.07215C5.22451 5.82882 5.31151 5.62382 5.47818 5.45715C5.64485 5.29049 5.84951 5.20715 6.09218 5.20715C6.33551 5.20715 6.54051 5.29049 6.70718 5.45715L10.0001 8.77105L13.314 5.45715C13.4806 5.29049 13.6853 5.20715 13.928 5.20715C14.1713 5.20715 14.3763 5.29049 14.543 5.45715C14.7096 5.62382 14.793 5.82882 14.793 6.07215C14.793 6.31482 14.7096 6.51949 14.543 6.68615L11.2291 10L14.543 13.3139C14.7096 13.4806 14.793 13.6819 14.793 13.9179C14.793 14.1539 14.7096 14.3553 14.543 14.5219C14.3763 14.6886 14.1713 14.7719 13.928 14.7719C13.6853 14.7719 13.4806 14.6886 13.314 14.5219L10.0001 11.229Z\"\n fill=\"currentColor\"\n />\n </svg>\n </src-icon-button>\n }\n </div>\n\n <div\n class=\"src-modal__body\"\n [class.src-modal__body--scrollable]=\"scrollbar.isVerticallyScrollable()\"\n >\n <ng-scrollbar #scrollbar class=\"src-modal__scroll-box\">\n @if (stringContent; as content) {\n <div [innerHTML]=\"content\"></div>\n }\n </ng-scrollbar>\n </div>\n\n @if (data.footerButtons) {\n <div class=\"src-modal__footer\">\n @for (footerButton of data.footerButtons; track footerButton.label) {\n <src-button\n [srcButtonConfig]=\"getButtonConfig(footerButton.srcButtonConfig)\"\n [customClass]=\"footerButton.className\"\n (onClick)=\"close(footerButton.action())\"\n >\n {{ footerButton.label }}</src-button\n >\n }\n </div>\n }\n</div>\n", styles: [".src-modal{--srcModalWidth: 620px;--srcModalMaxWidth: calc(100% - 16px) ;--srcModalMaxHeight: 80vh;--srcModalBg: var(--src-color-bg-default);--srcModalBoxShadow: var(--src-shadow-large);--srcModalBorderRadius: var(--src-br-medium);--srcModalTitleSize: var(--src-fs-medium);--srcModalTitleLineHeight: var(--src-lh-medium);--srcModalTitleColor: var(--src-color-text-default);--srcModalBodyPadding: 20px;--srcModalTitleBorder: 1px solid var(--src-color-border-default, #e5e7eb);--srcModalFooterBorder: 1px solid var(--src-color-border-default, #e5e7eb);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;width:var(--srcModalWidth);max-width:var(--srcModalMaxWidth);max-height:var(--srcModalMaxHeight);margin:auto;background-color:var(--srcModalBg);border-radius:var(--srcModalBorderRadius);box-shadow:var(--srcModalBoxShadow)}.src-modal--small{--srcModalWidth: 380px}.src-modal__header{display:flex;padding:14px 16px 14px 20px;width:100%;border-bottom:var(--srcModalTitleBorder)}.src-modal__body{padding:var(--srcModalBodyPadding)}.src-modal__body--scrollable{padding:0 0 0 var(--srcModalBodyPadding)}.src-modal__body--scrollable .src-modal__scroll-box.ng-scrollbar{--scrollbar-border-radius: 0px;--scrollbar-thickness: 3;--scrollbar-offset: 8;--scrollbar-track-color: transparent;--scrollbar-thumb-color: var(--src-color-border-default, #e5e7eb);--scrollbar-thumb-hover-color: var(--src-scrollbar-thumb-color)}.src-modal__body .src-modal__scroll-box{max-height:100%}.src-modal__footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;width:100%;border-top:var(--srcModalFooterBorder);gap:10px}.src-modal__title{font-size:var(--srcModalTitleSize);font-weight:var(--src-fw-semibold, 600);line-height:var(--srcModalTitleLineHeight);color:var(--srcModalTitleColor);word-break:break-word}.src-modal__back{margin-right:8px}.src-modal__close{margin-left:auto}.src-modal__close svg,.src-modal__back svg{width:20px;height:20px;fill:var(--src-color-icon-default)}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: SourceIconButtonComponent, selector: "src-icon-button", inputs: ["name", "type", "size", "shape", "counter", "isActive", "isDisabled", "data-testid"], outputs: ["onClick"] }, { kind: "ngmodule", type: NgScrollbarModule }, { kind: "component", type: i1.NgScrollbar, selector: "ng-scrollbar:not([externalViewport])", exportAs: ["ngScrollbar"] }, { kind: "component", type: SourceButtonComponent, selector: "src-button", inputs: ["type", "appearance", "colorScheme", "size", "customClass", "hasDisclosure", "isFullWidth", "isPressed", "isDisabled", "isLoading", "iconButton", "formID", "srcButtonConfig", "data-testid"], outputs: ["onClick", "onSubmit"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
62
|
+
}
|
|
63
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceModalComponent, decorators: [{
|
|
64
|
+
type: Component,
|
|
65
|
+
args: [{ selector: 'src-modal', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
|
|
66
|
+
NgClass,
|
|
67
|
+
SourceIconButtonComponent,
|
|
68
|
+
NgScrollbarModule,
|
|
69
|
+
SourceButtonComponent,
|
|
70
|
+
], template: "<div\n class=\"src-modal\"\n [attr.data-testid]=\"testID\"\n [ngClass]=\"{ 'src-modal--small': size === 'small' }\"\n>\n <div class=\"src-modal__header\">\n @if (data['backButton']) {\n <src-icon-button\n class=\"src-modal__back\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID + '-header-back'\"\n (onClick)=\"goBack()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n >\n <path\n d=\"m438-480 164 164q11 11 11 25.5T602-265q-11 11-25.5 11t-25.84-11.34L361-455q-5-5.4-7.5-11.7-2.5-6.3-2.5-13.5t2.5-13.5Q356-500 361-505l189.66-189.66Q562-706 576.5-706t25.5 11q11 11 11 25.5T602-644L438-480Z\"\n />\n </svg>\n </src-icon-button>\n }\n\n <div class=\"src-modal__title\" [attr.data-testid]=\"testID + '-header-title'\">\n {{ data['headerTitle'] }}\n </div>\n\n @if (data['closeButton']) {\n <src-icon-button\n class=\"src-modal__close\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID + '-header-close'\"\n (onClick)=\"close()\"\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n d=\"M10.0001 11.229L6.68618 14.5429C6.51951 14.7096 6.31818 14.7896 6.08218 14.7829C5.84618 14.7756 5.64485 14.6886 5.47818 14.5219C5.31151 14.3553 5.22818 14.1506 5.22818 13.9079C5.22818 13.6646 5.31151 13.4596 5.47818 13.2929L8.77107 10L5.45718 6.68615C5.29051 6.51949 5.21051 6.31482 5.21718 6.07215C5.22451 5.82882 5.31151 5.62382 5.47818 5.45715C5.64485 5.29049 5.84951 5.20715 6.09218 5.20715C6.33551 5.20715 6.54051 5.29049 6.70718 5.45715L10.0001 8.77105L13.314 5.45715C13.4806 5.29049 13.6853 5.20715 13.928 5.20715C14.1713 5.20715 14.3763 5.29049 14.543 5.45715C14.7096 5.62382 14.793 5.82882 14.793 6.07215C14.793 6.31482 14.7096 6.51949 14.543 6.68615L11.2291 10L14.543 13.3139C14.7096 13.4806 14.793 13.6819 14.793 13.9179C14.793 14.1539 14.7096 14.3553 14.543 14.5219C14.3763 14.6886 14.1713 14.7719 13.928 14.7719C13.6853 14.7719 13.4806 14.6886 13.314 14.5219L10.0001 11.229Z\"\n fill=\"currentColor\"\n />\n </svg>\n </src-icon-button>\n }\n </div>\n\n <div\n class=\"src-modal__body\"\n [class.src-modal__body--scrollable]=\"scrollbar.isVerticallyScrollable()\"\n >\n <ng-scrollbar #scrollbar class=\"src-modal__scroll-box\">\n @if (stringContent; as content) {\n <div [innerHTML]=\"content\"></div>\n }\n </ng-scrollbar>\n </div>\n\n @if (data.footerButtons) {\n <div class=\"src-modal__footer\">\n @for (footerButton of data.footerButtons; track footerButton.label) {\n <src-button\n [srcButtonConfig]=\"getButtonConfig(footerButton.srcButtonConfig)\"\n [customClass]=\"footerButton.className\"\n (onClick)=\"close(footerButton.action())\"\n >\n {{ footerButton.label }}</src-button\n >\n }\n </div>\n }\n</div>\n", styles: [".src-modal{--srcModalWidth: 620px;--srcModalMaxWidth: calc(100% - 16px) ;--srcModalMaxHeight: 80vh;--srcModalBg: var(--src-color-bg-default);--srcModalBoxShadow: var(--src-shadow-large);--srcModalBorderRadius: var(--src-br-medium);--srcModalTitleSize: var(--src-fs-medium);--srcModalTitleLineHeight: var(--src-lh-medium);--srcModalTitleColor: var(--src-color-text-default);--srcModalBodyPadding: 20px;--srcModalTitleBorder: 1px solid var(--src-color-border-default, #e5e7eb);--srcModalFooterBorder: 1px solid var(--src-color-border-default, #e5e7eb);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;width:var(--srcModalWidth);max-width:var(--srcModalMaxWidth);max-height:var(--srcModalMaxHeight);margin:auto;background-color:var(--srcModalBg);border-radius:var(--srcModalBorderRadius);box-shadow:var(--srcModalBoxShadow)}.src-modal--small{--srcModalWidth: 380px}.src-modal__header{display:flex;padding:14px 16px 14px 20px;width:100%;border-bottom:var(--srcModalTitleBorder)}.src-modal__body{padding:var(--srcModalBodyPadding)}.src-modal__body--scrollable{padding:0 0 0 var(--srcModalBodyPadding)}.src-modal__body--scrollable .src-modal__scroll-box.ng-scrollbar{--scrollbar-border-radius: 0px;--scrollbar-thickness: 3;--scrollbar-offset: 8;--scrollbar-track-color: transparent;--scrollbar-thumb-color: var(--src-color-border-default, #e5e7eb);--scrollbar-thumb-hover-color: var(--src-scrollbar-thumb-color)}.src-modal__body .src-modal__scroll-box{max-height:100%}.src-modal__footer{display:flex;justify-content:flex-end;align-items:center;padding:16px;width:100%;border-top:var(--srcModalFooterBorder);gap:10px}.src-modal__title{font-size:var(--srcModalTitleSize);font-weight:var(--src-fw-semibold, 600);line-height:var(--srcModalTitleLineHeight);color:var(--srcModalTitleColor);word-break:break-word}.src-modal__back{margin-right:8px}.src-modal__close{margin-left:auto}.src-modal__close svg,.src-modal__back svg{width:20px;height:20px;fill:var(--src-color-icon-default)}\n"] }]
|
|
71
|
+
}] });
|
|
72
|
+
|
|
73
|
+
const SOURCE_POPOVER_DATA = new InjectionToken('SourcePopoverData');
|
|
74
|
+
|
|
75
|
+
const defaultSourcePopoverConfig = {
|
|
76
|
+
headerTitle: undefined,
|
|
77
|
+
backButton: false,
|
|
78
|
+
closeButton: true,
|
|
79
|
+
popoverMaxHeight: 'auto',
|
|
80
|
+
panelCustomClass: '',
|
|
81
|
+
breakpointDesktop: '(min-width: 1024px)',
|
|
82
|
+
hasBackdrop: true,
|
|
83
|
+
closeOnBackdropClick: true,
|
|
84
|
+
position: [
|
|
85
|
+
{
|
|
86
|
+
originX: 'start',
|
|
87
|
+
originY: 'bottom',
|
|
88
|
+
overlayX: 'start',
|
|
89
|
+
overlayY: 'top',
|
|
90
|
+
offsetY: 4,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
originX: 'start',
|
|
94
|
+
originY: 'top',
|
|
95
|
+
overlayX: 'start',
|
|
96
|
+
overlayY: 'bottom',
|
|
97
|
+
offsetY: -8,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
testID: '',
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
class SourcePopoverService {
|
|
104
|
+
constructor() {
|
|
105
|
+
this.breakpointObserver = inject(BreakpointObserver);
|
|
106
|
+
this.overlay = inject(Overlay);
|
|
107
|
+
this.destroyRef$ = inject(DestroyRef);
|
|
108
|
+
this.defaultSourcePopoverConfig = defaultSourcePopoverConfig;
|
|
109
|
+
this.isMobile = signal(false);
|
|
110
|
+
this.backButtonClickedSubject = new Subject();
|
|
111
|
+
}
|
|
112
|
+
get backButtonClicked$() {
|
|
113
|
+
return this.backButtonClickedSubject.asObservable();
|
|
114
|
+
}
|
|
115
|
+
show(overlayOrigin, viewContainerRef, override) {
|
|
116
|
+
const addedPanelClasses = ['src-popover-panel'];
|
|
117
|
+
const backdropClasses = ['src-popover-backdrop'];
|
|
118
|
+
const updatedConfig = this.getUpdatedConfig(override);
|
|
119
|
+
if (updatedConfig.panelCustomClass) {
|
|
120
|
+
addedPanelClasses.push(updatedConfig.panelCustomClass);
|
|
121
|
+
}
|
|
122
|
+
this.breakpointObserver
|
|
123
|
+
.observe(updatedConfig.breakpointDesktop)
|
|
124
|
+
.pipe(takeUntilDestroyed(this.destroyRef$))
|
|
125
|
+
.subscribe((res) => this.isMobile.set(!res.matches));
|
|
126
|
+
if (this.isMobile()) {
|
|
127
|
+
addedPanelClasses.push('src-popover-panel--mobile');
|
|
128
|
+
backdropClasses.push('src-popover-backdrop--mobile');
|
|
129
|
+
}
|
|
130
|
+
const dropdownPositionStrategy = this.overlay
|
|
131
|
+
.position()
|
|
132
|
+
.flexibleConnectedTo(overlayOrigin.elementRef)
|
|
133
|
+
.withPositions(updatedConfig.position);
|
|
134
|
+
// mobile position
|
|
135
|
+
const drawerPositionStrategy = this.overlay
|
|
136
|
+
.position()
|
|
137
|
+
.global()
|
|
138
|
+
.centerHorizontally()
|
|
139
|
+
.bottom('0px');
|
|
140
|
+
// close popover when scrolls
|
|
141
|
+
const scrollStrategy = this.overlay.scrollStrategies.reposition();
|
|
142
|
+
const config = new OverlayConfig({
|
|
143
|
+
panelClass: addedPanelClasses,
|
|
144
|
+
hasBackdrop: updatedConfig.hasBackdrop,
|
|
145
|
+
backdropClass: backdropClasses,
|
|
146
|
+
positionStrategy: this.isMobile()
|
|
147
|
+
? drawerPositionStrategy
|
|
148
|
+
: dropdownPositionStrategy,
|
|
149
|
+
scrollStrategy: scrollStrategy,
|
|
150
|
+
width: this.isMobile() ? '100%' : 'auto',
|
|
151
|
+
});
|
|
152
|
+
const overlayRef = this.overlay.create(config);
|
|
153
|
+
const data = {
|
|
154
|
+
...updatedConfig,
|
|
155
|
+
overlayRef,
|
|
156
|
+
};
|
|
157
|
+
const injector = Injector.create({
|
|
158
|
+
parent: viewContainerRef.injector,
|
|
159
|
+
providers: [{ provide: SOURCE_POPOVER_DATA, useValue: data }],
|
|
160
|
+
});
|
|
161
|
+
const template = new ComponentPortal(SourcePopoverComponent, viewContainerRef, injector);
|
|
162
|
+
overlayRef.attach(template);
|
|
163
|
+
return overlayRef;
|
|
164
|
+
}
|
|
165
|
+
closePopover(overlayRef) {
|
|
166
|
+
overlayRef.dispose();
|
|
167
|
+
}
|
|
168
|
+
emitBackAction(menuRef) {
|
|
169
|
+
this.backButtonClickedSubject.next(menuRef);
|
|
170
|
+
}
|
|
171
|
+
getUpdatedConfig(override) {
|
|
172
|
+
return {
|
|
173
|
+
srcPopoverTpl: override?.srcPopoverTpl,
|
|
174
|
+
headerTitle: override?.headerTitle ?? this.defaultSourcePopoverConfig.headerTitle,
|
|
175
|
+
hasBackButton: override?.hasBackButton ??
|
|
176
|
+
this.defaultSourcePopoverConfig.hasBackButton,
|
|
177
|
+
hasCloseButton: override?.hasCloseButton ??
|
|
178
|
+
this.defaultSourcePopoverConfig.hasCloseButton,
|
|
179
|
+
popoverMaxHeight: override?.popoverMaxHeight ??
|
|
180
|
+
this.defaultSourcePopoverConfig.popoverMaxHeight,
|
|
181
|
+
panelCustomClass: override?.panelCustomClass ??
|
|
182
|
+
this.defaultSourcePopoverConfig.panelCustomClass,
|
|
183
|
+
breakpointDesktop: override?.breakpointDesktop ??
|
|
184
|
+
this.defaultSourcePopoverConfig.breakpointDesktop,
|
|
185
|
+
position: override?.position
|
|
186
|
+
? override?.position
|
|
187
|
+
: this.defaultSourcePopoverConfig.position,
|
|
188
|
+
closeOnBackdropClick: override?.closeOnBackdropClick ??
|
|
189
|
+
this.defaultSourcePopoverConfig.closeOnBackdropClick,
|
|
190
|
+
hasBackdrop: override?.hasBackdrop ?? this.defaultSourcePopoverConfig.hasBackdrop,
|
|
191
|
+
testID: override?.testID ?? this.defaultSourcePopoverConfig.testID,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
195
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverService }); }
|
|
196
|
+
}
|
|
197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverService, decorators: [{
|
|
198
|
+
type: Injectable
|
|
199
|
+
}] });
|
|
200
|
+
|
|
201
|
+
class SourcePopoverComponent {
|
|
202
|
+
constructor() {
|
|
203
|
+
this.data = inject(SOURCE_POPOVER_DATA);
|
|
204
|
+
this.template = signal(this.data.srcPopoverTpl instanceof TemplateRef
|
|
205
|
+
? this.data.srcPopoverTpl
|
|
206
|
+
: null);
|
|
207
|
+
this.testID = signal(this.data.testID || 'popover');
|
|
208
|
+
this.#sourcePopoverService = inject(SourcePopoverService);
|
|
209
|
+
}
|
|
210
|
+
#sourcePopoverService;
|
|
211
|
+
close() {
|
|
212
|
+
this.#sourcePopoverService.closePopover(this.data.overlayRef);
|
|
213
|
+
}
|
|
214
|
+
emitBackAction() {
|
|
215
|
+
this.#sourcePopoverService.emitBackAction(this.data.overlayRef);
|
|
216
|
+
}
|
|
217
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
218
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: SourcePopoverComponent, isStandalone: true, selector: "src-popover", ngImport: i0, template: "<div\n class=\"src-popover\"\n [style.maxHeight]=\"data.popoverMaxHeight\"\n [attr.data-testid]=\"testID()\"\n>\n @if (\n data['hasBackButton'] ||\n data['hasCloseButton'] ||\n (data['headerTitle'] && data['headerTitle'] !== '')\n ) {\n <div class=\"src-popover__header\">\n @if (data['hasBackButton']) {\n <src-icon-button\n class=\"src-popover__back\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID() + '-header-back'\"\n (onClick)=\"emitBackAction()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n >\n <path\n d=\"m438-480 164 164q11 11 11 25.5T602-265q-11 11-25.5 11t-25.84-11.34L361-455q-5-5.4-7.5-11.7-2.5-6.3-2.5-13.5t2.5-13.5Q356-500 361-505l189.66-189.66Q562-706 576.5-706t25.5 11q11 11 11 25.5T602-644L438-480Z\"\n />\n </svg>\n </src-icon-button>\n }\n\n <div\n class=\"src-popover__title\"\n [attr.data-testid]=\"testID() + '-header-title'\"\n >\n {{ data.headerTitle }}\n </div>\n\n @if (data['hasCloseButton']) {\n <src-icon-button\n class=\"src-popover__close\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID() + '-header-close'\"\n (click)=\"close()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n >\n <path\n d=\"M10.0001 11.229L6.68618 14.5429C6.51951 14.7096 6.31818 14.7896 6.08218 14.7829C5.84618 14.7756 5.64485 14.6886 5.47818 14.5219C5.31151 14.3553 5.22818 14.1506 5.22818 13.9079C5.22818 13.6646 5.31151 13.4596 5.47818 13.2929L8.77107 10L5.45718 6.68615C5.29051 6.51949 5.21051 6.31482 5.21718 6.07215C5.22451 5.82882 5.31151 5.62382 5.47818 5.45715C5.64485 5.29049 5.84951 5.20715 6.09218 5.20715C6.33551 5.20715 6.54051 5.29049 6.70718 5.45715L10.0001 8.77105L13.314 5.45715C13.4806 5.29049 13.6853 5.20715 13.928 5.20715C14.1713 5.20715 14.3763 5.29049 14.543 5.45715C14.7096 5.62382 14.793 5.82882 14.793 6.07215C14.793 6.31482 14.7096 6.51949 14.543 6.68615L11.2291 10L14.543 13.3139C14.7096 13.4806 14.793 13.6819 14.793 13.9179C14.793 14.1539 14.7096 14.3553 14.543 14.5219C14.3763 14.6886 14.1713 14.7719 13.928 14.7719C13.6853 14.7719 13.4806 14.6886 13.314 14.5219L10.0001 11.229Z\"\n fill=\"currentColor\"\n />\n </svg>\n </src-icon-button>\n }\n </div>\n }\n\n <div class=\"src-popover__body\">\n @if (template()) {\n <ng-template [ngTemplateOutlet]=\"template()\"></ng-template>\n }\n </div>\n</div>\n", styles: ["src-popover{width:100%;display:block;max-height:90vh}.src-popover-backdrop{background-color:#0000}.src-popover-backdrop--mobile{background-color:#00000052}.src-popover-panel{--srcPopoverBg: var(--src-color-bg-default, #fff);--srcPopoverWidth: 320px}.src-popover-panel--mobile{--srcPopoverWidth: 100%}.src-popover{border-radius:var(--src-br-medium);box-shadow:var(--src-shadow-large);background-color:var(--srcPopoverBg)}.src-popover__header{display:flex;padding:12px;width:100%;border-bottom:1px solid var(--src-color-border-default, #e5e7eb)}.src-popover__body{padding:8px 0;width:var(--srcPopoverWidth)}.src-popover__body .src-list src-list-item:last-child{margin-bottom:0}.src-popover__title{font-size:var(--src-fs-medium);font-weight:var(--src-fw-semibold, 600);line-height:var(--src-lh-medium);color:var(--src-color-text-default);padding:0 4px;word-break:break-word}.src-popover__back{margin-right:8px}.src-popover__close{margin-left:auto}.src-popover__back svg,.src-popover__close svg{width:20px;height:20px;fill:var(--src-color-icon-default)}\n"], dependencies: [{ kind: "component", type: SourceIconButtonComponent, selector: "src-icon-button", inputs: ["name", "type", "size", "shape", "counter", "isActive", "isDisabled", "data-testid"], outputs: ["onClick"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
219
|
+
}
|
|
220
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverComponent, decorators: [{
|
|
221
|
+
type: Component,
|
|
222
|
+
args: [{ selector: 'src-popover', imports: [SourceIconButtonComponent, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"src-popover\"\n [style.maxHeight]=\"data.popoverMaxHeight\"\n [attr.data-testid]=\"testID()\"\n>\n @if (\n data['hasBackButton'] ||\n data['hasCloseButton'] ||\n (data['headerTitle'] && data['headerTitle'] !== '')\n ) {\n <div class=\"src-popover__header\">\n @if (data['hasBackButton']) {\n <src-icon-button\n class=\"src-popover__back\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID() + '-header-back'\"\n (onClick)=\"emitBackAction()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 -960 960 960\"\n fill=\"currentColor\"\n >\n <path\n d=\"m438-480 164 164q11 11 11 25.5T602-265q-11 11-25.5 11t-25.84-11.34L361-455q-5-5.4-7.5-11.7-2.5-6.3-2.5-13.5t2.5-13.5Q356-500 361-505l189.66-189.66Q562-706 576.5-706t25.5 11q11 11 11 25.5T602-644L438-480Z\"\n />\n </svg>\n </src-icon-button>\n }\n\n <div\n class=\"src-popover__title\"\n [attr.data-testid]=\"testID() + '-header-title'\"\n >\n {{ data.headerTitle }}\n </div>\n\n @if (data['hasCloseButton']) {\n <src-icon-button\n class=\"src-popover__close\"\n shape=\"round\"\n size=\"sm\"\n [data-testid]=\"testID() + '-header-close'\"\n (click)=\"close()\"\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n >\n <path\n d=\"M10.0001 11.229L6.68618 14.5429C6.51951 14.7096 6.31818 14.7896 6.08218 14.7829C5.84618 14.7756 5.64485 14.6886 5.47818 14.5219C5.31151 14.3553 5.22818 14.1506 5.22818 13.9079C5.22818 13.6646 5.31151 13.4596 5.47818 13.2929L8.77107 10L5.45718 6.68615C5.29051 6.51949 5.21051 6.31482 5.21718 6.07215C5.22451 5.82882 5.31151 5.62382 5.47818 5.45715C5.64485 5.29049 5.84951 5.20715 6.09218 5.20715C6.33551 5.20715 6.54051 5.29049 6.70718 5.45715L10.0001 8.77105L13.314 5.45715C13.4806 5.29049 13.6853 5.20715 13.928 5.20715C14.1713 5.20715 14.3763 5.29049 14.543 5.45715C14.7096 5.62382 14.793 5.82882 14.793 6.07215C14.793 6.31482 14.7096 6.51949 14.543 6.68615L11.2291 10L14.543 13.3139C14.7096 13.4806 14.793 13.6819 14.793 13.9179C14.793 14.1539 14.7096 14.3553 14.543 14.5219C14.3763 14.6886 14.1713 14.7719 13.928 14.7719C13.6853 14.7719 13.4806 14.6886 13.314 14.5219L10.0001 11.229Z\"\n fill=\"currentColor\"\n />\n </svg>\n </src-icon-button>\n }\n </div>\n }\n\n <div class=\"src-popover__body\">\n @if (template()) {\n <ng-template [ngTemplateOutlet]=\"template()\"></ng-template>\n }\n </div>\n</div>\n", styles: ["src-popover{width:100%;display:block;max-height:90vh}.src-popover-backdrop{background-color:#0000}.src-popover-backdrop--mobile{background-color:#00000052}.src-popover-panel{--srcPopoverBg: var(--src-color-bg-default, #fff);--srcPopoverWidth: 320px}.src-popover-panel--mobile{--srcPopoverWidth: 100%}.src-popover{border-radius:var(--src-br-medium);box-shadow:var(--src-shadow-large);background-color:var(--srcPopoverBg)}.src-popover__header{display:flex;padding:12px;width:100%;border-bottom:1px solid var(--src-color-border-default, #e5e7eb)}.src-popover__body{padding:8px 0;width:var(--srcPopoverWidth)}.src-popover__body .src-list src-list-item:last-child{margin-bottom:0}.src-popover__title{font-size:var(--src-fs-medium);font-weight:var(--src-fw-semibold, 600);line-height:var(--src-lh-medium);color:var(--src-color-text-default);padding:0 4px;word-break:break-word}.src-popover__back{margin-right:8px}.src-popover__close{margin-left:auto}.src-popover__back svg,.src-popover__close svg{width:20px;height:20px;fill:var(--src-color-icon-default)}\n"] }]
|
|
223
|
+
}] });
|
|
224
|
+
|
|
225
|
+
class SourcePopoverTriggerComponent {
|
|
226
|
+
constructor() {
|
|
227
|
+
this.srcPopoverTpl = input.required();
|
|
228
|
+
this.headerTitle = input();
|
|
229
|
+
this.activeClass = input();
|
|
230
|
+
this.hasBackButton = input(false);
|
|
231
|
+
this.hasCloseButton = input(true);
|
|
232
|
+
this.hasBackdrop = input(true);
|
|
233
|
+
this.closeOnBackdropClick = input(true);
|
|
234
|
+
this.popoverMaxHeight = input('auto');
|
|
235
|
+
this.panelCustomClass = input();
|
|
236
|
+
this.testID = input('', { alias: 'data-testid' });
|
|
237
|
+
this.breakpointDesktop = input('(min-width: 1024px)');
|
|
238
|
+
this.positions = input([
|
|
239
|
+
{
|
|
240
|
+
originX: 'start',
|
|
241
|
+
originY: 'bottom',
|
|
242
|
+
overlayX: 'start',
|
|
243
|
+
overlayY: 'top',
|
|
244
|
+
offsetY: 4,
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
originX: 'start',
|
|
248
|
+
originY: 'top',
|
|
249
|
+
overlayX: 'start',
|
|
250
|
+
overlayY: 'bottom',
|
|
251
|
+
offsetY: -8,
|
|
252
|
+
},
|
|
253
|
+
]);
|
|
254
|
+
this.popoverShown = signal(false);
|
|
255
|
+
this.onPopoverShown = output();
|
|
256
|
+
this.onBackButtonClick = output();
|
|
257
|
+
this.overlayRef = null;
|
|
258
|
+
this.sourcePopoverService = inject(SourcePopoverService, { self: true });
|
|
259
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
260
|
+
this.destroyRef = inject(DestroyRef);
|
|
261
|
+
}
|
|
262
|
+
ngOnInit() {
|
|
263
|
+
this.sourcePopoverService.backButtonClicked$
|
|
264
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
265
|
+
.subscribe(() => {
|
|
266
|
+
this.onBackButtonClick.emit(this.overlayRef);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
showPopover() {
|
|
270
|
+
const config = {
|
|
271
|
+
srcPopoverTpl: this.srcPopoverTpl(),
|
|
272
|
+
overlayOrigin: this.overlayOrigin,
|
|
273
|
+
headerTitle: this.headerTitle(),
|
|
274
|
+
hasBackButton: this.hasBackButton(),
|
|
275
|
+
hasCloseButton: this.hasCloseButton(),
|
|
276
|
+
popoverMaxHeight: this.popoverMaxHeight(),
|
|
277
|
+
panelCustomClass: this.panelCustomClass(),
|
|
278
|
+
breakpointDesktop: this.breakpointDesktop(),
|
|
279
|
+
position: this.positions(),
|
|
280
|
+
hasBackdrop: this.hasBackdrop(),
|
|
281
|
+
closeOnBackdropClick: this.closeOnBackdropClick(),
|
|
282
|
+
testID: this.testID(),
|
|
283
|
+
};
|
|
284
|
+
this.overlayRef = this.sourcePopoverService.show(this.overlayOrigin, this.viewContainerRef, config);
|
|
285
|
+
this.popoverShown.set(true);
|
|
286
|
+
this.onPopoverShown.emit(true);
|
|
287
|
+
this.overlayRef
|
|
288
|
+
.detachments()
|
|
289
|
+
.pipe(take(1))
|
|
290
|
+
.subscribe(() => {
|
|
291
|
+
this.popoverShown.set(false);
|
|
292
|
+
this.onPopoverShown.emit(false);
|
|
293
|
+
this.overlayRef = null;
|
|
294
|
+
});
|
|
295
|
+
this.overlayRef
|
|
296
|
+
.backdropClick()
|
|
297
|
+
.pipe(take(1))
|
|
298
|
+
.subscribe(() => this.overlayRef?.detach());
|
|
299
|
+
}
|
|
300
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverTriggerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
301
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: SourcePopoverTriggerComponent, isStandalone: true, selector: "src-popover-trigger", inputs: { srcPopoverTpl: { classPropertyName: "srcPopoverTpl", publicName: "srcPopoverTpl", isSignal: true, isRequired: true, transformFunction: null }, headerTitle: { classPropertyName: "headerTitle", publicName: "headerTitle", isSignal: true, isRequired: false, transformFunction: null }, activeClass: { classPropertyName: "activeClass", publicName: "activeClass", isSignal: true, isRequired: false, transformFunction: null }, hasBackButton: { classPropertyName: "hasBackButton", publicName: "hasBackButton", isSignal: true, isRequired: false, transformFunction: null }, hasCloseButton: { classPropertyName: "hasCloseButton", publicName: "hasCloseButton", isSignal: true, isRequired: false, transformFunction: null }, hasBackdrop: { classPropertyName: "hasBackdrop", publicName: "hasBackdrop", isSignal: true, isRequired: false, transformFunction: null }, closeOnBackdropClick: { classPropertyName: "closeOnBackdropClick", publicName: "closeOnBackdropClick", isSignal: true, isRequired: false, transformFunction: null }, popoverMaxHeight: { classPropertyName: "popoverMaxHeight", publicName: "popoverMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, panelCustomClass: { classPropertyName: "panelCustomClass", publicName: "panelCustomClass", isSignal: true, isRequired: false, transformFunction: null }, testID: { classPropertyName: "testID", publicName: "data-testid", isSignal: true, isRequired: false, transformFunction: null }, breakpointDesktop: { classPropertyName: "breakpointDesktop", publicName: "breakpointDesktop", isSignal: true, isRequired: false, transformFunction: null }, positions: { classPropertyName: "positions", publicName: "positions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onPopoverShown: "onPopoverShown", onBackButtonClick: "onBackButtonClick" }, providers: [SourcePopoverService], viewQueries: [{ propertyName: "overlayOrigin", first: true, predicate: CdkOverlayOrigin, descendants: true }], ngImport: i0, template: "<div\n cdkOverlayOrigin\n [attr.data-testid]=\"testID()\"\n (click)=\"showPopover()\"\n [class]=\"popoverShown() ? activeClass() || 'active' : ''\"\n>\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
302
|
+
}
|
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourcePopoverTriggerComponent, decorators: [{
|
|
304
|
+
type: Component,
|
|
305
|
+
args: [{ selector: 'src-popover-trigger', encapsulation: ViewEncapsulation.None, providers: [SourcePopoverService], changeDetection: ChangeDetectionStrategy.OnPush, imports: [CdkOverlayOrigin], template: "<div\n cdkOverlayOrigin\n [attr.data-testid]=\"testID()\"\n (click)=\"showPopover()\"\n [class]=\"popoverShown() ? activeClass() || 'active' : ''\"\n>\n <ng-content></ng-content>\n</div>\n" }]
|
|
306
|
+
}], propDecorators: { overlayOrigin: [{
|
|
307
|
+
type: ViewChild,
|
|
308
|
+
args: [CdkOverlayOrigin]
|
|
309
|
+
}] } });
|
|
310
|
+
|
|
311
|
+
register();
|
|
312
|
+
class SourceTabLineComponent {
|
|
313
|
+
constructor() {
|
|
314
|
+
this.swiperRef = viewChild('swiperRef');
|
|
315
|
+
this.tabs = input.required();
|
|
316
|
+
this.label = input.required();
|
|
317
|
+
this.selectedIndex = input(0);
|
|
318
|
+
this.isCompact = input(false);
|
|
319
|
+
this.offsetBefore = input(0);
|
|
320
|
+
this.offsetAfter = input(0);
|
|
321
|
+
this.spaceBetween = input(0);
|
|
322
|
+
this.isFullWidth = input(false);
|
|
323
|
+
this.isSwiper = input(false);
|
|
324
|
+
this.testID = input('', { alias: 'data-testid' });
|
|
325
|
+
this.tabsSelectedIndex = linkedSignal(() => this.selectedIndex());
|
|
326
|
+
this.onSelectTab = output();
|
|
327
|
+
this.classes = computed(() => this.isFullWidth() ? ['src-tab-line--full-width'] : []);
|
|
328
|
+
this.variables = computed(() => `--srcTabsOffsetBefore: ${this.tabsOffsetBefore()}px; --srcTabsOffsetAfter: ${this.tabsOffsetAfter()}px; --srcTabsSpaceBetween: ${this.spacing()}px;`);
|
|
329
|
+
this.tabsOffsetBefore = computed(() => this.offsetBefore() || (this.isCompact() ? 8 : 16));
|
|
330
|
+
this.tabsOffsetAfter = computed(() => this.offsetAfter() || (this.isCompact() ? 8 : 16));
|
|
331
|
+
this.spacing = computed(() => this.spaceBetween() || (this.isCompact() ? 0 : 4));
|
|
332
|
+
this._ = effect(() => {
|
|
333
|
+
const swiperRef = this.swiperRef();
|
|
334
|
+
untracked(() => {
|
|
335
|
+
if (!swiperRef?.nativeElement || !this.isSwiper())
|
|
336
|
+
return;
|
|
337
|
+
Object.assign(swiperRef.nativeElement, {
|
|
338
|
+
spaceBetween: this.spacing(),
|
|
339
|
+
slidesOffsetBefore: this.tabsOffsetBefore(),
|
|
340
|
+
slidesOffsetAfter: this.tabsOffsetAfter(),
|
|
341
|
+
slidesPerView: 'auto',
|
|
342
|
+
centeredSlides: false,
|
|
343
|
+
slideToClickedSlide: true,
|
|
344
|
+
});
|
|
345
|
+
swiperRef.nativeElement.initialize();
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
selectTab(tabIndex) {
|
|
350
|
+
this.tabsSelectedIndex.set(tabIndex);
|
|
351
|
+
this.onSelectTab.emit(tabIndex);
|
|
352
|
+
}
|
|
353
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
354
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: SourceTabLineComponent, isStandalone: true, selector: "src-tab-line", inputs: { tabs: { classPropertyName: "tabs", publicName: "tabs", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, isCompact: { classPropertyName: "isCompact", publicName: "isCompact", isSignal: true, isRequired: false, transformFunction: null }, offsetBefore: { classPropertyName: "offsetBefore", publicName: "offsetBefore", isSignal: true, isRequired: false, transformFunction: null }, offsetAfter: { classPropertyName: "offsetAfter", publicName: "offsetAfter", isSignal: true, isRequired: false, transformFunction: null }, spaceBetween: { classPropertyName: "spaceBetween", publicName: "spaceBetween", isSignal: true, isRequired: false, transformFunction: null }, isFullWidth: { classPropertyName: "isFullWidth", publicName: "isFullWidth", isSignal: true, isRequired: false, transformFunction: null }, isSwiper: { classPropertyName: "isSwiper", publicName: "isSwiper", isSignal: true, isRequired: false, transformFunction: null }, testID: { classPropertyName: "testID", publicName: "data-testid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectTab: "onSelectTab" }, viewQueries: [{ propertyName: "swiperRef", first: true, predicate: ["swiperRef"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"src-tab-line\" [ngClass]=\"classes()\" [attr.data-testid]=\"testID()\">\n @if (isSwiper()) {\n <div class=\"src-tabs__nav src-tabs__nav--swiper\">\n <swiper-container #swiperRef init=\"false\">\n @for (tab of tabs(); track tab) {\n <swiper-slide\n class=\"src-tabs__nav-slide\"\n [attr.data-testid]=\"testID() + '-slide-' + $index\"\n >\n <ng-container\n [ngTemplateOutlet]=\"slideTemplate\"\n [ngTemplateOutletContext]=\"{ tab: tab, index: $index }\"\n >\n </ng-container>\n </swiper-slide>\n }\n </swiper-container>\n </div>\n } @else {\n <div class=\"src-tabs__nav\" [style]=\"variables()\">\n @for (tab of tabs(); track tab) {\n <div\n class=\"src-tabs__nav-slide\"\n [attr.data-testid]=\"testID() + '-slide-' + $index\"\n >\n <ng-container\n [ngTemplateOutlet]=\"slideTemplate\"\n [ngTemplateOutletContext]=\"{ tab: tab, index: $index }\"\n >\n </ng-container>\n </div>\n }\n </div>\n }\n</div>\n\n<ng-template #slideTemplate let-tab=\"tab\" let-i=\"index\">\n <div\n class=\"src-tabs__nav-item\"\n (click)=\"selectTab(i)\"\n [class.src-tabs__nav-item--active]=\"i === tabsSelectedIndex()\"\n [class.src-disabled]=\"tab.isDisabled\"\n >\n <div class=\"text-label\" [attr.data-testid]=\"testID() + '-tab-label-' + i\">\n {{ tab[label()] }}\n </div>\n </div>\n</ng-template>\n", styles: [".src-tab-line{--srcTabActiveBorderBg: transparent;--srcTabActiveBorderRadius: 4px 4px 0 0;--srcTabActiveBorderWidth: 100%;--srcTabActiveBorderHeight: 3px;--srcTabTextColor: var(--src-color-text-defaul-subdued);--srcTabTextWeight: var(--src-fw-regular, 400);--srcTabTextSize: var(--src-fs-base, 14px);--srcTabTextLineHeight: var(--src-lh-base, 20px)}.src-tabs__nav{width:100%;display:flex;padding:0;margin:0;list-style:none;background:var(--src-color-bg-default, #fff);box-shadow:0 -1px #e1e3e5 inset}.src-tabs__nav swiper-container{width:100%}.src-tabs__nav swiper-container .src-tabs__nav-slide{width:auto}.src-tabs__nav:not(.src-tabs__nav--swiper){padding-left:var(--srcTabsOffsetBefore);padding-right:var(--srcTabsOffsetAfter);gap:var(--srcTabsSpaceBetween)}.src-tabs__nav-item{flex-shrink:0;margin:0;text-align:center}.src-tabs__nav-item .text-label{width:100%;padding:14px 16px;font-size:var(--srcTabTextSize);font-style:normal;cursor:pointer;font-weight:var(--srcTabTextWeight);line-height:var(--srcTabTextLineHeight);color:var(--srcTabTextColor);position:relative;text-decoration:none;background-color:transparent;border:none}.src-tabs__nav-item .text-label:after{content:\"\";position:absolute;bottom:0;left:0;border-radius:var(--srcTabActiveBorderRadius);width:var(--srcTabActiveBorderWidth);height:var(--srcTabActiveBorderHeight);background:var(--srcTabActiveBorderBg)}.src-tabs__nav-item:hover{--srcTabActiveBorderBg: var(--src-color-bg-strong);--srcTabTextColor: var(--src-color-text-default)}.src-tabs__nav-item.src-disabled{--srcTabTextColor: var(--src-color-text-default-disabled);pointer-events:none}.src-tabs__nav-item--active{--srcTabActiveBorderBg: var(--src-color-bg-primary);--srcTabTextColor: var(--src-color-text-default);--srcTabTextWeight: 500}.src-tabs__nav-item--active.src-disabled{--srcTabActiveBorderBg: var(--src-color-border-strong-disabled);--srcTabTextColor: var(--src-color-text-default-disabled)}.src-tabs__nav-item--active:hover{--srcTabTextColor: var(--src-color-text-default);--srcTabActiveBorderBg: var(--src-color-bg-primary)}.src-tab-line--full-width .src-tabs__nav-slide{flex-grow:1}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
355
|
+
}
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabLineComponent, decorators: [{
|
|
357
|
+
type: Component,
|
|
358
|
+
args: [{ selector: 'src-tab-line', imports: [NgClass, NgTemplateOutlet], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, schemas: [CUSTOM_ELEMENTS_SCHEMA], template: "<div class=\"src-tab-line\" [ngClass]=\"classes()\" [attr.data-testid]=\"testID()\">\n @if (isSwiper()) {\n <div class=\"src-tabs__nav src-tabs__nav--swiper\">\n <swiper-container #swiperRef init=\"false\">\n @for (tab of tabs(); track tab) {\n <swiper-slide\n class=\"src-tabs__nav-slide\"\n [attr.data-testid]=\"testID() + '-slide-' + $index\"\n >\n <ng-container\n [ngTemplateOutlet]=\"slideTemplate\"\n [ngTemplateOutletContext]=\"{ tab: tab, index: $index }\"\n >\n </ng-container>\n </swiper-slide>\n }\n </swiper-container>\n </div>\n } @else {\n <div class=\"src-tabs__nav\" [style]=\"variables()\">\n @for (tab of tabs(); track tab) {\n <div\n class=\"src-tabs__nav-slide\"\n [attr.data-testid]=\"testID() + '-slide-' + $index\"\n >\n <ng-container\n [ngTemplateOutlet]=\"slideTemplate\"\n [ngTemplateOutletContext]=\"{ tab: tab, index: $index }\"\n >\n </ng-container>\n </div>\n }\n </div>\n }\n</div>\n\n<ng-template #slideTemplate let-tab=\"tab\" let-i=\"index\">\n <div\n class=\"src-tabs__nav-item\"\n (click)=\"selectTab(i)\"\n [class.src-tabs__nav-item--active]=\"i === tabsSelectedIndex()\"\n [class.src-disabled]=\"tab.isDisabled\"\n >\n <div class=\"text-label\" [attr.data-testid]=\"testID() + '-tab-label-' + i\">\n {{ tab[label()] }}\n </div>\n </div>\n</ng-template>\n", styles: [".src-tab-line{--srcTabActiveBorderBg: transparent;--srcTabActiveBorderRadius: 4px 4px 0 0;--srcTabActiveBorderWidth: 100%;--srcTabActiveBorderHeight: 3px;--srcTabTextColor: var(--src-color-text-defaul-subdued);--srcTabTextWeight: var(--src-fw-regular, 400);--srcTabTextSize: var(--src-fs-base, 14px);--srcTabTextLineHeight: var(--src-lh-base, 20px)}.src-tabs__nav{width:100%;display:flex;padding:0;margin:0;list-style:none;background:var(--src-color-bg-default, #fff);box-shadow:0 -1px #e1e3e5 inset}.src-tabs__nav swiper-container{width:100%}.src-tabs__nav swiper-container .src-tabs__nav-slide{width:auto}.src-tabs__nav:not(.src-tabs__nav--swiper){padding-left:var(--srcTabsOffsetBefore);padding-right:var(--srcTabsOffsetAfter);gap:var(--srcTabsSpaceBetween)}.src-tabs__nav-item{flex-shrink:0;margin:0;text-align:center}.src-tabs__nav-item .text-label{width:100%;padding:14px 16px;font-size:var(--srcTabTextSize);font-style:normal;cursor:pointer;font-weight:var(--srcTabTextWeight);line-height:var(--srcTabTextLineHeight);color:var(--srcTabTextColor);position:relative;text-decoration:none;background-color:transparent;border:none}.src-tabs__nav-item .text-label:after{content:\"\";position:absolute;bottom:0;left:0;border-radius:var(--srcTabActiveBorderRadius);width:var(--srcTabActiveBorderWidth);height:var(--srcTabActiveBorderHeight);background:var(--srcTabActiveBorderBg)}.src-tabs__nav-item:hover{--srcTabActiveBorderBg: var(--src-color-bg-strong);--srcTabTextColor: var(--src-color-text-default)}.src-tabs__nav-item.src-disabled{--srcTabTextColor: var(--src-color-text-default-disabled);pointer-events:none}.src-tabs__nav-item--active{--srcTabActiveBorderBg: var(--src-color-bg-primary);--srcTabTextColor: var(--src-color-text-default);--srcTabTextWeight: 500}.src-tabs__nav-item--active.src-disabled{--srcTabActiveBorderBg: var(--src-color-border-strong-disabled);--srcTabTextColor: var(--src-color-text-default-disabled)}.src-tabs__nav-item--active:hover{--srcTabTextColor: var(--src-color-text-default);--srcTabActiveBorderBg: var(--src-color-bg-primary)}.src-tab-line--full-width .src-tabs__nav-slide{flex-grow:1}\n"] }]
|
|
359
|
+
}] });
|
|
360
|
+
|
|
361
|
+
class SourceTabsComponent {
|
|
362
|
+
constructor() {
|
|
363
|
+
this.label = input.required();
|
|
364
|
+
this.data = input.required();
|
|
365
|
+
this.selectedIndex = input(0);
|
|
366
|
+
this.headerTemplate = input();
|
|
367
|
+
this.isCompact = input(false);
|
|
368
|
+
this.isFullWidth = input(false);
|
|
369
|
+
this.isSwiper = input(false);
|
|
370
|
+
this.swiperConfig = input();
|
|
371
|
+
this.testID = input('', { alias: 'data-testid' });
|
|
372
|
+
this.onSelectTab = output();
|
|
373
|
+
}
|
|
374
|
+
setActive(idx) {
|
|
375
|
+
this.onSelectTab.emit(idx);
|
|
376
|
+
}
|
|
377
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
378
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: SourceTabsComponent, isStandalone: true, selector: "src-tabs", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, selectedIndex: { classPropertyName: "selectedIndex", publicName: "selectedIndex", isSignal: true, isRequired: false, transformFunction: null }, headerTemplate: { classPropertyName: "headerTemplate", publicName: "headerTemplate", isSignal: true, isRequired: false, transformFunction: null }, isCompact: { classPropertyName: "isCompact", publicName: "isCompact", isSignal: true, isRequired: false, transformFunction: null }, isFullWidth: { classPropertyName: "isFullWidth", publicName: "isFullWidth", isSignal: true, isRequired: false, transformFunction: null }, isSwiper: { classPropertyName: "isSwiper", publicName: "isSwiper", isSignal: true, isRequired: false, transformFunction: null }, swiperConfig: { classPropertyName: "swiperConfig", publicName: "swiperConfig", isSignal: true, isRequired: false, transformFunction: null }, testID: { classPropertyName: "testID", publicName: "data-testid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onSelectTab: "onSelectTab" }, ngImport: i0, template: "<div class=\"src-tabs\">\n <ng-template #defaultTabsHeader>\n <src-tab-line\n [tabs]=\"data()\"\n [label]=\"label()\"\n [isCompact]=\"isCompact()\"\n [isFullWidth]=\"isFullWidth()\"\n [selectedIndex]=\"selectedIndex()\"\n [isSwiper]=\"isSwiper()\"\n [data-testid]=\"testID()\"\n (onSelectTab)=\"setActive($event)\"\n ></src-tab-line>\n </ng-template>\n\n <ng-container\n *ngTemplateOutlet=\"\n headerTemplate() ? headerTemplate()! : defaultTabsHeader;\n context: { tabs: this.data }\n \"\n >\n </ng-container>\n\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SourceTabLineComponent, selector: "src-tab-line", inputs: ["tabs", "label", "selectedIndex", "isCompact", "offsetBefore", "offsetAfter", "spaceBetween", "isFullWidth", "isSwiper", "data-testid"], outputs: ["onSelectTab"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
379
|
+
}
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabsComponent, decorators: [{
|
|
381
|
+
type: Component,
|
|
382
|
+
args: [{ selector: 'src-tabs', imports: [NgTemplateOutlet, SourceTabLineComponent], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"src-tabs\">\n <ng-template #defaultTabsHeader>\n <src-tab-line\n [tabs]=\"data()\"\n [label]=\"label()\"\n [isCompact]=\"isCompact()\"\n [isFullWidth]=\"isFullWidth()\"\n [selectedIndex]=\"selectedIndex()\"\n [isSwiper]=\"isSwiper()\"\n [data-testid]=\"testID()\"\n (onSelectTab)=\"setActive($event)\"\n ></src-tab-line>\n </ng-template>\n\n <ng-container\n *ngTemplateOutlet=\"\n headerTemplate() ? headerTemplate()! : defaultTabsHeader;\n context: { tabs: this.data }\n \"\n >\n </ng-container>\n\n <ng-content></ng-content>\n</div>\n" }]
|
|
383
|
+
}] });
|
|
384
|
+
|
|
385
|
+
class SourceTabComponent {
|
|
386
|
+
constructor() {
|
|
387
|
+
this.isActive = input(false);
|
|
388
|
+
}
|
|
389
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
390
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: SourceTabComponent, isStandalone: true, selector: "src-tab", inputs: { isActive: { classPropertyName: "isActive", publicName: "isActive", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [hidden]=\"!isActive()\" class=\"src-tab-content\">\n <ng-content></ng-content>\n</div>\n", styles: [".src-tab-content{padding:var(--spacing-16);background-color:var(--color-bg-default)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
391
|
+
}
|
|
392
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: SourceTabComponent, decorators: [{
|
|
393
|
+
type: Component,
|
|
394
|
+
args: [{ selector: 'src-tab', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [hidden]=\"!isActive()\" class=\"src-tab-content\">\n <ng-content></ng-content>\n</div>\n", styles: [".src-tab-content{padding:var(--spacing-16);background-color:var(--color-bg-default)}\n"] }]
|
|
395
|
+
}] });
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Generated bundle index. Do not edit.
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
export { SourceModalComponent, SourceModalSize, SourcePopoverComponent, SourcePopoverService, SourcePopoverTriggerComponent, SourceTabComponent, SourceTabLineComponent, SourceTabsComponent, SourceUiComponent, defaultSourcePopoverConfig };
|
|
402
|
+
//# sourceMappingURL=3dsource-source-ui.mjs.map
|