@guildofgleks/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/README.md +64 -0
- package/fesm2022/guildofgleks-ui.mjs +2159 -0
- package/fesm2022/guildofgleks-ui.mjs.map +1 -0
- package/package.json +24 -0
- package/src/styles/fonts.css +17 -0
- package/src/styles/index.css +3 -0
- package/src/styles/tokens.scss +82 -0
- package/src/styles/typography.css +15 -0
- package/src/styles/utilities.css +27 -0
- package/types/guildofgleks-ui.d.ts +723 -0
|
@@ -0,0 +1,2159 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component, output, computed, inject, DestroyRef, TemplateRef, Directive, ElementRef, contentChild, signal, effect, model, forwardRef, InjectionToken, Injectable, Injector, viewChild, afterNextRender, ApplicationRef, EnvironmentInjector, PLATFORM_ID, createComponent, contentChildren } from '@angular/core';
|
|
3
|
+
import { Subject, timer } from 'rxjs';
|
|
4
|
+
import { throttle } from 'rxjs/operators';
|
|
5
|
+
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { NgTemplateOutlet, DOCUMENT, NgComponentOutlet, isPlatformBrowser } from '@angular/common';
|
|
7
|
+
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
8
|
+
|
|
9
|
+
class SpinnerComponent {
|
|
10
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
11
|
+
overlay = input(false, ...(ngDevMode ? [{ debugName: "overlay" }] : /* istanbul ignore next */ []));
|
|
12
|
+
ariaLabel = input('Loading', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SpinnerComponent, isStandalone: true, selector: "gog-spinner", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, overlay: { classPropertyName: "overlay", publicName: "overlay", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "gog-inline-center" }, ngImport: i0, template: "@if (overlay()) {\n <div class=\"gog-spinner__overlay gog-flex-center\">\n <div class=\"gog-spinner__wrap gog-contained-layout gog-spinner__wrap--{{ size() }}\">\n <ng-container *ngTemplateOutlet=\"spinnerTpl\" />\n </div>\n </div>\n} @else {\n <div class=\"gog-spinner__wrap gog-contained-layout gog-spinner__wrap--{{ size() }}\">\n <ng-container *ngTemplateOutlet=\"spinnerTpl\" />\n </div>\n}\n\n<ng-template #spinnerTpl>\n <svg class=\"gog-spinner__svg\" viewBox=\"0 0 64 64\" fill=\"none\" aria-hidden=\"true\">\n <!-- Static dim track -->\n <circle class=\"gog-spinner__track\" cx=\"32\" cy=\"32\" r=\"26\" stroke-width=\"1.5\" />\n\n <!-- Outer arc \u2014 rotates clockwise, long segment -->\n <circle\n class=\"gog-spinner__arc-outer\"\n cx=\"32\"\n cy=\"32\"\n r=\"26\"\n stroke-width=\"2.5\"\n stroke-linecap=\"butt\"\n />\n\n <!-- Inner arc \u2014 rotates counter-clockwise, short segment -->\n <circle\n class=\"gog-spinner__arc-inner\"\n cx=\"32\"\n cy=\"32\"\n r=\"18\"\n stroke-width=\"1.5\"\n stroke-linecap=\"butt\"\n />\n\n <!-- Rotating diamond ticks group \u2014 single transform on <g> works correctly -->\n <g class=\"gog-spinner__ticks\">\n <polygon points=\"32,3 34,6 32,9 30,6\" class=\"gog-spinner__diamond\" />\n <polygon points=\"32,55 34,58 32,61 30,58\" class=\"gog-spinner__diamond\" />\n <polygon points=\"3,32 6,30 9,32 6,34\" class=\"gog-spinner__diamond\" />\n <polygon points=\"55,32 58,30 61,32 58,34\" class=\"gog-spinner__diamond\" />\n </g>\n\n <!-- Inner rune \u2014 glow pulse only, no transform -->\n <text\n class=\"gog-spinner__rune-wrap gog-spinner__rune\"\n x=\"32\"\n y=\"32\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n >\n \u2726\n </text>\n </svg>\n</ng-template>\n", styles: ["@charset \"UTF-8\";.gog-spinner__overlay{position:fixed;inset:0;z-index:8000;background:var(--gog-spinner-overlay-bg, rgba(10, 8, 3, .65));-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:gog-spinner-fade-in .2s ease}.gog-spinner__wrap{flex-shrink:0}.gog-spinner__wrap--sm{width:var(--gog-spinner-size-sm, 18px);height:var(--gog-spinner-size-sm, 18px)}.gog-spinner__wrap--md{width:var(--gog-spinner-size-md, 48px);height:var(--gog-spinner-size-md, 48px)}.gog-spinner__wrap--lg{width:var(--gog-spinner-size-lg, 96px);height:var(--gog-spinner-size-lg, 96px)}.gog-spinner__svg{width:100%;height:100%;overflow:visible}.gog-spinner__track{stroke:var(--gog-spinner-color, var(--accent-dim));opacity:.35}.gog-spinner__arc-outer{stroke:var(--gog-spinner-color, var(--accent-color));stroke-dasharray:100 63;transform-origin:32px 32px;animation:gog-spin-cw 1.4s linear infinite,gog-arc-outer-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 5px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__arc-inner{stroke:var(--gog-spinner-color, var(--accent-bright));stroke-dasharray:35 78;transform-origin:32px 32px;animation:gog-spin-ccw 2s linear infinite,gog-arc-inner-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 4px var(--gog-spinner-color, var(--accent-bright)));opacity:.75}.gog-spinner__ticks{transform-origin:32px 32px;animation:gog-spin-ccw 6s linear infinite}.gog-spinner__diamond{fill:var(--gog-spinner-color, var(--accent-bright));opacity:.85;filter:drop-shadow(0 0 3px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__rune-wrap{animation:gog-rune-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 6px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__rune{font-family:var(--font-heading),serif;fill:var(--gog-spinner-color, var(--accent-bright));font-size:var(--gog-spinner-rune-size, 20px)}.gog-spinner__wrap--sm .gog-spinner__arc-inner{stroke-width:1}@keyframes gog-spin-cw{to{transform:rotate(360deg)}}@keyframes gog-spin-ccw{to{transform:rotate(-360deg)}}@keyframes gog-arc-outer-pulse{0%,to{opacity:1}50%{opacity:.8}}@keyframes gog-arc-inner-pulse{0%,to{opacity:.75}50%{opacity:.45}}@keyframes gog-rune-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes gog-spinner-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.gog-spinner__arc-outer,.gog-spinner__arc-inner,.gog-spinner__ticks,.gog-spinner__rune-wrap{animation:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
15
|
+
}
|
|
16
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
17
|
+
type: Component,
|
|
18
|
+
args: [{ selector: 'gog-spinner', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
19
|
+
class: 'gog-inline-center',
|
|
20
|
+
}, template: "@if (overlay()) {\n <div class=\"gog-spinner__overlay gog-flex-center\">\n <div class=\"gog-spinner__wrap gog-contained-layout gog-spinner__wrap--{{ size() }}\">\n <ng-container *ngTemplateOutlet=\"spinnerTpl\" />\n </div>\n </div>\n} @else {\n <div class=\"gog-spinner__wrap gog-contained-layout gog-spinner__wrap--{{ size() }}\">\n <ng-container *ngTemplateOutlet=\"spinnerTpl\" />\n </div>\n}\n\n<ng-template #spinnerTpl>\n <svg class=\"gog-spinner__svg\" viewBox=\"0 0 64 64\" fill=\"none\" aria-hidden=\"true\">\n <!-- Static dim track -->\n <circle class=\"gog-spinner__track\" cx=\"32\" cy=\"32\" r=\"26\" stroke-width=\"1.5\" />\n\n <!-- Outer arc \u2014 rotates clockwise, long segment -->\n <circle\n class=\"gog-spinner__arc-outer\"\n cx=\"32\"\n cy=\"32\"\n r=\"26\"\n stroke-width=\"2.5\"\n stroke-linecap=\"butt\"\n />\n\n <!-- Inner arc \u2014 rotates counter-clockwise, short segment -->\n <circle\n class=\"gog-spinner__arc-inner\"\n cx=\"32\"\n cy=\"32\"\n r=\"18\"\n stroke-width=\"1.5\"\n stroke-linecap=\"butt\"\n />\n\n <!-- Rotating diamond ticks group \u2014 single transform on <g> works correctly -->\n <g class=\"gog-spinner__ticks\">\n <polygon points=\"32,3 34,6 32,9 30,6\" class=\"gog-spinner__diamond\" />\n <polygon points=\"32,55 34,58 32,61 30,58\" class=\"gog-spinner__diamond\" />\n <polygon points=\"3,32 6,30 9,32 6,34\" class=\"gog-spinner__diamond\" />\n <polygon points=\"55,32 58,30 61,32 58,34\" class=\"gog-spinner__diamond\" />\n </g>\n\n <!-- Inner rune \u2014 glow pulse only, no transform -->\n <text\n class=\"gog-spinner__rune-wrap gog-spinner__rune\"\n x=\"32\"\n y=\"32\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n >\n \u2726\n </text>\n </svg>\n</ng-template>\n", styles: ["@charset \"UTF-8\";.gog-spinner__overlay{position:fixed;inset:0;z-index:8000;background:var(--gog-spinner-overlay-bg, rgba(10, 8, 3, .65));-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:gog-spinner-fade-in .2s ease}.gog-spinner__wrap{flex-shrink:0}.gog-spinner__wrap--sm{width:var(--gog-spinner-size-sm, 18px);height:var(--gog-spinner-size-sm, 18px)}.gog-spinner__wrap--md{width:var(--gog-spinner-size-md, 48px);height:var(--gog-spinner-size-md, 48px)}.gog-spinner__wrap--lg{width:var(--gog-spinner-size-lg, 96px);height:var(--gog-spinner-size-lg, 96px)}.gog-spinner__svg{width:100%;height:100%;overflow:visible}.gog-spinner__track{stroke:var(--gog-spinner-color, var(--accent-dim));opacity:.35}.gog-spinner__arc-outer{stroke:var(--gog-spinner-color, var(--accent-color));stroke-dasharray:100 63;transform-origin:32px 32px;animation:gog-spin-cw 1.4s linear infinite,gog-arc-outer-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 5px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__arc-inner{stroke:var(--gog-spinner-color, var(--accent-bright));stroke-dasharray:35 78;transform-origin:32px 32px;animation:gog-spin-ccw 2s linear infinite,gog-arc-inner-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 4px var(--gog-spinner-color, var(--accent-bright)));opacity:.75}.gog-spinner__ticks{transform-origin:32px 32px;animation:gog-spin-ccw 6s linear infinite}.gog-spinner__diamond{fill:var(--gog-spinner-color, var(--accent-bright));opacity:.85;filter:drop-shadow(0 0 3px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__rune-wrap{animation:gog-rune-pulse 2.8s ease-in-out infinite;filter:drop-shadow(0 0 6px var(--gog-spinner-color, var(--accent-color)))}.gog-spinner__rune{font-family:var(--font-heading),serif;fill:var(--gog-spinner-color, var(--accent-bright));font-size:var(--gog-spinner-rune-size, 20px)}.gog-spinner__wrap--sm .gog-spinner__arc-inner{stroke-width:1}@keyframes gog-spin-cw{to{transform:rotate(360deg)}}@keyframes gog-spin-ccw{to{transform:rotate(-360deg)}}@keyframes gog-arc-outer-pulse{0%,to{opacity:1}50%{opacity:.8}}@keyframes gog-arc-inner-pulse{0%,to{opacity:.75}50%{opacity:.45}}@keyframes gog-rune-pulse{0%,to{opacity:1}50%{opacity:.4}}@keyframes gog-spinner-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.gog-spinner__arc-outer,.gog-spinner__arc-inner,.gog-spinner__ticks,.gog-spinner__rune-wrap{animation:none}}\n"] }]
|
|
21
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], overlay: [{ type: i0.Input, args: [{ isSignal: true, alias: "overlay", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
22
|
+
|
|
23
|
+
class ButtonComponent {
|
|
24
|
+
variant = input('primary', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
25
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
26
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
27
|
+
fullWidth = input(false, ...(ngDevMode ? [{ debugName: "fullWidth" }] : /* istanbul ignore next */ []));
|
|
28
|
+
type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
29
|
+
debounce = input(300, ...(ngDevMode ? [{ debugName: "debounce" }] : /* istanbul ignore next */ []));
|
|
30
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
31
|
+
gogClick = output();
|
|
32
|
+
isDisabled = computed(() => this.disabled() || this.loading(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
33
|
+
spinnerSize = computed(() => (this.size() === 'lg' ? 'md' : 'sm'), ...(ngDevMode ? [{ debugName: "spinnerSize" }] : /* istanbul ignore next */ []));
|
|
34
|
+
destroyRef = inject(DestroyRef);
|
|
35
|
+
click$ = new Subject();
|
|
36
|
+
constructor() {
|
|
37
|
+
this.click$
|
|
38
|
+
.pipe(throttle(() => timer(this.debounce()), { leading: true, trailing: false }), takeUntilDestroyed(this.destroyRef))
|
|
39
|
+
.subscribe((event) => this.gogClick.emit(event));
|
|
40
|
+
}
|
|
41
|
+
onClick(event) {
|
|
42
|
+
if (this.isDisabled())
|
|
43
|
+
return;
|
|
44
|
+
this.click$.next(event);
|
|
45
|
+
}
|
|
46
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
47
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ButtonComponent, isStandalone: true, selector: "gog-button", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, fullWidth: { classPropertyName: "fullWidth", publicName: "fullWidth", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, debounce: { classPropertyName: "debounce", publicName: "debounce", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gogClick: "gogClick" }, ngImport: i0, template: "<button\n (click)=\"onClick($event)\"\n [attr.disabled]=\"isDisabled() ? true : null\"\n [class.gog-cursor-not-allowed]=\"isDisabled()\"\n [class.gog-cursor-pointer]=\"!isDisabled()\"\n [class.gog-cursor-wait]=\"loading()\"\n [class.gog-btn--ghost]=\"variant() === 'ghost'\"\n [class.gog-btn--lg]=\"size() === 'lg'\"\n [class.gog-btn--loading]=\"loading()\"\n [class.gog-btn--md]=\"size() === 'md'\"\n [class.gog-btn--outline]=\"variant() === 'outline'\"\n [class.gog-btn--primary]=\"variant() === 'primary'\"\n [class.gog-btn--secondary]=\"variant() === 'secondary'\"\n [class.gog-btn--sm]=\"size() === 'sm'\"\n [type]=\"type()\"\n class=\"gog-btn gog-inline-center gog-contained-layout fw-black font-heading\"\n>\n @if (loading()) {\n <gog-spinner [size]=\"spinnerSize()\" aria-hidden=\"true\" class=\"gog-btn__spinner\" />\n }\n\n <span [class.gog-btn__content--hidden]=\"loading()\" class=\"gog-btn__content\">\n <ng-content></ng-content>\n </span>\n</button>\n", styles: [".gog-btn{--gog-btn-bg: var(--accent-color);--gog-btn-color: var(--primary-color);--gog-btn-border: transparent;--gog-btn-radius: var(--radius);--gog-btn-padding: var(--btn-md-padding);--gog-btn-font-size: var(--btn-md-font-size);--gog-btn-shadow: none;--gog-btn-hover-bg: var(--accent-bright);--gog-btn-hover-shadow: 0 0 12px color-mix(in srgb, var(--accent-bright) 35%, transparent);--gog-spinner-color: var(--text-color);gap:8px;border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-btn-border);border-radius:var(--gog-btn-radius);padding:var(--gog-btn-padding);font-size:var(--gog-btn-font-size);letter-spacing:1px;text-transform:uppercase;background-color:var(--gog-btn-bg);color:var(--gog-btn-color);box-shadow:var(--gog-btn-shadow);cursor:pointer;transition:background-color .15s ease,box-shadow .15s ease,color .15s ease;line-height:1}.gog-btn:focus-visible{outline:3px solid var(--gog-btn-hover-bg);outline-offset:3px}.gog-btn:hover:not(:disabled){background-color:var(--gog-btn-hover-bg);box-shadow:var(--gog-btn-hover-shadow)}.gog-btn:active:not(:disabled){transform:scale(.97)}@media(prefers-reduced-motion:reduce){.gog-btn{transition:none}.gog-btn:active:not(:disabled){transform:none}}.gog-btn:disabled{opacity:.4;cursor:not-allowed}.gog-btn--primary{--gog-btn-bg: var(--accent-color);--gog-btn-color: var(--primary-color);--gog-btn-hover-bg: var(--accent-bright);--gog-btn-hover-shadow: 0 0 16px color-mix(in srgb, var(--accent-bright) 45%, transparent)}.gog-btn--secondary{--gog-btn-bg: var(--secondary-color);--gog-btn-color: var(--primary-color);--gog-btn-hover-bg: var(--accent-color);--gog-btn-hover-shadow: none}.gog-btn--outline{--gog-btn-bg: transparent;--gog-btn-color: var(--accent-color);--gog-btn-border: var(--accent-color);--gog-btn-hover-bg: var(--accent-color);--gog-btn-hover-shadow: none;--gog-spinner-color: var(--accent-color)}.gog-btn--outline:hover:not(:disabled){color:var(--primary-color)}.gog-btn--ghost{--gog-btn-bg: transparent;--gog-btn-color: var(--accent-color);--gog-btn-hover-bg: color-mix(in srgb, var(--accent-color) 12%, transparent);--gog-btn-hover-shadow: none;--gog-spinner-color: var(--accent-color)}.gog-btn--sm{--gog-btn-padding: var(--btn-sm-padding);--gog-btn-font-size: var(--btn-sm-font-size)}.gog-btn--lg{--gog-btn-padding: var(--btn-lg-padding);--gog-btn-font-size: var(--btn-lg-font-size)}:host(.gog-host--full-width){display:flex}:host(.gog-host--full-width) .gog-btn{width:100%}.gog-btn--loading{position:relative;pointer-events:none}.gog-btn__content--hidden{visibility:hidden}.gog-btn__spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:70%;max-height:70%}\n"], dependencies: [{ kind: "component", type: SpinnerComponent, selector: "gog-spinner", inputs: ["size", "overlay", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ButtonComponent, decorators: [{
|
|
50
|
+
type: Component,
|
|
51
|
+
args: [{ selector: 'gog-button', imports: [SpinnerComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n (click)=\"onClick($event)\"\n [attr.disabled]=\"isDisabled() ? true : null\"\n [class.gog-cursor-not-allowed]=\"isDisabled()\"\n [class.gog-cursor-pointer]=\"!isDisabled()\"\n [class.gog-cursor-wait]=\"loading()\"\n [class.gog-btn--ghost]=\"variant() === 'ghost'\"\n [class.gog-btn--lg]=\"size() === 'lg'\"\n [class.gog-btn--loading]=\"loading()\"\n [class.gog-btn--md]=\"size() === 'md'\"\n [class.gog-btn--outline]=\"variant() === 'outline'\"\n [class.gog-btn--primary]=\"variant() === 'primary'\"\n [class.gog-btn--secondary]=\"variant() === 'secondary'\"\n [class.gog-btn--sm]=\"size() === 'sm'\"\n [type]=\"type()\"\n class=\"gog-btn gog-inline-center gog-contained-layout fw-black font-heading\"\n>\n @if (loading()) {\n <gog-spinner [size]=\"spinnerSize()\" aria-hidden=\"true\" class=\"gog-btn__spinner\" />\n }\n\n <span [class.gog-btn__content--hidden]=\"loading()\" class=\"gog-btn__content\">\n <ng-content></ng-content>\n </span>\n</button>\n", styles: [".gog-btn{--gog-btn-bg: var(--accent-color);--gog-btn-color: var(--primary-color);--gog-btn-border: transparent;--gog-btn-radius: var(--radius);--gog-btn-padding: var(--btn-md-padding);--gog-btn-font-size: var(--btn-md-font-size);--gog-btn-shadow: none;--gog-btn-hover-bg: var(--accent-bright);--gog-btn-hover-shadow: 0 0 12px color-mix(in srgb, var(--accent-bright) 35%, transparent);--gog-spinner-color: var(--text-color);gap:8px;border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-btn-border);border-radius:var(--gog-btn-radius);padding:var(--gog-btn-padding);font-size:var(--gog-btn-font-size);letter-spacing:1px;text-transform:uppercase;background-color:var(--gog-btn-bg);color:var(--gog-btn-color);box-shadow:var(--gog-btn-shadow);cursor:pointer;transition:background-color .15s ease,box-shadow .15s ease,color .15s ease;line-height:1}.gog-btn:focus-visible{outline:3px solid var(--gog-btn-hover-bg);outline-offset:3px}.gog-btn:hover:not(:disabled){background-color:var(--gog-btn-hover-bg);box-shadow:var(--gog-btn-hover-shadow)}.gog-btn:active:not(:disabled){transform:scale(.97)}@media(prefers-reduced-motion:reduce){.gog-btn{transition:none}.gog-btn:active:not(:disabled){transform:none}}.gog-btn:disabled{opacity:.4;cursor:not-allowed}.gog-btn--primary{--gog-btn-bg: var(--accent-color);--gog-btn-color: var(--primary-color);--gog-btn-hover-bg: var(--accent-bright);--gog-btn-hover-shadow: 0 0 16px color-mix(in srgb, var(--accent-bright) 45%, transparent)}.gog-btn--secondary{--gog-btn-bg: var(--secondary-color);--gog-btn-color: var(--primary-color);--gog-btn-hover-bg: var(--accent-color);--gog-btn-hover-shadow: none}.gog-btn--outline{--gog-btn-bg: transparent;--gog-btn-color: var(--accent-color);--gog-btn-border: var(--accent-color);--gog-btn-hover-bg: var(--accent-color);--gog-btn-hover-shadow: none;--gog-spinner-color: var(--accent-color)}.gog-btn--outline:hover:not(:disabled){color:var(--primary-color)}.gog-btn--ghost{--gog-btn-bg: transparent;--gog-btn-color: var(--accent-color);--gog-btn-hover-bg: color-mix(in srgb, var(--accent-color) 12%, transparent);--gog-btn-hover-shadow: none;--gog-spinner-color: var(--accent-color)}.gog-btn--sm{--gog-btn-padding: var(--btn-sm-padding);--gog-btn-font-size: var(--btn-sm-font-size)}.gog-btn--lg{--gog-btn-padding: var(--btn-lg-padding);--gog-btn-font-size: var(--btn-lg-font-size)}:host(.gog-host--full-width){display:flex}:host(.gog-host--full-width) .gog-btn{width:100%}.gog-btn--loading{position:relative;pointer-events:none}.gog-btn__content--hidden{visibility:hidden}.gog-btn__spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);max-width:70%;max-height:70%}\n"] }]
|
|
52
|
+
}], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], fullWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "fullWidth", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], debounce: [{ type: i0.Input, args: [{ isSignal: true, alias: "debounce", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], gogClick: [{ type: i0.Output, args: ["gogClick"] }] } });
|
|
53
|
+
|
|
54
|
+
class GogAccordionContentDirective {
|
|
55
|
+
templateRef = inject(TemplateRef);
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
57
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: GogAccordionContentDirective, isStandalone: true, selector: "[gogAccordionContent]", ngImport: i0 });
|
|
58
|
+
}
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionContentDirective, decorators: [{
|
|
60
|
+
type: Directive,
|
|
61
|
+
args: [{
|
|
62
|
+
selector: '[gogAccordionContent]',
|
|
63
|
+
}]
|
|
64
|
+
}] });
|
|
65
|
+
class GogAccordionHeaderDirective {
|
|
66
|
+
templateRef = inject(TemplateRef);
|
|
67
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
68
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: GogAccordionHeaderDirective, isStandalone: true, selector: "[gogAccordionHeader]", ngImport: i0 });
|
|
69
|
+
}
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionHeaderDirective, decorators: [{
|
|
71
|
+
type: Directive,
|
|
72
|
+
args: [{
|
|
73
|
+
selector: '[gogAccordionHeader]',
|
|
74
|
+
}]
|
|
75
|
+
}] });
|
|
76
|
+
class GogAccordionChevronDirective {
|
|
77
|
+
templateRef = inject(TemplateRef);
|
|
78
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionChevronDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
79
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.17", type: GogAccordionChevronDirective, isStandalone: true, selector: "[gogAccordionChevron]", ngImport: i0 });
|
|
80
|
+
}
|
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogAccordionChevronDirective, decorators: [{
|
|
82
|
+
type: Directive,
|
|
83
|
+
args: [{
|
|
84
|
+
selector: '[gogAccordionChevron]',
|
|
85
|
+
}]
|
|
86
|
+
}] });
|
|
87
|
+
class AccordionComponent {
|
|
88
|
+
host = inject((ElementRef));
|
|
89
|
+
items = input([], ...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
90
|
+
size = input('lg', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
91
|
+
expandFirst = input(false, ...(ngDevMode ? [{ debugName: "expandFirst" }] : /* istanbul ignore next */ []));
|
|
92
|
+
multi = input(false, ...(ngDevMode ? [{ debugName: "multi" }] : /* istanbul ignore next */ []));
|
|
93
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
94
|
+
showChevron = input(true, ...(ngDevMode ? [{ debugName: "showChevron" }] : /* istanbul ignore next */ []));
|
|
95
|
+
gogToggle = output();
|
|
96
|
+
headerTpl = contentChild(GogAccordionHeaderDirective, ...(ngDevMode ? [{ debugName: "headerTpl" }] : /* istanbul ignore next */ []));
|
|
97
|
+
chevronTpl = contentChild(GogAccordionChevronDirective, ...(ngDevMode ? [{ debugName: "chevronTpl" }] : /* istanbul ignore next */ []));
|
|
98
|
+
contentTpl = contentChild(GogAccordionContentDirective, ...(ngDevMode ? [{ debugName: "contentTpl" }] : /* istanbul ignore next */ []));
|
|
99
|
+
openIds = signal(new Set(), ...(ngDevMode ? [{ debugName: "openIds" }] : /* istanbul ignore next */ []));
|
|
100
|
+
constructor() {
|
|
101
|
+
effect(() => {
|
|
102
|
+
const items = this.items();
|
|
103
|
+
if (!this.expandFirst() || items.length === 0 || this.openIds().size > 0) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.openIds.set(new Set([items[0].id]));
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
isOpen(id) {
|
|
110
|
+
return this.openIds().has(id);
|
|
111
|
+
}
|
|
112
|
+
toggle(item) {
|
|
113
|
+
const id = item.id;
|
|
114
|
+
const current = this.openIds();
|
|
115
|
+
const next = new Set(current);
|
|
116
|
+
if (next.has(id)) {
|
|
117
|
+
next.delete(id);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
if (!this.multi())
|
|
121
|
+
next.clear();
|
|
122
|
+
next.add(id);
|
|
123
|
+
}
|
|
124
|
+
this.openIds.set(next);
|
|
125
|
+
this.gogToggle.emit({ item, open: next.has(id) });
|
|
126
|
+
}
|
|
127
|
+
onHeaderKeydown(event, index) {
|
|
128
|
+
const keys = ['ArrowDown', 'ArrowUp', 'Home', 'End'];
|
|
129
|
+
if (!keys.includes(event.key)) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
const host = this.host.nativeElement;
|
|
133
|
+
const headers = Array.from(host.querySelectorAll('.gog-accordion__header'));
|
|
134
|
+
if (headers.length === 0) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
event.preventDefault();
|
|
138
|
+
const lastIndex = headers.length - 1;
|
|
139
|
+
const nextIndex = event.key === 'Home'
|
|
140
|
+
? 0
|
|
141
|
+
: event.key === 'End'
|
|
142
|
+
? lastIndex
|
|
143
|
+
: event.key === 'ArrowDown'
|
|
144
|
+
? (index + 1) % headers.length
|
|
145
|
+
: (index - 1 + headers.length) % headers.length;
|
|
146
|
+
headers[nextIndex]?.focus();
|
|
147
|
+
}
|
|
148
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AccordionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
149
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: AccordionComponent, isStandalone: true, selector: "gog-accordion", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, expandFirst: { classPropertyName: "expandFirst", publicName: "expandFirst", isSignal: true, isRequired: false, transformFunction: null }, multi: { classPropertyName: "multi", publicName: "multi", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, showChevron: { classPropertyName: "showChevron", publicName: "showChevron", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gogToggle: "gogToggle" }, host: { classAttribute: "gog-accordion-host" }, queries: [{ propertyName: "headerTpl", first: true, predicate: GogAccordionHeaderDirective, descendants: true, isSignal: true }, { propertyName: "chevronTpl", first: true, predicate: GogAccordionChevronDirective, descendants: true, isSignal: true }, { propertyName: "contentTpl", first: true, predicate: GogAccordionContentDirective, descendants: true, isSignal: true }], ngImport: i0, template: "<div\r\n class=\"gog-accordion gog-contained-layout\"\r\n [class.gog-accordion--md]=\"size() === 'md'\"\r\n [class.gog-accordion--sm]=\"size() === 'sm'\"\r\n [class.gog-accordion--loading]=\"loading()\"\r\n>\r\n @if (loading()) {\r\n @for (item of items(); track item.id) {\r\n <div class=\"gog-accordion__item gog-accordion__item--skeleton\">\r\n <div class=\"gog-accordion__header gog-accordion__header--skeleton\">\r\n <span class=\"gog-accordion__skeleton-line\"></span>\r\n </div>\r\n </div>\r\n }\r\n } @else {\r\n @for (item of items(); track item.id) {\r\n <div class=\"gog-accordion__item\" [class.gog-accordion__item--open]=\"isOpen(item.id)\">\r\n <button\r\n [id]=\"'gog-acc-btn-' + item.id\"\r\n class=\"gog-accordion__header font-heading\"\r\n [class.gog-accordion__header--chevronless]=\"!showChevron()\"\r\n [class.gog-accordion__header--open]=\"isOpen(item.id)\"\r\n [attr.aria-expanded]=\"isOpen(item.id)\"\r\n [attr.aria-controls]=\"'gog-acc-body-' + item.id\"\r\n (click)=\"toggle(item)\"\r\n (keydown)=\"onHeaderKeydown($event, $index)\"\r\n type=\"button\"\r\n >\r\n <span class=\"gog-accordion__header-content\">\r\n @if (headerTpl(); as tpl) {\r\n <ng-container\r\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item, open: isOpen(item.id) }\"\r\n />\r\n } @else {\r\n <span class=\"gog-accordion__title\">{{ item.title }}</span>\r\n }\r\n </span>\r\n @if (showChevron()) {\r\n <span class=\"gog-accordion__chevron\" aria-hidden=\"true\">\r\n @if (chevronTpl(); as tpl) {\r\n <ng-container\r\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item, open: isOpen(item.id) }\"\r\n />\r\n } @else {\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n >\r\n <polyline points=\"6 9 12 15 18 9\"></polyline>\r\n </svg>\r\n }\r\n </span>\r\n }\r\n </button>\r\n\r\n <div\r\n [id]=\"'gog-acc-body-' + item.id\"\r\n class=\"gog-accordion__body font-body\"\r\n [class.gog-accordion__body--open]=\"isOpen(item.id)\"\r\n role=\"region\"\r\n [attr.aria-labelledby]=\"'gog-acc-btn-' + item.id\"\r\n [attr.aria-hidden]=\"!isOpen(item.id)\"\r\n [attr.inert]=\"!isOpen(item.id) ? '' : null\"\r\n >\r\n <div class=\"gog-accordion__body-inner\">\r\n @if (contentTpl(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item }\" />\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".gog-accordion{--gog-accordion-border-color: var(--accent-dim);--gog-accordion-text-color: var(--text-color);--gog-accordion-accent-color: var(--accent-color);--gog-accordion-hover-bg: color-mix(in srgb, var(--accent-dim) 10%, transparent);--gog-accordion-hover-ring: color-mix(in srgb, var(--accent-color) 30%, transparent);--gog-accordion-body-color: var(--text-color);--gog-accordion-skeleton-start: var(--accent-dim);--gog-accordion-skeleton-mid: color-mix(in srgb, var(--accent-dim) 50%, transparent);--gog-accordion-skeleton-end: var(--accent-dim);--gog-accordion-radius: var(--radius);--gog-accordion-body-radius: var(--radius);--gog-accordion-body-padding-y: 12px;--gog-accordion-body-padding-x: 16px;--gog-accordion-body-radius-skeleton: 2px;display:flex;flex-direction:column;width:100%}.gog-accordion__item{border-bottom:var(--control-border-width, 1px) var(--control-border-style, solid) var(--gog-accordion-border-color)}.gog-accordion__item:first-child{border-top:var(--control-border-width, 1px) var(--control-border-style, solid) var(--gog-accordion-border-color)}.gog-accordion__header{display:flex;align-items:center;justify-content:space-between;width:100%;padding:14px var(--gog-accordion-body-padding-x);gap:12px;background:transparent;border:none;color:var(--gog-accordion-text-color);text-align:left;cursor:pointer;text-transform:uppercase;letter-spacing:.8px;font-size:var(--text-sm);transition:color .15s ease,background-color .15s ease}.gog-accordion__header:hover{color:var(--gog-accordion-accent-color);background-color:var(--gog-accordion-hover-bg)}.gog-accordion__header:focus-visible{outline:3px solid var(--gog-accordion-hover-ring);outline-offset:-3px}.gog-accordion__header--open{color:var(--gog-accordion-accent-color)}.gog-accordion__title{flex:1}.gog-accordion__header-content{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}.gog-accordion__chevron{flex-shrink:0;width:16px;height:16px;color:var(--gog-accordion-border-color);transition:transform .2s ease,color .15s ease}.gog-accordion__chevron svg{width:100%;height:100%;display:block}.gog-accordion__header--open .gog-accordion__chevron{transform:rotate(180deg);color:var(--gog-accordion-accent-color)}.gog-accordion__body{display:grid;grid-template-rows:0fr;opacity:0;overflow:hidden;border-top:var(--control-border-width, 1px) var(--control-border-style, solid) var(--accent-dim);transition:grid-template-rows .2s ease,opacity .18s ease}.gog-accordion__body--open{grid-template-rows:1fr;opacity:1}.gog-accordion__body-inner{min-height:0;overflow:hidden;padding:0 var(--gog-accordion-body-padding-x);color:var(--gog-accordion-body-color);font-size:var(--text-md);line-height:1.6;transform:translateY(-2px);transition:transform .18s ease,padding .2s ease}.gog-accordion__body--open .gog-accordion__body-inner{padding-top:var(--gog-accordion-body-padding-y);padding-bottom:calc(var(--gog-accordion-body-padding-y) + 4px);transform:translateY(0)}.gog-accordion--md .gog-accordion__header{padding:10px 14px;font-size:var(--text-xs)}.gog-accordion--md .gog-accordion__header-content{gap:2px}.gog-accordion--md .gog-accordion__body-inner{padding-left:14px;padding-right:14px;font-size:var(--text-sm)}.gog-accordion--md .gog-accordion__body--open .gog-accordion__body-inner{padding-top:8px;padding-bottom:12px}.gog-accordion--md .gog-accordion__chevron{width:14px;height:14px}.gog-accordion--sm .gog-accordion__header{padding:6px 10px;font-size:var(--text-xs);letter-spacing:.4px}.gog-accordion--sm .gog-accordion__header-content{gap:2px}.gog-accordion--sm .gog-accordion__body-inner{padding-left:10px;padding-right:10px;font-size:var(--text-xs);line-height:1.5}.gog-accordion--sm .gog-accordion__body--open .gog-accordion__body-inner{padding-top:6px;padding-bottom:8px}.gog-accordion--sm .gog-accordion__chevron{width:12px;height:12px}.gog-accordion__header--skeleton{cursor:default;pointer-events:none}.gog-accordion__skeleton-line{display:block;height:12px;width:55%;border-radius:var(--gog-accordion-body-radius-skeleton);background:linear-gradient(90deg,var(--gog-accordion-skeleton-start) 25%,var(--gog-accordion-skeleton-mid) 50%,var(--gog-accordion-skeleton-end) 75%);background-size:200% 100%;animation:gog-accordion-shimmer 1.4s infinite}@keyframes gog-accordion-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.gog-accordion__header,.gog-accordion__chevron,.gog-accordion__body,.gog-accordion__body-inner{transition:none}.gog-accordion__skeleton-line{animation:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
150
|
+
}
|
|
151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: AccordionComponent, decorators: [{
|
|
152
|
+
type: Component,
|
|
153
|
+
args: [{ selector: 'gog-accordion', imports: [NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
154
|
+
class: 'gog-accordion-host',
|
|
155
|
+
}, template: "<div\r\n class=\"gog-accordion gog-contained-layout\"\r\n [class.gog-accordion--md]=\"size() === 'md'\"\r\n [class.gog-accordion--sm]=\"size() === 'sm'\"\r\n [class.gog-accordion--loading]=\"loading()\"\r\n>\r\n @if (loading()) {\r\n @for (item of items(); track item.id) {\r\n <div class=\"gog-accordion__item gog-accordion__item--skeleton\">\r\n <div class=\"gog-accordion__header gog-accordion__header--skeleton\">\r\n <span class=\"gog-accordion__skeleton-line\"></span>\r\n </div>\r\n </div>\r\n }\r\n } @else {\r\n @for (item of items(); track item.id) {\r\n <div class=\"gog-accordion__item\" [class.gog-accordion__item--open]=\"isOpen(item.id)\">\r\n <button\r\n [id]=\"'gog-acc-btn-' + item.id\"\r\n class=\"gog-accordion__header font-heading\"\r\n [class.gog-accordion__header--chevronless]=\"!showChevron()\"\r\n [class.gog-accordion__header--open]=\"isOpen(item.id)\"\r\n [attr.aria-expanded]=\"isOpen(item.id)\"\r\n [attr.aria-controls]=\"'gog-acc-body-' + item.id\"\r\n (click)=\"toggle(item)\"\r\n (keydown)=\"onHeaderKeydown($event, $index)\"\r\n type=\"button\"\r\n >\r\n <span class=\"gog-accordion__header-content\">\r\n @if (headerTpl(); as tpl) {\r\n <ng-container\r\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item, open: isOpen(item.id) }\"\r\n />\r\n } @else {\r\n <span class=\"gog-accordion__title\">{{ item.title }}</span>\r\n }\r\n </span>\r\n @if (showChevron()) {\r\n <span class=\"gog-accordion__chevron\" aria-hidden=\"true\">\r\n @if (chevronTpl(); as tpl) {\r\n <ng-container\r\n *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item, open: isOpen(item.id) }\"\r\n />\r\n } @else {\r\n <svg\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2.5\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n >\r\n <polyline points=\"6 9 12 15 18 9\"></polyline>\r\n </svg>\r\n }\r\n </span>\r\n }\r\n </button>\r\n\r\n <div\r\n [id]=\"'gog-acc-body-' + item.id\"\r\n class=\"gog-accordion__body font-body\"\r\n [class.gog-accordion__body--open]=\"isOpen(item.id)\"\r\n role=\"region\"\r\n [attr.aria-labelledby]=\"'gog-acc-btn-' + item.id\"\r\n [attr.aria-hidden]=\"!isOpen(item.id)\"\r\n [attr.inert]=\"!isOpen(item.id) ? '' : null\"\r\n >\r\n <div class=\"gog-accordion__body-inner\">\r\n @if (contentTpl(); as tpl) {\r\n <ng-container *ngTemplateOutlet=\"tpl.templateRef; context: { $implicit: item }\" />\r\n }\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".gog-accordion{--gog-accordion-border-color: var(--accent-dim);--gog-accordion-text-color: var(--text-color);--gog-accordion-accent-color: var(--accent-color);--gog-accordion-hover-bg: color-mix(in srgb, var(--accent-dim) 10%, transparent);--gog-accordion-hover-ring: color-mix(in srgb, var(--accent-color) 30%, transparent);--gog-accordion-body-color: var(--text-color);--gog-accordion-skeleton-start: var(--accent-dim);--gog-accordion-skeleton-mid: color-mix(in srgb, var(--accent-dim) 50%, transparent);--gog-accordion-skeleton-end: var(--accent-dim);--gog-accordion-radius: var(--radius);--gog-accordion-body-radius: var(--radius);--gog-accordion-body-padding-y: 12px;--gog-accordion-body-padding-x: 16px;--gog-accordion-body-radius-skeleton: 2px;display:flex;flex-direction:column;width:100%}.gog-accordion__item{border-bottom:var(--control-border-width, 1px) var(--control-border-style, solid) var(--gog-accordion-border-color)}.gog-accordion__item:first-child{border-top:var(--control-border-width, 1px) var(--control-border-style, solid) var(--gog-accordion-border-color)}.gog-accordion__header{display:flex;align-items:center;justify-content:space-between;width:100%;padding:14px var(--gog-accordion-body-padding-x);gap:12px;background:transparent;border:none;color:var(--gog-accordion-text-color);text-align:left;cursor:pointer;text-transform:uppercase;letter-spacing:.8px;font-size:var(--text-sm);transition:color .15s ease,background-color .15s ease}.gog-accordion__header:hover{color:var(--gog-accordion-accent-color);background-color:var(--gog-accordion-hover-bg)}.gog-accordion__header:focus-visible{outline:3px solid var(--gog-accordion-hover-ring);outline-offset:-3px}.gog-accordion__header--open{color:var(--gog-accordion-accent-color)}.gog-accordion__title{flex:1}.gog-accordion__header-content{flex:1;display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0}.gog-accordion__chevron{flex-shrink:0;width:16px;height:16px;color:var(--gog-accordion-border-color);transition:transform .2s ease,color .15s ease}.gog-accordion__chevron svg{width:100%;height:100%;display:block}.gog-accordion__header--open .gog-accordion__chevron{transform:rotate(180deg);color:var(--gog-accordion-accent-color)}.gog-accordion__body{display:grid;grid-template-rows:0fr;opacity:0;overflow:hidden;border-top:var(--control-border-width, 1px) var(--control-border-style, solid) var(--accent-dim);transition:grid-template-rows .2s ease,opacity .18s ease}.gog-accordion__body--open{grid-template-rows:1fr;opacity:1}.gog-accordion__body-inner{min-height:0;overflow:hidden;padding:0 var(--gog-accordion-body-padding-x);color:var(--gog-accordion-body-color);font-size:var(--text-md);line-height:1.6;transform:translateY(-2px);transition:transform .18s ease,padding .2s ease}.gog-accordion__body--open .gog-accordion__body-inner{padding-top:var(--gog-accordion-body-padding-y);padding-bottom:calc(var(--gog-accordion-body-padding-y) + 4px);transform:translateY(0)}.gog-accordion--md .gog-accordion__header{padding:10px 14px;font-size:var(--text-xs)}.gog-accordion--md .gog-accordion__header-content{gap:2px}.gog-accordion--md .gog-accordion__body-inner{padding-left:14px;padding-right:14px;font-size:var(--text-sm)}.gog-accordion--md .gog-accordion__body--open .gog-accordion__body-inner{padding-top:8px;padding-bottom:12px}.gog-accordion--md .gog-accordion__chevron{width:14px;height:14px}.gog-accordion--sm .gog-accordion__header{padding:6px 10px;font-size:var(--text-xs);letter-spacing:.4px}.gog-accordion--sm .gog-accordion__header-content{gap:2px}.gog-accordion--sm .gog-accordion__body-inner{padding-left:10px;padding-right:10px;font-size:var(--text-xs);line-height:1.5}.gog-accordion--sm .gog-accordion__body--open .gog-accordion__body-inner{padding-top:6px;padding-bottom:8px}.gog-accordion--sm .gog-accordion__chevron{width:12px;height:12px}.gog-accordion__header--skeleton{cursor:default;pointer-events:none}.gog-accordion__skeleton-line{display:block;height:12px;width:55%;border-radius:var(--gog-accordion-body-radius-skeleton);background:linear-gradient(90deg,var(--gog-accordion-skeleton-start) 25%,var(--gog-accordion-skeleton-mid) 50%,var(--gog-accordion-skeleton-end) 75%);background-size:200% 100%;animation:gog-accordion-shimmer 1.4s infinite}@keyframes gog-accordion-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.gog-accordion__header,.gog-accordion__chevron,.gog-accordion__body,.gog-accordion__body-inner{transition:none}.gog-accordion__skeleton-line{animation:none}}\n"] }]
|
|
156
|
+
}], ctorParameters: () => [], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], expandFirst: [{ type: i0.Input, args: [{ isSignal: true, alias: "expandFirst", required: false }] }], multi: [{ type: i0.Input, args: [{ isSignal: true, alias: "multi", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], showChevron: [{ type: i0.Input, args: [{ isSignal: true, alias: "showChevron", required: false }] }], gogToggle: [{ type: i0.Output, args: ["gogToggle"] }], headerTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => GogAccordionHeaderDirective), { isSignal: true }] }], chevronTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => GogAccordionChevronDirective), { isSignal: true }] }], contentTpl: [{ type: i0.ContentChild, args: [i0.forwardRef(() => GogAccordionContentDirective), { isSignal: true }] }] } });
|
|
157
|
+
|
|
158
|
+
class IconComponent {
|
|
159
|
+
name = input('close', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
160
|
+
template = input(null, ...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
161
|
+
title = input('', ...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
162
|
+
ariaHidden = input(true, ...(ngDevMode ? [{ debugName: "ariaHidden" }] : /* istanbul ignore next */ []));
|
|
163
|
+
ariaLabel = computed(() => (this.ariaHidden() ? null : this.title() || this.name()), ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
164
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: IconComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
165
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: IconComponent, isStandalone: true, selector: "gog-icon", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, ariaHidden: { classPropertyName: "ariaHidden", publicName: "ariaHidden", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-hidden": "ariaHidden() ? \"true\" : null", "attr.aria-label": "ariaHidden() ? null : ariaLabel()" }, classAttribute: "gog-icon" }, ngImport: i0, template: `
|
|
166
|
+
@if (template(); as iconTpl) {
|
|
167
|
+
<ng-container *ngTemplateOutlet="iconTpl" />
|
|
168
|
+
} @else {
|
|
169
|
+
<svg
|
|
170
|
+
class="gog-icon__svg"
|
|
171
|
+
viewBox="0 0 16 16"
|
|
172
|
+
fill="none"
|
|
173
|
+
aria-hidden="true"
|
|
174
|
+
focusable="false"
|
|
175
|
+
>
|
|
176
|
+
@switch (name()) {
|
|
177
|
+
@case ('check') {
|
|
178
|
+
<path
|
|
179
|
+
d="M3 8.5L6.5 12L13 4"
|
|
180
|
+
stroke="currentColor"
|
|
181
|
+
stroke-width="2"
|
|
182
|
+
stroke-linecap="round"
|
|
183
|
+
stroke-linejoin="round"
|
|
184
|
+
/>
|
|
185
|
+
}
|
|
186
|
+
@case ('close') {
|
|
187
|
+
<path
|
|
188
|
+
d="M4 4L12 12M12 4L4 12"
|
|
189
|
+
stroke="currentColor"
|
|
190
|
+
stroke-width="2"
|
|
191
|
+
stroke-linecap="round"
|
|
192
|
+
/>
|
|
193
|
+
}
|
|
194
|
+
@case ('chevron-up') {
|
|
195
|
+
<path
|
|
196
|
+
d="M4 10L8 6L12 10"
|
|
197
|
+
stroke="currentColor"
|
|
198
|
+
stroke-width="2"
|
|
199
|
+
stroke-linecap="round"
|
|
200
|
+
stroke-linejoin="round"
|
|
201
|
+
/>
|
|
202
|
+
}
|
|
203
|
+
@case ('chevron-down') {
|
|
204
|
+
<path
|
|
205
|
+
d="M4 6L8 10L12 6"
|
|
206
|
+
stroke="currentColor"
|
|
207
|
+
stroke-width="2"
|
|
208
|
+
stroke-linecap="round"
|
|
209
|
+
stroke-linejoin="round"
|
|
210
|
+
/>
|
|
211
|
+
}
|
|
212
|
+
@case ('sort-up') {
|
|
213
|
+
<path d="M8 3L4.5 6.5H11.5L8 3Z" fill="currentColor" />
|
|
214
|
+
}
|
|
215
|
+
@case ('sort-down') {
|
|
216
|
+
<path d="M8 13L11.5 9.5H4.5L8 13Z" fill="currentColor" />
|
|
217
|
+
}
|
|
218
|
+
@case ('sort') {
|
|
219
|
+
<path d="M5 5.5H11M5 8H11M5 10.5H11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
220
|
+
}
|
|
221
|
+
@case ('success') {
|
|
222
|
+
<path
|
|
223
|
+
d="M3 8.5L6.2 11.7L13 4.9"
|
|
224
|
+
stroke="currentColor"
|
|
225
|
+
stroke-width="1.8"
|
|
226
|
+
stroke-linecap="round"
|
|
227
|
+
stroke-linejoin="round"
|
|
228
|
+
/>
|
|
229
|
+
}
|
|
230
|
+
@case ('error') {
|
|
231
|
+
<path d="M4 4L12 12M12 4L4 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
|
|
232
|
+
}
|
|
233
|
+
@case ('warning') {
|
|
234
|
+
<path d="M8 3L14 13H2L8 3Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" />
|
|
235
|
+
<path d="M8 6V9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
236
|
+
<circle cx="8" cy="11.5" r="0.75" fill="currentColor" />
|
|
237
|
+
}
|
|
238
|
+
@case ('info') {
|
|
239
|
+
<circle cx="8" cy="8" r="5.5" stroke="currentColor" stroke-width="1.5" />
|
|
240
|
+
<path d="M8 7V11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
241
|
+
<circle cx="8" cy="5.25" r="0.75" fill="currentColor" />
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
</svg>
|
|
245
|
+
}
|
|
246
|
+
`, isInline: true, styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:0}.gog-icon__svg{width:var(--gog-icon-size, 1em);height:var(--gog-icon-size, 1em);display:block;color:currentColor}.gog-icon__svg path,.gog-icon__svg circle{stroke-width:var(--gog-icon-stroke-width, 2)}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
247
|
+
}
|
|
248
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: IconComponent, decorators: [{
|
|
249
|
+
type: Component,
|
|
250
|
+
args: [{ selector: 'gog-icon', imports: [NgTemplateOutlet], template: `
|
|
251
|
+
@if (template(); as iconTpl) {
|
|
252
|
+
<ng-container *ngTemplateOutlet="iconTpl" />
|
|
253
|
+
} @else {
|
|
254
|
+
<svg
|
|
255
|
+
class="gog-icon__svg"
|
|
256
|
+
viewBox="0 0 16 16"
|
|
257
|
+
fill="none"
|
|
258
|
+
aria-hidden="true"
|
|
259
|
+
focusable="false"
|
|
260
|
+
>
|
|
261
|
+
@switch (name()) {
|
|
262
|
+
@case ('check') {
|
|
263
|
+
<path
|
|
264
|
+
d="M3 8.5L6.5 12L13 4"
|
|
265
|
+
stroke="currentColor"
|
|
266
|
+
stroke-width="2"
|
|
267
|
+
stroke-linecap="round"
|
|
268
|
+
stroke-linejoin="round"
|
|
269
|
+
/>
|
|
270
|
+
}
|
|
271
|
+
@case ('close') {
|
|
272
|
+
<path
|
|
273
|
+
d="M4 4L12 12M12 4L4 12"
|
|
274
|
+
stroke="currentColor"
|
|
275
|
+
stroke-width="2"
|
|
276
|
+
stroke-linecap="round"
|
|
277
|
+
/>
|
|
278
|
+
}
|
|
279
|
+
@case ('chevron-up') {
|
|
280
|
+
<path
|
|
281
|
+
d="M4 10L8 6L12 10"
|
|
282
|
+
stroke="currentColor"
|
|
283
|
+
stroke-width="2"
|
|
284
|
+
stroke-linecap="round"
|
|
285
|
+
stroke-linejoin="round"
|
|
286
|
+
/>
|
|
287
|
+
}
|
|
288
|
+
@case ('chevron-down') {
|
|
289
|
+
<path
|
|
290
|
+
d="M4 6L8 10L12 6"
|
|
291
|
+
stroke="currentColor"
|
|
292
|
+
stroke-width="2"
|
|
293
|
+
stroke-linecap="round"
|
|
294
|
+
stroke-linejoin="round"
|
|
295
|
+
/>
|
|
296
|
+
}
|
|
297
|
+
@case ('sort-up') {
|
|
298
|
+
<path d="M8 3L4.5 6.5H11.5L8 3Z" fill="currentColor" />
|
|
299
|
+
}
|
|
300
|
+
@case ('sort-down') {
|
|
301
|
+
<path d="M8 13L11.5 9.5H4.5L8 13Z" fill="currentColor" />
|
|
302
|
+
}
|
|
303
|
+
@case ('sort') {
|
|
304
|
+
<path d="M5 5.5H11M5 8H11M5 10.5H11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
305
|
+
}
|
|
306
|
+
@case ('success') {
|
|
307
|
+
<path
|
|
308
|
+
d="M3 8.5L6.2 11.7L13 4.9"
|
|
309
|
+
stroke="currentColor"
|
|
310
|
+
stroke-width="1.8"
|
|
311
|
+
stroke-linecap="round"
|
|
312
|
+
stroke-linejoin="round"
|
|
313
|
+
/>
|
|
314
|
+
}
|
|
315
|
+
@case ('error') {
|
|
316
|
+
<path d="M4 4L12 12M12 4L4 12" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" />
|
|
317
|
+
}
|
|
318
|
+
@case ('warning') {
|
|
319
|
+
<path d="M8 3L14 13H2L8 3Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" />
|
|
320
|
+
<path d="M8 6V9" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
321
|
+
<circle cx="8" cy="11.5" r="0.75" fill="currentColor" />
|
|
322
|
+
}
|
|
323
|
+
@case ('info') {
|
|
324
|
+
<circle cx="8" cy="8" r="5.5" stroke="currentColor" stroke-width="1.5" />
|
|
325
|
+
<path d="M8 7V11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" />
|
|
326
|
+
<circle cx="8" cy="5.25" r="0.75" fill="currentColor" />
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
</svg>
|
|
330
|
+
}
|
|
331
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
332
|
+
class: 'gog-icon',
|
|
333
|
+
'[attr.aria-hidden]': 'ariaHidden() ? "true" : null',
|
|
334
|
+
'[attr.aria-label]': 'ariaHidden() ? null : ariaLabel()',
|
|
335
|
+
}, styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:0}.gog-icon__svg{width:var(--gog-icon-size, 1em);height:var(--gog-icon-size, 1em);display:block;color:currentColor}.gog-icon__svg path,.gog-icon__svg circle{stroke-width:var(--gog-icon-stroke-width, 2)}\n"] }]
|
|
336
|
+
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: false }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: false }] }], ariaHidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaHidden", required: false }] }] } });
|
|
337
|
+
|
|
338
|
+
const GOG_CHECKABLE_CONTROL_PADDING = 'var(--control-checkbox-padding, 6px)';
|
|
339
|
+
const GOG_CHECKABLE_CONTROL_SIZE_MAP = {
|
|
340
|
+
sm: {
|
|
341
|
+
boxSize: 'var(--control-checkbox-box-size-sm, 18px)',
|
|
342
|
+
labelSize: 'var(--control-checkbox-label-size-sm, 0.8125rem)',
|
|
343
|
+
indicatorSize: 'var(--control-checkbox-icon-size-sm, 12px)',
|
|
344
|
+
},
|
|
345
|
+
md: {
|
|
346
|
+
boxSize: 'var(--control-checkbox-box-size-md, 24px)',
|
|
347
|
+
labelSize: 'var(--control-checkbox-label-size-md, 0.9375rem)',
|
|
348
|
+
indicatorSize: 'var(--control-checkbox-icon-size-md, 14px)',
|
|
349
|
+
},
|
|
350
|
+
lg: {
|
|
351
|
+
boxSize: 'var(--control-checkbox-box-size-lg, 32px)',
|
|
352
|
+
labelSize: 'var(--control-checkbox-label-size-lg, 1.0625rem)',
|
|
353
|
+
indicatorSize: 'var(--control-checkbox-icon-size-lg, 18px)',
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
class CheckboxComponent {
|
|
358
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
359
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
360
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
361
|
+
indeterminate = input(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
362
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
363
|
+
checkIconTemplate = input(null, ...(ngDevMode ? [{ debugName: "checkIconTemplate" }] : /* istanbul ignore next */ []));
|
|
364
|
+
/** Two-way bindable checked state: `[(checked)]="signal"`. */
|
|
365
|
+
checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
366
|
+
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
367
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
368
|
+
controlSize = computed(() => GOG_CHECKABLE_CONTROL_SIZE_MAP[this.size()], ...(ngDevMode ? [{ debugName: "controlSize" }] : /* istanbul ignore next */ []));
|
|
369
|
+
boxSize = computed(() => this.controlSize().boxSize, ...(ngDevMode ? [{ debugName: "boxSize" }] : /* istanbul ignore next */ []));
|
|
370
|
+
checkboxPadding = GOG_CHECKABLE_CONTROL_PADDING;
|
|
371
|
+
labelSize = computed(() => this.controlSize().labelSize, ...(ngDevMode ? [{ debugName: "labelSize" }] : /* istanbul ignore next */ []));
|
|
372
|
+
iconSize = computed(() => this.controlSize().indicatorSize, ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
|
|
373
|
+
onCheckedChange = () => { };
|
|
374
|
+
onTouched = () => { };
|
|
375
|
+
writeValue(val) {
|
|
376
|
+
this.checked.set(val ?? false);
|
|
377
|
+
}
|
|
378
|
+
registerOnChange(fn) {
|
|
379
|
+
this.onCheckedChange = fn;
|
|
380
|
+
}
|
|
381
|
+
registerOnTouched(fn) {
|
|
382
|
+
this.onTouched = fn;
|
|
383
|
+
}
|
|
384
|
+
setDisabledState(isDisabled) {
|
|
385
|
+
this.cvaDisabled.set(isDisabled);
|
|
386
|
+
}
|
|
387
|
+
onInputChange(event) {
|
|
388
|
+
if (this.isDisabled())
|
|
389
|
+
return;
|
|
390
|
+
const input = event.target;
|
|
391
|
+
const next = input.checked;
|
|
392
|
+
this.checked.set(next);
|
|
393
|
+
this.onCheckedChange(next);
|
|
394
|
+
this.onTouched();
|
|
395
|
+
}
|
|
396
|
+
onBlur() {
|
|
397
|
+
if (this.isDisabled())
|
|
398
|
+
return;
|
|
399
|
+
this.onTouched();
|
|
400
|
+
}
|
|
401
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: CheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
402
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: CheckboxComponent, isStandalone: true, selector: "gog-checkbox", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, checkIconTemplate: { classPropertyName: "checkIconTemplate", publicName: "checkIconTemplate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { properties: { "style.--gog-checkbox-box-size": "boxSize()", "style.--gog-checkbox-label-size": "labelSize()", "style.--gog-checkbox-icon-size": "iconSize()", "style.--gog-checkbox-padding": "checkboxPadding" } }, providers: [
|
|
403
|
+
{
|
|
404
|
+
provide: NG_VALUE_ACCESSOR,
|
|
405
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
406
|
+
multi: true,
|
|
407
|
+
},
|
|
408
|
+
], ngImport: i0, template: "<label class=\"gog-checkbox gog-contained-layout\" [class.gog-checkbox--disabled]=\"isDisabled()\">\n <input\n class=\"gog-checkbox__input\"\n type=\"checkbox\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n />\n\n <span\n class=\"gog-checkbox__box\"\n [class.gog-checkbox__box--checked]=\"checked()\"\n [class.gog-checkbox__box--indeterminate]=\"indeterminate()\"\n >\n @if (checked()) {\n <gog-icon [template]=\"checkIconTemplate()\" name=\"check\" />\n } @else if (indeterminate()) {\n <span class=\"gog-checkbox__dash\" aria-hidden=\"true\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"gog-checkbox__label font-body\">{{ label() }}</span>\n }\n</label>\n", styles: [".gog-checkbox{--gog-checkbox-gap: 10px;--gog-checkbox-border-color: var(--accent-dim);--gog-checkbox-bg: var(--surface-color);--gog-checkbox-checked-bg: var(--accent-color);--gog-checkbox-checked-border: var(--accent-color);--gog-checkbox-icon-color: var(--primary-color);--gog-checkbox-label-color: var(--muted-text-color);--gog-checkbox-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-checkbox-disabled-opacity: .4;display:inline-flex;align-items:center;gap:var(--gog-checkbox-gap);padding:var(--gog-checkbox-padding);position:relative;cursor:pointer;-webkit-user-select:none;user-select:none}.gog-checkbox--disabled{opacity:var(--gog-checkbox-disabled-opacity);cursor:not-allowed}.gog-checkbox__input{position:absolute;top:var(--gog-checkbox-padding);left:var(--gog-checkbox-padding);width:var(--gog-checkbox-box-size, 24px);height:var(--gog-checkbox-box-size, 24px);margin:0;opacity:0;cursor:inherit}.gog-checkbox__box{display:flex;align-items:center;justify-content:center;width:var(--gog-checkbox-box-size, 24px);height:var(--gog-checkbox-box-size, 24px);box-sizing:border-box;border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-checkbox-border-color);border-radius:var(--radius);background-color:var(--gog-checkbox-bg);color:var(--gog-checkbox-icon-color);flex:0 0 auto;line-height:0;overflow:hidden;transition:border-color .15s ease,background-color .15s ease}.gog-checkbox__input:checked+.gog-checkbox__box,.gog-checkbox__input:indeterminate+.gog-checkbox__box,.gog-checkbox__box--checked{border-color:var(--gog-checkbox-checked-border);background-color:var(--gog-checkbox-checked-bg)}.gog-checkbox__box gog-icon{display:block;font-size:var(--gog-checkbox-icon-size, 14px);line-height:1;pointer-events:none}.gog-checkbox__dash{width:calc(var(--gog-checkbox-box-size, 24px) * .45);height:var(--gog-checkbox-dash-height, 2px);border-radius:var(--gog-checkbox-dash-radius, 999px);background-color:currentColor;pointer-events:none}.gog-checkbox__label{font-size:var(--gog-checkbox-label-size, .9375rem);line-height:1.3;color:var(--gog-checkbox-label-color)}.gog-checkbox__input:focus-visible+.gog-checkbox__box{outline:3px solid var(--gog-checkbox-focus-ring);outline-offset:2px}@media(prefers-reduced-motion:reduce){.gog-checkbox__box{transition:none}}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
409
|
+
}
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: CheckboxComponent, decorators: [{
|
|
411
|
+
type: Component,
|
|
412
|
+
args: [{ selector: 'gog-checkbox', imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
413
|
+
'[style.--gog-checkbox-box-size]': 'boxSize()',
|
|
414
|
+
'[style.--gog-checkbox-label-size]': 'labelSize()',
|
|
415
|
+
'[style.--gog-checkbox-icon-size]': 'iconSize()',
|
|
416
|
+
'[style.--gog-checkbox-padding]': 'checkboxPadding',
|
|
417
|
+
}, providers: [
|
|
418
|
+
{
|
|
419
|
+
provide: NG_VALUE_ACCESSOR,
|
|
420
|
+
useExisting: forwardRef(() => CheckboxComponent),
|
|
421
|
+
multi: true,
|
|
422
|
+
},
|
|
423
|
+
], template: "<label class=\"gog-checkbox gog-contained-layout\" [class.gog-checkbox--disabled]=\"isDisabled()\">\n <input\n class=\"gog-checkbox__input\"\n type=\"checkbox\"\n [checked]=\"checked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"isDisabled()\"\n [attr.aria-checked]=\"indeterminate() ? 'mixed' : null\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n />\n\n <span\n class=\"gog-checkbox__box\"\n [class.gog-checkbox__box--checked]=\"checked()\"\n [class.gog-checkbox__box--indeterminate]=\"indeterminate()\"\n >\n @if (checked()) {\n <gog-icon [template]=\"checkIconTemplate()\" name=\"check\" />\n } @else if (indeterminate()) {\n <span class=\"gog-checkbox__dash\" aria-hidden=\"true\"></span>\n }\n </span>\n\n @if (label()) {\n <span class=\"gog-checkbox__label font-body\">{{ label() }}</span>\n }\n</label>\n", styles: [".gog-checkbox{--gog-checkbox-gap: 10px;--gog-checkbox-border-color: var(--accent-dim);--gog-checkbox-bg: var(--surface-color);--gog-checkbox-checked-bg: var(--accent-color);--gog-checkbox-checked-border: var(--accent-color);--gog-checkbox-icon-color: var(--primary-color);--gog-checkbox-label-color: var(--muted-text-color);--gog-checkbox-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-checkbox-disabled-opacity: .4;display:inline-flex;align-items:center;gap:var(--gog-checkbox-gap);padding:var(--gog-checkbox-padding);position:relative;cursor:pointer;-webkit-user-select:none;user-select:none}.gog-checkbox--disabled{opacity:var(--gog-checkbox-disabled-opacity);cursor:not-allowed}.gog-checkbox__input{position:absolute;top:var(--gog-checkbox-padding);left:var(--gog-checkbox-padding);width:var(--gog-checkbox-box-size, 24px);height:var(--gog-checkbox-box-size, 24px);margin:0;opacity:0;cursor:inherit}.gog-checkbox__box{display:flex;align-items:center;justify-content:center;width:var(--gog-checkbox-box-size, 24px);height:var(--gog-checkbox-box-size, 24px);box-sizing:border-box;border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-checkbox-border-color);border-radius:var(--radius);background-color:var(--gog-checkbox-bg);color:var(--gog-checkbox-icon-color);flex:0 0 auto;line-height:0;overflow:hidden;transition:border-color .15s ease,background-color .15s ease}.gog-checkbox__input:checked+.gog-checkbox__box,.gog-checkbox__input:indeterminate+.gog-checkbox__box,.gog-checkbox__box--checked{border-color:var(--gog-checkbox-checked-border);background-color:var(--gog-checkbox-checked-bg)}.gog-checkbox__box gog-icon{display:block;font-size:var(--gog-checkbox-icon-size, 14px);line-height:1;pointer-events:none}.gog-checkbox__dash{width:calc(var(--gog-checkbox-box-size, 24px) * .45);height:var(--gog-checkbox-dash-height, 2px);border-radius:var(--gog-checkbox-dash-radius, 999px);background-color:currentColor;pointer-events:none}.gog-checkbox__label{font-size:var(--gog-checkbox-label-size, .9375rem);line-height:1.3;color:var(--gog-checkbox-label-color)}.gog-checkbox__input:focus-visible+.gog-checkbox__box{outline:3px solid var(--gog-checkbox-focus-ring);outline-offset:2px}@media(prefers-reduced-motion:reduce){.gog-checkbox__box{transition:none}}\n"] }]
|
|
424
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], checkIconTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkIconTemplate", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }] } });
|
|
425
|
+
|
|
426
|
+
const DIALOG_DATA = new InjectionToken('DIALOG_DATA');
|
|
427
|
+
const DIALOG_REF = new InjectionToken('DIALOG_REF');
|
|
428
|
+
|
|
429
|
+
class ConfirmationDialogComponent {
|
|
430
|
+
static count = 0;
|
|
431
|
+
instanceId = ++ConfirmationDialogComponent.count;
|
|
432
|
+
data = inject(DIALOG_DATA);
|
|
433
|
+
ref = inject(DIALOG_REF);
|
|
434
|
+
confirm() {
|
|
435
|
+
this.ref.close(true);
|
|
436
|
+
}
|
|
437
|
+
cancel() {
|
|
438
|
+
this.ref.close(false);
|
|
439
|
+
}
|
|
440
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ConfirmationDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
441
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: ConfirmationDialogComponent, isStandalone: true, selector: "gog-confirmation-dialog", ngImport: i0, template: "<div\n class=\"confirm-dialog\"\n [attr.aria-labelledby]=\"'confirm-title-' + instanceId\"\n [attr.aria-describedby]=\"'confirm-desc-' + instanceId\"\n>\n <h3 [id]=\"'confirm-title-' + instanceId\" class=\"confirm-dialog__title heading-md\">\n {{ data.title }}\n </h3>\n <p [id]=\"'confirm-desc-' + instanceId\" class=\"confirm-dialog__description body-sm\">\n {{ data.description }}\n </p>\n <div class=\"confirm-dialog__actions\">\n <gog-button variant=\"ghost\" type=\"button\" (gogClick)=\"cancel()\">{{ data.cancelText }}</gog-button>\n <gog-button variant=\"primary\" type=\"button\" (gogClick)=\"confirm()\">{{ data.confirmText }}</gog-button>\n </div>\n</div>\n", styles: [":host{display:block;contain:layout style}.confirm-dialog{display:flex;flex-direction:column;gap:12px;min-width:320px;max-width:440px;color:var(--text-color)}.confirm-dialog__title{margin:0}.confirm-dialog__description{margin:0;color:var(--muted-text-color)}.confirm-dialog__actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "gog-button", inputs: ["variant", "size", "disabled", "fullWidth", "type", "debounce", "loading"], outputs: ["gogClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
442
|
+
}
|
|
443
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ConfirmationDialogComponent, decorators: [{
|
|
444
|
+
type: Component,
|
|
445
|
+
args: [{ selector: 'gog-confirmation-dialog', imports: [ButtonComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"confirm-dialog\"\n [attr.aria-labelledby]=\"'confirm-title-' + instanceId\"\n [attr.aria-describedby]=\"'confirm-desc-' + instanceId\"\n>\n <h3 [id]=\"'confirm-title-' + instanceId\" class=\"confirm-dialog__title heading-md\">\n {{ data.title }}\n </h3>\n <p [id]=\"'confirm-desc-' + instanceId\" class=\"confirm-dialog__description body-sm\">\n {{ data.description }}\n </p>\n <div class=\"confirm-dialog__actions\">\n <gog-button variant=\"ghost\" type=\"button\" (gogClick)=\"cancel()\">{{ data.cancelText }}</gog-button>\n <gog-button variant=\"primary\" type=\"button\" (gogClick)=\"confirm()\">{{ data.confirmText }}</gog-button>\n </div>\n</div>\n", styles: [":host{display:block;contain:layout style}.confirm-dialog{display:flex;flex-direction:column;gap:12px;min-width:320px;max-width:440px;color:var(--text-color)}.confirm-dialog__title{margin:0}.confirm-dialog__description{margin:0;color:var(--muted-text-color)}.confirm-dialog__actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}\n"] }]
|
|
446
|
+
}] });
|
|
447
|
+
|
|
448
|
+
class DialogService {
|
|
449
|
+
document = inject(DOCUMENT);
|
|
450
|
+
dialogs = signal([], ...(ngDevMode ? [{ debugName: "dialogs" }] : /* istanbul ignore next */ []));
|
|
451
|
+
nextId = 0;
|
|
452
|
+
nextZIndex = 1000;
|
|
453
|
+
modalDialogCount = 0;
|
|
454
|
+
bodyOverflowBeforeLock = null;
|
|
455
|
+
focusedBeforeOpen = null;
|
|
456
|
+
open(config) {
|
|
457
|
+
const id = ++this.nextId;
|
|
458
|
+
const zIndex = config.zIndex ?? this.nextZIndex++;
|
|
459
|
+
this.nextZIndex = Math.max(this.nextZIndex, zIndex + 1);
|
|
460
|
+
let resolveAfterClosed;
|
|
461
|
+
const afterClosed = new Promise((resolve) => {
|
|
462
|
+
resolveAfterClosed = resolve;
|
|
463
|
+
});
|
|
464
|
+
const dialog = {
|
|
465
|
+
id,
|
|
466
|
+
zIndex,
|
|
467
|
+
offsetX: 0,
|
|
468
|
+
offsetY: 0,
|
|
469
|
+
config,
|
|
470
|
+
resolve: (result) => resolveAfterClosed(result),
|
|
471
|
+
};
|
|
472
|
+
if (config.modal !== false && this.modalDialogCount === 0) {
|
|
473
|
+
this.focusedBeforeOpen = this.document.activeElement instanceof HTMLElement ? this.document.activeElement : null;
|
|
474
|
+
this.lockBodyScroll();
|
|
475
|
+
}
|
|
476
|
+
if (config.modal !== false) {
|
|
477
|
+
this.modalDialogCount += 1;
|
|
478
|
+
}
|
|
479
|
+
this.dialogs.update((list) => [...list, dialog]);
|
|
480
|
+
return {
|
|
481
|
+
close: (result) => this.close(dialog, result),
|
|
482
|
+
afterClosed,
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
close(dialog, result) {
|
|
486
|
+
if (!this.dialogs().some((entry) => entry.id === dialog.id))
|
|
487
|
+
return;
|
|
488
|
+
dialog.resolve(result);
|
|
489
|
+
this.dialogs.update((list) => list.filter((entry) => entry.id !== dialog.id));
|
|
490
|
+
if (dialog.config.modal !== false) {
|
|
491
|
+
this.modalDialogCount = Math.max(0, this.modalDialogCount - 1);
|
|
492
|
+
}
|
|
493
|
+
if (this.modalDialogCount === 0) {
|
|
494
|
+
this.unlockBodyScroll();
|
|
495
|
+
}
|
|
496
|
+
if (this.dialogs().length === 0) {
|
|
497
|
+
this.restoreFocus();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
closeAll(result) {
|
|
501
|
+
const dialogs = this.dialogs();
|
|
502
|
+
dialogs.forEach((dialog) => dialog.resolve(result));
|
|
503
|
+
this.dialogs.set([]);
|
|
504
|
+
this.modalDialogCount = 0;
|
|
505
|
+
this.unlockBodyScroll();
|
|
506
|
+
this.restoreFocus();
|
|
507
|
+
}
|
|
508
|
+
updatePosition(dialogId, offsetX, offsetY) {
|
|
509
|
+
this.dialogs.update((list) => list.map((dialog) => (dialog.id === dialogId ? { ...dialog, offsetX, offsetY } : dialog)));
|
|
510
|
+
}
|
|
511
|
+
lockBodyScroll() {
|
|
512
|
+
if (this.bodyOverflowBeforeLock !== null)
|
|
513
|
+
return;
|
|
514
|
+
this.bodyOverflowBeforeLock = this.document.body.style.overflow;
|
|
515
|
+
this.document.body.style.overflow = 'hidden';
|
|
516
|
+
}
|
|
517
|
+
unlockBodyScroll() {
|
|
518
|
+
if (this.bodyOverflowBeforeLock === null)
|
|
519
|
+
return;
|
|
520
|
+
this.document.body.style.overflow = this.bodyOverflowBeforeLock;
|
|
521
|
+
this.bodyOverflowBeforeLock = null;
|
|
522
|
+
}
|
|
523
|
+
restoreFocus() {
|
|
524
|
+
const element = this.focusedBeforeOpen;
|
|
525
|
+
this.focusedBeforeOpen = null;
|
|
526
|
+
if (!element || !this.document.contains(element))
|
|
527
|
+
return;
|
|
528
|
+
element.focus({ preventScroll: true });
|
|
529
|
+
}
|
|
530
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
531
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: DialogService, providedIn: 'root' });
|
|
532
|
+
}
|
|
533
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: DialogService, decorators: [{
|
|
534
|
+
type: Injectable,
|
|
535
|
+
args: [{ providedIn: 'root' }]
|
|
536
|
+
}] });
|
|
537
|
+
|
|
538
|
+
class DialogComponent {
|
|
539
|
+
dialogService = inject(DialogService);
|
|
540
|
+
parentInjector = inject(Injector);
|
|
541
|
+
host = inject((ElementRef));
|
|
542
|
+
injectorCache = new WeakMap();
|
|
543
|
+
backdropPress = new Set();
|
|
544
|
+
focusableSelector = [
|
|
545
|
+
'a[href]',
|
|
546
|
+
'button:not([disabled])',
|
|
547
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
548
|
+
'select:not([disabled])',
|
|
549
|
+
'textarea:not([disabled])',
|
|
550
|
+
'[contenteditable="true"]',
|
|
551
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
552
|
+
].join(',');
|
|
553
|
+
constructor() {
|
|
554
|
+
effect(() => {
|
|
555
|
+
const dialogs = this.dialogService.dialogs();
|
|
556
|
+
const openIds = new Set(dialogs.map((dialog) => dialog.id));
|
|
557
|
+
for (const dialogId of this.backdropPress) {
|
|
558
|
+
if (!openIds.has(dialogId)) {
|
|
559
|
+
this.backdropPress.delete(dialogId);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
if (dialogs.length === 0)
|
|
563
|
+
return;
|
|
564
|
+
queueMicrotask(() => this.focusTopDialog());
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
getInjector(dialog) {
|
|
568
|
+
if (!this.injectorCache.has(dialog)) {
|
|
569
|
+
this.injectorCache.set(dialog, Injector.create({
|
|
570
|
+
parent: this.parentInjector,
|
|
571
|
+
providers: [
|
|
572
|
+
{ provide: DIALOG_DATA, useValue: dialog.config.data },
|
|
573
|
+
{
|
|
574
|
+
provide: DIALOG_REF,
|
|
575
|
+
useValue: {
|
|
576
|
+
close: (result) => this.dialogService.close(dialog, result),
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
],
|
|
580
|
+
}));
|
|
581
|
+
}
|
|
582
|
+
return this.injectorCache.get(dialog);
|
|
583
|
+
}
|
|
584
|
+
getTitleId(dialog) {
|
|
585
|
+
return `gog-dialog-title-${dialog.id}`;
|
|
586
|
+
}
|
|
587
|
+
close(dialog) {
|
|
588
|
+
this.backdropPress.delete(dialog.id);
|
|
589
|
+
this.dialogService.close(dialog, undefined);
|
|
590
|
+
}
|
|
591
|
+
closeIfClosable(dialog) {
|
|
592
|
+
if (dialog.config.closable !== false)
|
|
593
|
+
this.close(dialog);
|
|
594
|
+
}
|
|
595
|
+
panelZ(dialog) {
|
|
596
|
+
return dialog.zIndex;
|
|
597
|
+
}
|
|
598
|
+
onBackdropPointerDown(event, dialog) {
|
|
599
|
+
if (!dialog.config.closable)
|
|
600
|
+
return;
|
|
601
|
+
if (event.target === event.currentTarget) {
|
|
602
|
+
this.backdropPress.add(dialog.id);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
onBackdropPointerUp(event, dialog) {
|
|
606
|
+
if (!dialog.config.closable)
|
|
607
|
+
return;
|
|
608
|
+
const shouldClose = this.backdropPress.has(dialog.id) && event.target === event.currentTarget;
|
|
609
|
+
this.backdropPress.delete(dialog.id);
|
|
610
|
+
if (shouldClose) {
|
|
611
|
+
this.close(dialog);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
onPanelKeydown(event, dialog, panel) {
|
|
615
|
+
if (event.key === 'Escape') {
|
|
616
|
+
event.preventDefault();
|
|
617
|
+
this.closeIfClosable(dialog);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
if (dialog.config.modal === false || event.key !== 'Tab')
|
|
621
|
+
return;
|
|
622
|
+
const focusables = this.getFocusableElements(panel);
|
|
623
|
+
if (focusables.length === 0) {
|
|
624
|
+
event.preventDefault();
|
|
625
|
+
panel.focus({ preventScroll: true });
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
const currentIndex = focusables.indexOf(this.dialogDocument.activeElement);
|
|
629
|
+
const lastIndex = focusables.length - 1;
|
|
630
|
+
const nextIndex = event.shiftKey
|
|
631
|
+
? currentIndex <= 0
|
|
632
|
+
? lastIndex
|
|
633
|
+
: currentIndex - 1
|
|
634
|
+
: currentIndex === -1 || currentIndex === lastIndex
|
|
635
|
+
? 0
|
|
636
|
+
: currentIndex + 1;
|
|
637
|
+
event.preventDefault();
|
|
638
|
+
focusables[nextIndex].focus({ preventScroll: true });
|
|
639
|
+
}
|
|
640
|
+
startDrag(event, dialog) {
|
|
641
|
+
if (dialog.config.draggable === false)
|
|
642
|
+
return;
|
|
643
|
+
if (event.button !== 0)
|
|
644
|
+
return;
|
|
645
|
+
if (event.target?.closest('button'))
|
|
646
|
+
return;
|
|
647
|
+
const startX = event.clientX;
|
|
648
|
+
const startY = event.clientY;
|
|
649
|
+
const initialX = dialog.offsetX;
|
|
650
|
+
const initialY = dialog.offsetY;
|
|
651
|
+
const move = (moveEvent) => {
|
|
652
|
+
this.dialogService.updatePosition(dialog.id, initialX + (moveEvent.clientX - startX), initialY + (moveEvent.clientY - startY));
|
|
653
|
+
};
|
|
654
|
+
const stop = () => {
|
|
655
|
+
this.dialogDocument.removeEventListener('pointermove', move);
|
|
656
|
+
this.dialogDocument.removeEventListener('pointerup', stop);
|
|
657
|
+
this.dialogDocument.removeEventListener('pointercancel', stop);
|
|
658
|
+
};
|
|
659
|
+
this.dialogDocument.addEventListener('pointermove', move);
|
|
660
|
+
this.dialogDocument.addEventListener('pointerup', stop);
|
|
661
|
+
this.dialogDocument.addEventListener('pointercancel', stop);
|
|
662
|
+
event.preventDefault();
|
|
663
|
+
}
|
|
664
|
+
trackDialog(_, entry) {
|
|
665
|
+
return entry.id;
|
|
666
|
+
}
|
|
667
|
+
isDraggable(dialog) {
|
|
668
|
+
return dialog.config.draggable !== false && (dialog.config.title !== undefined || dialog.config.closable !== false);
|
|
669
|
+
}
|
|
670
|
+
get dialogDocument() {
|
|
671
|
+
return this.host.nativeElement.ownerDocument;
|
|
672
|
+
}
|
|
673
|
+
focusTopDialog() {
|
|
674
|
+
const dialogs = this.dialogService.dialogs();
|
|
675
|
+
const topDialog = dialogs[dialogs.length - 1];
|
|
676
|
+
if (!topDialog)
|
|
677
|
+
return;
|
|
678
|
+
const panel = this.host.nativeElement.querySelector(`[data-dialog-id="${topDialog.id}"]`);
|
|
679
|
+
if (!panel)
|
|
680
|
+
return;
|
|
681
|
+
const focusables = this.getFocusableElements(panel);
|
|
682
|
+
(focusables[0] ?? panel).focus({ preventScroll: true });
|
|
683
|
+
}
|
|
684
|
+
getFocusableElements(panel) {
|
|
685
|
+
return Array.from(panel.querySelectorAll(this.focusableSelector)).filter((element) => !element.hasAttribute('disabled') && element.tabIndex !== -1 && this.isVisible(element));
|
|
686
|
+
}
|
|
687
|
+
isVisible(element) {
|
|
688
|
+
const rect = element.getBoundingClientRect();
|
|
689
|
+
return rect.width > 0 && rect.height > 0;
|
|
690
|
+
}
|
|
691
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
692
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: DialogComponent, isStandalone: true, selector: "gog-dialog", ngImport: i0, template: "@for (dialog of dialogService.dialogs(); track trackDialog($index, dialog)) {\n <div\n class=\"gog-dialog__backdrop\"\n [class.gog-dialog__backdrop--modal]=\"dialog.config.modal !== false\"\n [style.z-index]=\"panelZ(dialog)\"\n (pointerdown)=\"onBackdropPointerDown($event, dialog)\"\n (pointerup)=\"onBackdropPointerUp($event, dialog)\"\n (pointercancel)=\"onBackdropPointerUp($event, dialog)\"\n >\n <div\n #panel\n class=\"gog-dialog__panel\"\n [attr.data-dialog-id]=\"dialog.id\"\n [style.--dropdown-z]=\"panelZ(dialog) + 10\"\n [style.--gog-dialog-offset-x]=\"dialog.offsetX + 'px'\"\n [style.--gog-dialog-offset-y]=\"dialog.offsetY + 'px'\"\n [style.width]=\"dialog.config.width ?? 'auto'\"\n [style.max-width]=\"dialog.config.maxWidth ?? '90vw'\"\n [attr.role]=\"dialog.config.role ?? 'dialog'\"\n [attr.aria-modal]=\"dialog.config.modal === false ? null : 'true'\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"dialog.config.title ? getTitleId(dialog) : null\"\n (keydown)=\"onPanelKeydown($event, dialog, panel)\"\n >\n @if (dialog.config.title || dialog.config.closable !== false) {\n <div\n class=\"gog-dialog__header\"\n [class.gog-dialog__header--draggable]=\"isDraggable(dialog)\"\n (pointerdown)=\"startDrag($event, dialog)\"\n >\n @if (dialog.config.title) {\n <h2 [id]=\"getTitleId(dialog)\" class=\"gog-dialog__title font-heading\">\n {{ dialog.config.title }}\n </h2>\n }\n @if (dialog.config.closable !== false) {\n <button type=\"button\" class=\"gog-dialog__close gog-inline-center\" aria-label=\"Close dialog\" (click)=\"close(dialog)\">\n <gog-icon\n [template]=\"dialog.config.closeIconTemplate ?? null\"\n [name]=\"dialog.config.closeIconName ?? 'close'\"\n />\n </button>\n }\n </div>\n }\n\n <div class=\"gog-dialog__body\">\n <ng-container *ngComponentOutlet=\"dialog.config.component; injector: getInjector(dialog)\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.gog-dialog__backdrop{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--space-lg);animation:gog-fade-in .15s ease}.gog-dialog__backdrop--modal{background:#0a0803b8;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.gog-dialog__panel{--gog-dialog-border: var(--border-color);--gog-dialog-shadow: 0 24px 48px rgba(0, 0, 0, .5);--gog-dialog-offset-x: 0px;--gog-dialog-offset-y: 0px;display:flex;flex-direction:column;background:var(--surface-color);color:var(--text-color);border:1px solid var(--gog-dialog-border);box-shadow:var(--gog-dialog-shadow);overflow:visible;max-height:90vh;animation:gog-slide-in .2s ease;min-width:320px;border-radius:var(--radius);transform:translate3d(var(--gog-dialog-offset-x),var(--gog-dialog-offset-y),0)}.gog-dialog__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 14px;border-bottom:1px solid var(--border-color);gap:12px;flex-shrink:0}.gog-dialog__header--draggable{cursor:move;touch-action:none;-webkit-user-select:none;user-select:none}.gog-dialog__title{margin:0;color:var(--text-color)}.gog-dialog__close{justify-content:center;width:2rem;height:2rem;border:1px solid transparent;background:transparent;color:var(--muted-text-color);cursor:pointer;flex-shrink:0;padding:0;line-height:1;font-size:.875rem}.gog-dialog__close gog-icon{font-size:.875rem}.gog-dialog__close:hover{color:var(--text-color);border-color:var(--border-color);background:color-mix(in srgb,var(--hover-color) 70%,transparent)}.gog-dialog__close:focus-visible{outline:3px solid var(--accent-color);outline-offset:2px}.gog-dialog__body{padding:20px;overflow-y:auto;flex:1;max-height:calc(90vh - 60px)}@keyframes gog-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gog-slide-in{0%{transform:translateY(-12px);opacity:0}to{transform:translateY(0);opacity:1}}@media(prefers-reduced-motion:reduce){.gog-dialog__backdrop,.gog-dialog__panel,.gog-dialog__close{animation:none;transition:none}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
693
|
+
}
|
|
694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: DialogComponent, decorators: [{
|
|
695
|
+
type: Component,
|
|
696
|
+
args: [{ selector: 'gog-dialog', imports: [NgComponentOutlet, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (dialog of dialogService.dialogs(); track trackDialog($index, dialog)) {\n <div\n class=\"gog-dialog__backdrop\"\n [class.gog-dialog__backdrop--modal]=\"dialog.config.modal !== false\"\n [style.z-index]=\"panelZ(dialog)\"\n (pointerdown)=\"onBackdropPointerDown($event, dialog)\"\n (pointerup)=\"onBackdropPointerUp($event, dialog)\"\n (pointercancel)=\"onBackdropPointerUp($event, dialog)\"\n >\n <div\n #panel\n class=\"gog-dialog__panel\"\n [attr.data-dialog-id]=\"dialog.id\"\n [style.--dropdown-z]=\"panelZ(dialog) + 10\"\n [style.--gog-dialog-offset-x]=\"dialog.offsetX + 'px'\"\n [style.--gog-dialog-offset-y]=\"dialog.offsetY + 'px'\"\n [style.width]=\"dialog.config.width ?? 'auto'\"\n [style.max-width]=\"dialog.config.maxWidth ?? '90vw'\"\n [attr.role]=\"dialog.config.role ?? 'dialog'\"\n [attr.aria-modal]=\"dialog.config.modal === false ? null : 'true'\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"dialog.config.title ? getTitleId(dialog) : null\"\n (keydown)=\"onPanelKeydown($event, dialog, panel)\"\n >\n @if (dialog.config.title || dialog.config.closable !== false) {\n <div\n class=\"gog-dialog__header\"\n [class.gog-dialog__header--draggable]=\"isDraggable(dialog)\"\n (pointerdown)=\"startDrag($event, dialog)\"\n >\n @if (dialog.config.title) {\n <h2 [id]=\"getTitleId(dialog)\" class=\"gog-dialog__title font-heading\">\n {{ dialog.config.title }}\n </h2>\n }\n @if (dialog.config.closable !== false) {\n <button type=\"button\" class=\"gog-dialog__close gog-inline-center\" aria-label=\"Close dialog\" (click)=\"close(dialog)\">\n <gog-icon\n [template]=\"dialog.config.closeIconTemplate ?? null\"\n [name]=\"dialog.config.closeIconName ?? 'close'\"\n />\n </button>\n }\n </div>\n }\n\n <div class=\"gog-dialog__body\">\n <ng-container *ngComponentOutlet=\"dialog.config.component; injector: getInjector(dialog)\" />\n </div>\n </div>\n </div>\n}\n", styles: [":host{display:contents}.gog-dialog__backdrop{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;padding:var(--space-lg);animation:gog-fade-in .15s ease}.gog-dialog__backdrop--modal{background:#0a0803b8;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}.gog-dialog__panel{--gog-dialog-border: var(--border-color);--gog-dialog-shadow: 0 24px 48px rgba(0, 0, 0, .5);--gog-dialog-offset-x: 0px;--gog-dialog-offset-y: 0px;display:flex;flex-direction:column;background:var(--surface-color);color:var(--text-color);border:1px solid var(--gog-dialog-border);box-shadow:var(--gog-dialog-shadow);overflow:visible;max-height:90vh;animation:gog-slide-in .2s ease;min-width:320px;border-radius:var(--radius);transform:translate3d(var(--gog-dialog-offset-x),var(--gog-dialog-offset-y),0)}.gog-dialog__header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px 14px;border-bottom:1px solid var(--border-color);gap:12px;flex-shrink:0}.gog-dialog__header--draggable{cursor:move;touch-action:none;-webkit-user-select:none;user-select:none}.gog-dialog__title{margin:0;color:var(--text-color)}.gog-dialog__close{justify-content:center;width:2rem;height:2rem;border:1px solid transparent;background:transparent;color:var(--muted-text-color);cursor:pointer;flex-shrink:0;padding:0;line-height:1;font-size:.875rem}.gog-dialog__close gog-icon{font-size:.875rem}.gog-dialog__close:hover{color:var(--text-color);border-color:var(--border-color);background:color-mix(in srgb,var(--hover-color) 70%,transparent)}.gog-dialog__close:focus-visible{outline:3px solid var(--accent-color);outline-offset:2px}.gog-dialog__body{padding:20px;overflow-y:auto;flex:1;max-height:calc(90vh - 60px)}@keyframes gog-fade-in{0%{opacity:0}to{opacity:1}}@keyframes gog-slide-in{0%{transform:translateY(-12px);opacity:0}to{transform:translateY(0);opacity:1}}@media(prefers-reduced-motion:reduce){.gog-dialog__backdrop,.gog-dialog__panel,.gog-dialog__close{animation:none;transition:none}}\n"] }]
|
|
697
|
+
}], ctorParameters: () => [] });
|
|
698
|
+
|
|
699
|
+
class ToastComponent {
|
|
700
|
+
toast = input.required(...(ngDevMode ? [{ debugName: "toast" }] : /* istanbul ignore next */ []));
|
|
701
|
+
/** Whether this toast is the active, front-of-queue toast — only the front toast counts down. */
|
|
702
|
+
isFront = input(true, ...(ngDevMode ? [{ debugName: "isFront" }] : /* istanbul ignore next */ []));
|
|
703
|
+
dismissed = output();
|
|
704
|
+
visible = signal(false, ...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
705
|
+
isPaused = signal(false, ...(ngDevMode ? [{ debugName: "isPaused" }] : /* istanbul ignore next */ []));
|
|
706
|
+
autoDismissTimer = null;
|
|
707
|
+
startedAt = 0;
|
|
708
|
+
remainingMs = 0;
|
|
709
|
+
isClosing = signal(false, ...(ngDevMode ? [{ debugName: "isClosing" }] : /* istanbul ignore next */ []));
|
|
710
|
+
progressEl = viewChild('progress', ...(ngDevMode ? [{ debugName: "progressEl" }] : /* istanbul ignore next */ []));
|
|
711
|
+
hasActions = computed(() => this.toast().actions.length > 0, ...(ngDevMode ? [{ debugName: "hasActions" }] : /* istanbul ignore next */ []));
|
|
712
|
+
ariaRole = computed(() => ['error', 'warning'].includes(this.toast().type) ? 'alert' : 'status', ...(ngDevMode ? [{ debugName: "ariaRole" }] : /* istanbul ignore next */ []));
|
|
713
|
+
ariaLive = computed(() => ['error', 'warning'].includes(this.toast().type) ? 'assertive' : 'polite', ...(ngDevMode ? [{ debugName: "ariaLive" }] : /* istanbul ignore next */ []));
|
|
714
|
+
constructor() {
|
|
715
|
+
afterNextRender(() => this.visible.set(true));
|
|
716
|
+
effect((onCleanup) => {
|
|
717
|
+
const toast = this.toast();
|
|
718
|
+
const isFront = this.isFront();
|
|
719
|
+
this.isPaused.set(false);
|
|
720
|
+
this.isClosing.set(false);
|
|
721
|
+
this.clearAutoDismissTimer();
|
|
722
|
+
this.remainingMs = toast.duration;
|
|
723
|
+
// Toasts queued behind the front one keep a full, frozen progress bar and don't count
|
|
724
|
+
// down — they only start ticking once they become the front toast.
|
|
725
|
+
if (!toast.isSticky && isFront) {
|
|
726
|
+
this.restartProgressAnimation();
|
|
727
|
+
this.startAutoDismiss(this.remainingMs);
|
|
728
|
+
}
|
|
729
|
+
onCleanup(() => this.clearAutoDismissTimer());
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
ngOnDestroy() {
|
|
733
|
+
this.clearAutoDismissTimer();
|
|
734
|
+
}
|
|
735
|
+
close() {
|
|
736
|
+
if (!this.visible() || this.isClosing())
|
|
737
|
+
return;
|
|
738
|
+
this.clearAutoDismissTimer();
|
|
739
|
+
this.isPaused.set(false);
|
|
740
|
+
this.isClosing.set(true);
|
|
741
|
+
this.visible.set(false);
|
|
742
|
+
const id = this.toast().id;
|
|
743
|
+
if (this.prefersReducedMotion()) {
|
|
744
|
+
this.isClosing.set(false);
|
|
745
|
+
queueMicrotask(() => this.dismissed.emit(id));
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
pauseAutoDismiss() {
|
|
749
|
+
const toast = this.toast();
|
|
750
|
+
if (toast.isSticky || !this.isFront() || this.isPaused() || this.isClosing())
|
|
751
|
+
return;
|
|
752
|
+
if (this.autoDismissTimer === null)
|
|
753
|
+
return;
|
|
754
|
+
const elapsed = Date.now() - this.startedAt;
|
|
755
|
+
this.remainingMs = Math.max(0, this.remainingMs - elapsed);
|
|
756
|
+
this.clearAutoDismissTimer();
|
|
757
|
+
this.isPaused.set(true);
|
|
758
|
+
}
|
|
759
|
+
resumeAutoDismiss() {
|
|
760
|
+
const toast = this.toast();
|
|
761
|
+
if (toast.isSticky || !this.isFront() || !this.isPaused() || this.isClosing())
|
|
762
|
+
return;
|
|
763
|
+
this.isPaused.set(false);
|
|
764
|
+
if (this.remainingMs <= 0) {
|
|
765
|
+
this.close();
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
this.startAutoDismiss(this.remainingMs);
|
|
769
|
+
}
|
|
770
|
+
onTransitionEnd(event) {
|
|
771
|
+
if (!this.isClosing() || event.target !== event.currentTarget)
|
|
772
|
+
return;
|
|
773
|
+
if (event.propertyName !== 'opacity' && event.propertyName !== 'transform')
|
|
774
|
+
return;
|
|
775
|
+
this.isClosing.set(false);
|
|
776
|
+
this.dismissed.emit(this.toast().id);
|
|
777
|
+
}
|
|
778
|
+
runAction(action) {
|
|
779
|
+
action.onClick(this.toast());
|
|
780
|
+
}
|
|
781
|
+
startAutoDismiss(duration) {
|
|
782
|
+
this.clearAutoDismissTimer();
|
|
783
|
+
this.remainingMs = duration;
|
|
784
|
+
this.startedAt = Date.now();
|
|
785
|
+
this.autoDismissTimer = setTimeout(() => {
|
|
786
|
+
this.autoDismissTimer = null;
|
|
787
|
+
this.remainingMs = 0;
|
|
788
|
+
this.close();
|
|
789
|
+
}, duration);
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Forces the CSS progress-bar animation to restart from full width. Simply updating the
|
|
793
|
+
* `--toast-duration` custom property doesn't retrigger a running `animation`, so the element
|
|
794
|
+
* is briefly detached from the animation and reflowed before being reattached.
|
|
795
|
+
*/
|
|
796
|
+
restartProgressAnimation() {
|
|
797
|
+
const el = this.progressEl()?.nativeElement;
|
|
798
|
+
if (!el)
|
|
799
|
+
return;
|
|
800
|
+
el.style.animation = 'none';
|
|
801
|
+
void el.offsetWidth;
|
|
802
|
+
el.style.animation = '';
|
|
803
|
+
}
|
|
804
|
+
clearAutoDismissTimer() {
|
|
805
|
+
if (this.autoDismissTimer !== null) {
|
|
806
|
+
clearTimeout(this.autoDismissTimer);
|
|
807
|
+
this.autoDismissTimer = null;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
prefersReducedMotion() {
|
|
811
|
+
return typeof window !== 'undefined' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
812
|
+
}
|
|
813
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
814
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ToastComponent, isStandalone: true, selector: "gog-toast", inputs: { toast: { classPropertyName: "toast", publicName: "toast", isSignal: true, isRequired: true, transformFunction: null }, isFront: { classPropertyName: "isFront", publicName: "isFront", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismissed: "dismissed" }, host: { properties: { "attr.role": "ariaRole()", "attr.aria-live": "ariaLive()", "attr.aria-atomic": "true" } }, viewQueries: [{ propertyName: "progressEl", first: true, predicate: ["progress"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"gog-toast\"\n [class.gog-toast--paused]=\"isPaused()\"\n [class.gog-toast--queued]=\"!isFront()\"\n [class.gog-toast--success]=\"toast().type === 'success'\"\n [class.gog-toast--error]=\"toast().type === 'error'\"\n [class.gog-toast--warning]=\"toast().type === 'warning'\"\n [class.gog-toast--info]=\"toast().type === 'info'\"\n [class.gog-toast--visible]=\"visible()\"\n [style.--toast-duration]=\"toast().duration + 'ms'\"\n (mouseenter)=\"pauseAutoDismiss()\"\n (mouseleave)=\"resumeAutoDismiss()\"\n (transitionend)=\"onTransitionEnd($event)\"\n>\n <div class=\"gog-toast__content\">\n <span class=\"gog-toast__icon\" aria-hidden=\"true\">\n <gog-icon [template]=\"toast().iconTemplate ?? null\" [name]=\"toast().iconName\" />\n </span>\n <div class=\"gog-toast__main\">\n <span class=\"gog-toast__message font-body\">{{ toast().message }}</span>\n @if (hasActions()) {\n <div class=\"gog-toast__actions\">\n @for (action of toast().actions; track action.label) {\n <gog-button\n class=\"gog-toast__action\"\n variant=\"ghost\"\n size=\"sm\"\n type=\"button\"\n (gogClick)=\"runAction(action)\"\n >\n @if (action.iconName || action.iconTemplate) {\n <gog-icon [template]=\"action.iconTemplate ?? null\" [name]=\"action.iconName ?? 'check'\" />\n }\n {{ action.label }}\n </gog-button>\n }\n </div>\n }\n </div>\n <gog-button\n class=\"gog-toast__close\"\n variant=\"ghost\"\n size=\"sm\"\n type=\"button\"\n aria-label=\"Close toast\"\n (gogClick)=\"close()\"\n >\n <gog-icon name=\"close\" />\n </gog-button>\n </div>\n @if (!toast().isSticky) {\n <span #progress class=\"gog-toast__progress\" aria-hidden=\"true\"></span>\n }\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block}.gog-toast{--toast-bg: var(--surface-color);--toast-border: var(--accent-color);--toast-color: var(--text-color);--toast-icon-color: var(--accent-color);--toast-enter-x: var(--gog-toast-enter-distance);--toast-progress-color: var(--toast-border);--toast-stack-depth: min(var(--toast-stack-index, 0), 6);--gog-toast-stack-peek: 14px;--gog-toast-stack-scale-step: .06;--gog-toast-stack-expanded-gap: 84px;--gog-toast-stack-min-opacity: .4;--toast-stack-collapsed-y: calc( var(--toast-stack-depth) * var(--gog-toast-stack-peek) * var(--toast-stack-direction, 1) );--toast-stack-expanded-y: calc( var(--toast-stack-depth) * var(--gog-toast-stack-expanded-gap) * var(--toast-stack-direction, 1) );--toast-stack-y: calc( var(--toast-stack-collapsed-y) + (var(--toast-stack-expanded-y) - var(--toast-stack-collapsed-y)) * var(--toast-stack-expanded, 0) );--toast-stack-collapsed-scale: calc(1 - (var(--toast-stack-depth) * var(--gog-toast-stack-scale-step)));--toast-stack-scale: calc( var(--toast-stack-collapsed-scale) + (1 - var(--toast-stack-collapsed-scale)) * var(--toast-stack-expanded, 0) );--toast-stack-collapsed-opacity: max( var(--gog-toast-stack-min-opacity), calc(1 - (var(--toast-stack-depth) * .18)) );--toast-stack-opacity: calc( var(--toast-stack-collapsed-opacity) + (1 - var(--toast-stack-collapsed-opacity)) * var(--toast-stack-expanded, 0) );position:relative;z-index:calc(100 - var(--toast-stack-index, 0));display:block;padding:12px 14px;background:var(--toast-bg);border-left:4px solid var(--toast-border);color:var(--toast-color);box-shadow:var(--gog-toast-shadow);min-width:var(--gog-toast-min-width);max-width:var(--gog-toast-max-width);pointer-events:all;opacity:0;overflow:hidden;transform:translate3d(var(--toast-enter-x),var(--toast-stack-y),0) scale(var(--toast-stack-scale));transition:opacity .25s ease,transform .25s ease}.gog-toast--visible{opacity:var(--toast-stack-opacity);transform:translate3d(0,var(--toast-stack-y),0) scale(var(--toast-stack-scale))}:host(.slide-left) .gog-toast{--toast-enter-x: calc(var(--gog-toast-enter-distance) * -1)}.gog-toast--success{--toast-border: var(--success-color);--toast-icon-color: var(--success-color)}.gog-toast--error{--toast-border: var(--danger-color);--toast-icon-color: var(--danger-color)}.gog-toast--warning{--toast-border: var(--accent-bright);--toast-icon-color: var(--accent-bright)}.gog-toast--info{--toast-border: var(--accent-color);--toast-icon-color: var(--accent-color)}.gog-toast__icon{color:var(--toast-icon-color);font-size:1rem;line-height:1.4;flex-shrink:0}.gog-toast__icon gog-icon{font-size:1rem}.gog-toast__content{display:flex;align-items:flex-start;gap:10px}.gog-toast__main{display:flex;flex:1;flex-direction:column;gap:8px;min-width:0}.gog-toast__message{flex:1;font-size:var(--text-sm);line-height:1.5}.gog-toast__actions{display:flex;flex-wrap:wrap;gap:6px}.gog-toast__action{--gog-btn-padding: .25rem .5rem;--gog-btn-font-size: .75rem}.gog-toast__action gog-icon{font-size:.75rem}.gog-toast__close{align-self:flex-start;flex-shrink:0;--gog-btn-padding: .125rem .25rem;--gog-btn-font-size: .75rem}.gog-toast__close gog-icon{font-size:.75rem}.gog-toast__progress{position:absolute;right:0;bottom:0;left:0;height:3px;background:color-mix(in srgb,var(--toast-progress-color) 30%,transparent);transform-origin:left center;animation:gog-toast-progress var(--toast-duration) linear forwards}.gog-toast--paused .gog-toast__progress,.gog-toast--queued .gog-toast__progress{animation-play-state:paused}@keyframes gog-toast-progress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-motion:reduce){.gog-toast,.gog-toast__progress{transition:none;animation:none}}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "gog-button", inputs: ["variant", "size", "disabled", "fullWidth", "type", "debounce", "loading"], outputs: ["gogClick"] }, { kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
815
|
+
}
|
|
816
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastComponent, decorators: [{
|
|
817
|
+
type: Component,
|
|
818
|
+
args: [{ selector: 'gog-toast', imports: [ButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
819
|
+
'[attr.role]': 'ariaRole()',
|
|
820
|
+
'[attr.aria-live]': 'ariaLive()',
|
|
821
|
+
'[attr.aria-atomic]': 'true',
|
|
822
|
+
}, template: "<div\n class=\"gog-toast\"\n [class.gog-toast--paused]=\"isPaused()\"\n [class.gog-toast--queued]=\"!isFront()\"\n [class.gog-toast--success]=\"toast().type === 'success'\"\n [class.gog-toast--error]=\"toast().type === 'error'\"\n [class.gog-toast--warning]=\"toast().type === 'warning'\"\n [class.gog-toast--info]=\"toast().type === 'info'\"\n [class.gog-toast--visible]=\"visible()\"\n [style.--toast-duration]=\"toast().duration + 'ms'\"\n (mouseenter)=\"pauseAutoDismiss()\"\n (mouseleave)=\"resumeAutoDismiss()\"\n (transitionend)=\"onTransitionEnd($event)\"\n>\n <div class=\"gog-toast__content\">\n <span class=\"gog-toast__icon\" aria-hidden=\"true\">\n <gog-icon [template]=\"toast().iconTemplate ?? null\" [name]=\"toast().iconName\" />\n </span>\n <div class=\"gog-toast__main\">\n <span class=\"gog-toast__message font-body\">{{ toast().message }}</span>\n @if (hasActions()) {\n <div class=\"gog-toast__actions\">\n @for (action of toast().actions; track action.label) {\n <gog-button\n class=\"gog-toast__action\"\n variant=\"ghost\"\n size=\"sm\"\n type=\"button\"\n (gogClick)=\"runAction(action)\"\n >\n @if (action.iconName || action.iconTemplate) {\n <gog-icon [template]=\"action.iconTemplate ?? null\" [name]=\"action.iconName ?? 'check'\" />\n }\n {{ action.label }}\n </gog-button>\n }\n </div>\n }\n </div>\n <gog-button\n class=\"gog-toast__close\"\n variant=\"ghost\"\n size=\"sm\"\n type=\"button\"\n aria-label=\"Close toast\"\n (gogClick)=\"close()\"\n >\n <gog-icon name=\"close\" />\n </gog-button>\n </div>\n @if (!toast().isSticky) {\n <span #progress class=\"gog-toast__progress\" aria-hidden=\"true\"></span>\n }\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block}.gog-toast{--toast-bg: var(--surface-color);--toast-border: var(--accent-color);--toast-color: var(--text-color);--toast-icon-color: var(--accent-color);--toast-enter-x: var(--gog-toast-enter-distance);--toast-progress-color: var(--toast-border);--toast-stack-depth: min(var(--toast-stack-index, 0), 6);--gog-toast-stack-peek: 14px;--gog-toast-stack-scale-step: .06;--gog-toast-stack-expanded-gap: 84px;--gog-toast-stack-min-opacity: .4;--toast-stack-collapsed-y: calc( var(--toast-stack-depth) * var(--gog-toast-stack-peek) * var(--toast-stack-direction, 1) );--toast-stack-expanded-y: calc( var(--toast-stack-depth) * var(--gog-toast-stack-expanded-gap) * var(--toast-stack-direction, 1) );--toast-stack-y: calc( var(--toast-stack-collapsed-y) + (var(--toast-stack-expanded-y) - var(--toast-stack-collapsed-y)) * var(--toast-stack-expanded, 0) );--toast-stack-collapsed-scale: calc(1 - (var(--toast-stack-depth) * var(--gog-toast-stack-scale-step)));--toast-stack-scale: calc( var(--toast-stack-collapsed-scale) + (1 - var(--toast-stack-collapsed-scale)) * var(--toast-stack-expanded, 0) );--toast-stack-collapsed-opacity: max( var(--gog-toast-stack-min-opacity), calc(1 - (var(--toast-stack-depth) * .18)) );--toast-stack-opacity: calc( var(--toast-stack-collapsed-opacity) + (1 - var(--toast-stack-collapsed-opacity)) * var(--toast-stack-expanded, 0) );position:relative;z-index:calc(100 - var(--toast-stack-index, 0));display:block;padding:12px 14px;background:var(--toast-bg);border-left:4px solid var(--toast-border);color:var(--toast-color);box-shadow:var(--gog-toast-shadow);min-width:var(--gog-toast-min-width);max-width:var(--gog-toast-max-width);pointer-events:all;opacity:0;overflow:hidden;transform:translate3d(var(--toast-enter-x),var(--toast-stack-y),0) scale(var(--toast-stack-scale));transition:opacity .25s ease,transform .25s ease}.gog-toast--visible{opacity:var(--toast-stack-opacity);transform:translate3d(0,var(--toast-stack-y),0) scale(var(--toast-stack-scale))}:host(.slide-left) .gog-toast{--toast-enter-x: calc(var(--gog-toast-enter-distance) * -1)}.gog-toast--success{--toast-border: var(--success-color);--toast-icon-color: var(--success-color)}.gog-toast--error{--toast-border: var(--danger-color);--toast-icon-color: var(--danger-color)}.gog-toast--warning{--toast-border: var(--accent-bright);--toast-icon-color: var(--accent-bright)}.gog-toast--info{--toast-border: var(--accent-color);--toast-icon-color: var(--accent-color)}.gog-toast__icon{color:var(--toast-icon-color);font-size:1rem;line-height:1.4;flex-shrink:0}.gog-toast__icon gog-icon{font-size:1rem}.gog-toast__content{display:flex;align-items:flex-start;gap:10px}.gog-toast__main{display:flex;flex:1;flex-direction:column;gap:8px;min-width:0}.gog-toast__message{flex:1;font-size:var(--text-sm);line-height:1.5}.gog-toast__actions{display:flex;flex-wrap:wrap;gap:6px}.gog-toast__action{--gog-btn-padding: .25rem .5rem;--gog-btn-font-size: .75rem}.gog-toast__action gog-icon{font-size:.75rem}.gog-toast__close{align-self:flex-start;flex-shrink:0;--gog-btn-padding: .125rem .25rem;--gog-btn-font-size: .75rem}.gog-toast__close gog-icon{font-size:.75rem}.gog-toast__progress{position:absolute;right:0;bottom:0;left:0;height:3px;background:color-mix(in srgb,var(--toast-progress-color) 30%,transparent);transform-origin:left center;animation:gog-toast-progress var(--toast-duration) linear forwards}.gog-toast--paused .gog-toast__progress,.gog-toast--queued .gog-toast__progress{animation-play-state:paused}@keyframes gog-toast-progress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}@media(prefers-reduced-motion:reduce){.gog-toast,.gog-toast__progress{transition:none;animation:none}}\n"] }]
|
|
823
|
+
}], ctorParameters: () => [], propDecorators: { toast: [{ type: i0.Input, args: [{ isSignal: true, alias: "toast", required: true }] }], isFront: [{ type: i0.Input, args: [{ isSignal: true, alias: "isFront", required: false }] }], dismissed: [{ type: i0.Output, args: ["dismissed"] }], progressEl: [{ type: i0.ViewChild, args: ['progress', { isSignal: true }] }] } });
|
|
824
|
+
|
|
825
|
+
const DEFAULT_DURATION = 4000;
|
|
826
|
+
const DEFAULT_POSITION = 'bottom-right';
|
|
827
|
+
class ToastService {
|
|
828
|
+
toasts = signal([], ...(ngDevMode ? [{ debugName: "toasts" }] : /* istanbul ignore next */ []));
|
|
829
|
+
generateId() {
|
|
830
|
+
if (typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function') {
|
|
831
|
+
return crypto.randomUUID();
|
|
832
|
+
}
|
|
833
|
+
return Date.now().toString(36) + Math.random().toString(36).slice(2);
|
|
834
|
+
}
|
|
835
|
+
show(config) {
|
|
836
|
+
const type = config.type ?? 'info';
|
|
837
|
+
const iconName = config.iconName ?? this.defaultIconName(type);
|
|
838
|
+
const actions = config.actions ?? [];
|
|
839
|
+
const dedupeKey = config.dedupeKey ??
|
|
840
|
+
this.buildDedupeKey(config.message, type, iconName, config.position ?? DEFAULT_POSITION, actions, config.iconTemplate ?? null);
|
|
841
|
+
let createdId = this.generateId();
|
|
842
|
+
this.toasts.update((list) => {
|
|
843
|
+
let existingIndex = -1;
|
|
844
|
+
if (dedupeKey) {
|
|
845
|
+
for (let index = list.length - 1; index >= 0; index -= 1) {
|
|
846
|
+
if (list[index].dedupeKey === dedupeKey) {
|
|
847
|
+
existingIndex = index;
|
|
848
|
+
break;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
const nextToast = {
|
|
853
|
+
id: existingIndex >= 0 ? list[existingIndex].id : createdId,
|
|
854
|
+
message: config.message,
|
|
855
|
+
type,
|
|
856
|
+
iconName,
|
|
857
|
+
iconTemplate: config.iconTemplate ?? null,
|
|
858
|
+
actions,
|
|
859
|
+
isSticky: config.isSticky ?? false,
|
|
860
|
+
duration: config.duration ?? DEFAULT_DURATION,
|
|
861
|
+
position: config.position ?? DEFAULT_POSITION,
|
|
862
|
+
dedupeKey,
|
|
863
|
+
revision: existingIndex >= 0 ? list[existingIndex].revision + 1 : 0,
|
|
864
|
+
};
|
|
865
|
+
if (existingIndex >= 0) {
|
|
866
|
+
const next = [...list];
|
|
867
|
+
next[existingIndex] = nextToast;
|
|
868
|
+
createdId = nextToast.id;
|
|
869
|
+
return next;
|
|
870
|
+
}
|
|
871
|
+
createdId = nextToast.id;
|
|
872
|
+
return [...list, nextToast];
|
|
873
|
+
});
|
|
874
|
+
return createdId;
|
|
875
|
+
}
|
|
876
|
+
dismiss(id) {
|
|
877
|
+
this.toasts.update((list) => list.filter((t) => t.id !== id));
|
|
878
|
+
}
|
|
879
|
+
dismissAll() {
|
|
880
|
+
this.toasts.set([]);
|
|
881
|
+
}
|
|
882
|
+
success(message, config) {
|
|
883
|
+
return this.show({ ...config, message, type: 'success' });
|
|
884
|
+
}
|
|
885
|
+
error(message, config) {
|
|
886
|
+
return this.show({ ...config, message, type: 'error' });
|
|
887
|
+
}
|
|
888
|
+
warning(message, config) {
|
|
889
|
+
return this.show({ ...config, message, type: 'warning' });
|
|
890
|
+
}
|
|
891
|
+
info(message, config) {
|
|
892
|
+
return this.show({ ...config, message, type: 'info' });
|
|
893
|
+
}
|
|
894
|
+
defaultIconName(type) {
|
|
895
|
+
switch (type) {
|
|
896
|
+
case 'success':
|
|
897
|
+
return 'success';
|
|
898
|
+
case 'error':
|
|
899
|
+
return 'error';
|
|
900
|
+
case 'warning':
|
|
901
|
+
return 'warning';
|
|
902
|
+
default:
|
|
903
|
+
return 'info';
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
buildDedupeKey(message, type, iconName, position, actions, iconTemplate) {
|
|
907
|
+
// Actions carry closures that can't be compared by value, so only their
|
|
908
|
+
// label/icon "shape" is used — this lets repeated calls with equivalent
|
|
909
|
+
// actions (e.g. a fresh "Undo" callback each time) still dedupe correctly.
|
|
910
|
+
const actionsSignature = actions.map((action) => `${action.label}:${action.iconName ?? ''}`).join(',');
|
|
911
|
+
return [message, type, iconName, position, iconTemplate ? 'template' : 'default', actionsSignature].join('|');
|
|
912
|
+
}
|
|
913
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
914
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastService, providedIn: 'root' });
|
|
915
|
+
}
|
|
916
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastService, decorators: [{
|
|
917
|
+
type: Injectable,
|
|
918
|
+
args: [{ providedIn: 'root' }]
|
|
919
|
+
}] });
|
|
920
|
+
|
|
921
|
+
const POSITIONS = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
|
922
|
+
class ToastContainerComponent {
|
|
923
|
+
toastService = inject(ToastService);
|
|
924
|
+
maxVisiblePerPosition = input(5, ...(ngDevMode ? [{ debugName: "maxVisiblePerPosition" }] : /* istanbul ignore next */ []));
|
|
925
|
+
groups = computed(() => POSITIONS.map((position) => ({
|
|
926
|
+
position,
|
|
927
|
+
// Keep the oldest toasts first: they're at the front of the queue (actively ticking),
|
|
928
|
+
// while newer arrivals wait their turn at the back of the visible stack.
|
|
929
|
+
toasts: this.toastService
|
|
930
|
+
.toasts()
|
|
931
|
+
.filter((toast) => toast.position === position)
|
|
932
|
+
.slice(0, Math.max(0, this.maxVisiblePerPosition())),
|
|
933
|
+
})).filter((group) => group.toasts.length > 0), ...(ngDevMode ? [{ debugName: "groups" }] : /* istanbul ignore next */ []));
|
|
934
|
+
trackGroup(_, group) {
|
|
935
|
+
return group.position;
|
|
936
|
+
}
|
|
937
|
+
isLeft(position) {
|
|
938
|
+
return position.includes('left');
|
|
939
|
+
}
|
|
940
|
+
trackToast(_, toast) {
|
|
941
|
+
return toast.id;
|
|
942
|
+
}
|
|
943
|
+
dismiss(id) {
|
|
944
|
+
this.toastService.dismiss(id);
|
|
945
|
+
}
|
|
946
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
947
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ToastContainerComponent, isStandalone: true, selector: "gog-toast-container", inputs: { maxVisiblePerPosition: { classPropertyName: "maxVisiblePerPosition", publicName: "maxVisiblePerPosition", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@for (group of groups(); track trackGroup($index, group)) {\n <div class=\"gog-toast-container gog-toast-container--{{ group.position }}\">\n @for (toast of group.toasts; track trackToast($index, toast); let toastIndex = $index) {\n <gog-toast\n [toast]=\"toast\"\n [isFront]=\"toastIndex === 0\"\n [class.slide-left]=\"isLeft(group.position)\"\n [style.--toast-stack-index]=\"toastIndex\"\n (dismissed)=\"dismiss($event)\"\n />\n }\n </div>\n}\n", styles: [":host{display:contents}.gog-toast-container{position:fixed;z-index:var(--gog-toast-z-index);display:grid;padding:var(--gog-toast-stack-padding);pointer-events:none;max-width:var(--gog-toast-max-width)}.gog-toast-container>gog-toast{grid-column:1;grid-row:1}.gog-toast-container--top-right{top:0;right:0;justify-items:end}.gog-toast-container--top-left{top:0;left:0;justify-items:start}.gog-toast-container--bottom-right{bottom:0;right:0;justify-items:end}.gog-toast-container--bottom-left{bottom:0;left:0;justify-items:start}.gog-toast-container--top-left,.gog-toast-container--top-right{align-items:start;--toast-stack-direction: 1}.gog-toast-container--bottom-left,.gog-toast-container--bottom-right{align-items:end;--toast-stack-direction: -1}.gog-toast-container:hover{--toast-stack-expanded: 1}\n"], dependencies: [{ kind: "component", type: ToastComponent, selector: "gog-toast", inputs: ["toast", "isFront"], outputs: ["dismissed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
948
|
+
}
|
|
949
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ToastContainerComponent, decorators: [{
|
|
950
|
+
type: Component,
|
|
951
|
+
args: [{ selector: 'gog-toast-container', imports: [ToastComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "@for (group of groups(); track trackGroup($index, group)) {\n <div class=\"gog-toast-container gog-toast-container--{{ group.position }}\">\n @for (toast of group.toasts; track trackToast($index, toast); let toastIndex = $index) {\n <gog-toast\n [toast]=\"toast\"\n [isFront]=\"toastIndex === 0\"\n [class.slide-left]=\"isLeft(group.position)\"\n [style.--toast-stack-index]=\"toastIndex\"\n (dismissed)=\"dismiss($event)\"\n />\n }\n </div>\n}\n", styles: [":host{display:contents}.gog-toast-container{position:fixed;z-index:var(--gog-toast-z-index);display:grid;padding:var(--gog-toast-stack-padding);pointer-events:none;max-width:var(--gog-toast-max-width)}.gog-toast-container>gog-toast{grid-column:1;grid-row:1}.gog-toast-container--top-right{top:0;right:0;justify-items:end}.gog-toast-container--top-left{top:0;left:0;justify-items:start}.gog-toast-container--bottom-right{bottom:0;right:0;justify-items:end}.gog-toast-container--bottom-left{bottom:0;left:0;justify-items:start}.gog-toast-container--top-left,.gog-toast-container--top-right{align-items:start;--toast-stack-direction: 1}.gog-toast-container--bottom-left,.gog-toast-container--bottom-right{align-items:end;--toast-stack-direction: -1}.gog-toast-container:hover{--toast-stack-expanded: 1}\n"] }]
|
|
952
|
+
}], propDecorators: { maxVisiblePerPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisiblePerPosition", required: false }] }] } });
|
|
953
|
+
|
|
954
|
+
class InputfieldComponent {
|
|
955
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
956
|
+
placeholder = input('', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
957
|
+
type = input('text', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
958
|
+
/** Defaults to 'current-password' for password fields, 'off' otherwise */
|
|
959
|
+
autocomplete = input('', ...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
960
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
961
|
+
name = input('', ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
962
|
+
inputId = input('', ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
963
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
964
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
965
|
+
/** Default icon name for the leading icon. */
|
|
966
|
+
iconStart = input('', ...(ngDevMode ? [{ debugName: "iconStart" }] : /* istanbul ignore next */ []));
|
|
967
|
+
/** Default icon name for the trailing icon. */
|
|
968
|
+
iconEnd = input('', ...(ngDevMode ? [{ debugName: "iconEnd" }] : /* istanbul ignore next */ []));
|
|
969
|
+
/** Custom leading icon template. */
|
|
970
|
+
iconStartTemplate = input(null, ...(ngDevMode ? [{ debugName: "iconStartTemplate" }] : /* istanbul ignore next */ []));
|
|
971
|
+
/** Custom trailing icon template. */
|
|
972
|
+
iconEndTemplate = input(null, ...(ngDevMode ? [{ debugName: "iconEndTemplate" }] : /* istanbul ignore next */ []));
|
|
973
|
+
/** When provided, the start icon becomes a clickable button invoking this fn */
|
|
974
|
+
iconStartFn = input(null, ...(ngDevMode ? [{ debugName: "iconStartFn" }] : /* istanbul ignore next */ []));
|
|
975
|
+
/** When provided, the end icon becomes a clickable button invoking this fn */
|
|
976
|
+
iconEndFn = input(null, ...(ngDevMode ? [{ debugName: "iconEndFn" }] : /* istanbul ignore next */ []));
|
|
977
|
+
/** aria-label for the start icon button (required when iconStartFn is set) */
|
|
978
|
+
iconStartLabel = input('', ...(ngDevMode ? [{ debugName: "iconStartLabel" }] : /* istanbul ignore next */ []));
|
|
979
|
+
/** aria-label for the end icon button (required when iconEndFn is set) */
|
|
980
|
+
iconEndLabel = input('', ...(ngDevMode ? [{ debugName: "iconEndLabel" }] : /* istanbul ignore next */ []));
|
|
981
|
+
/** Two-way bindable value: `[(value)]="signal"` or `[value]` / `(valueChange)`. */
|
|
982
|
+
value = model('', ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
983
|
+
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
984
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
985
|
+
effectiveAutocomplete = computed(() => this.autocomplete() || (this.type() === 'password' ? 'current-password' : 'off'), ...(ngDevMode ? [{ debugName: "effectiveAutocomplete" }] : /* istanbul ignore next */ []));
|
|
986
|
+
hasError = computed(() => !!this.errorMessage() && !this.value(), ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
987
|
+
hasIconStart = computed(() => !!this.iconStartTemplate() || !!this.iconStart(), ...(ngDevMode ? [{ debugName: "hasIconStart" }] : /* istanbul ignore next */ []));
|
|
988
|
+
hasIconEnd = computed(() => !!this.iconEndTemplate() || !!this.iconEnd(), ...(ngDevMode ? [{ debugName: "hasIconEnd" }] : /* istanbul ignore next */ []));
|
|
989
|
+
hasIconStartAction = computed(() => !!this.iconStartFn(), ...(ngDevMode ? [{ debugName: "hasIconStartAction" }] : /* istanbul ignore next */ []));
|
|
990
|
+
hasIconEndAction = computed(() => !!this.iconEndFn(), ...(ngDevMode ? [{ debugName: "hasIconEndAction" }] : /* istanbul ignore next */ []));
|
|
991
|
+
_onChange = () => { };
|
|
992
|
+
_onTouched = () => { };
|
|
993
|
+
writeValue(val) {
|
|
994
|
+
this.value.set(val ?? '');
|
|
995
|
+
}
|
|
996
|
+
registerOnChange(fn) {
|
|
997
|
+
this._onChange = fn;
|
|
998
|
+
}
|
|
999
|
+
registerOnTouched(fn) {
|
|
1000
|
+
this._onTouched = fn;
|
|
1001
|
+
}
|
|
1002
|
+
setDisabledState(isDisabled) {
|
|
1003
|
+
this.cvaDisabled.set(isDisabled);
|
|
1004
|
+
}
|
|
1005
|
+
onIconStartClick() {
|
|
1006
|
+
this.iconStartFn()?.();
|
|
1007
|
+
}
|
|
1008
|
+
onIconEndClick() {
|
|
1009
|
+
this.iconEndFn()?.();
|
|
1010
|
+
}
|
|
1011
|
+
onInput(event) {
|
|
1012
|
+
const input = event.target;
|
|
1013
|
+
this.value.set(input.value);
|
|
1014
|
+
this._onChange(input.value);
|
|
1015
|
+
}
|
|
1016
|
+
onBlur() {
|
|
1017
|
+
this._onTouched();
|
|
1018
|
+
}
|
|
1019
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: InputfieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1020
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: InputfieldComponent, isStandalone: true, selector: "gog-inputfield", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, iconStart: { classPropertyName: "iconStart", publicName: "iconStart", isSignal: true, isRequired: false, transformFunction: null }, iconEnd: { classPropertyName: "iconEnd", publicName: "iconEnd", isSignal: true, isRequired: false, transformFunction: null }, iconStartTemplate: { classPropertyName: "iconStartTemplate", publicName: "iconStartTemplate", isSignal: true, isRequired: false, transformFunction: null }, iconEndTemplate: { classPropertyName: "iconEndTemplate", publicName: "iconEndTemplate", isSignal: true, isRequired: false, transformFunction: null }, iconStartFn: { classPropertyName: "iconStartFn", publicName: "iconStartFn", isSignal: true, isRequired: false, transformFunction: null }, iconEndFn: { classPropertyName: "iconEndFn", publicName: "iconEndFn", isSignal: true, isRequired: false, transformFunction: null }, iconStartLabel: { classPropertyName: "iconStartLabel", publicName: "iconStartLabel", isSignal: true, isRequired: false, transformFunction: null }, iconEndLabel: { classPropertyName: "iconEndLabel", publicName: "iconEndLabel", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [
|
|
1021
|
+
{
|
|
1022
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1023
|
+
useExisting: forwardRef(() => InputfieldComponent),
|
|
1024
|
+
multi: true,
|
|
1025
|
+
},
|
|
1026
|
+
], ngImport: i0, template: "<div\n class=\"gog-input-wrapper gog-contained-layout\"\n [class.gog-input-wrapper--sm]=\"size() === 'sm'\"\n [class.gog-input-wrapper--lg]=\"size() === 'lg'\"\n [class.gog-input-wrapper--icon-start]=\"hasIconStart()\"\n [class.gog-input-wrapper--icon-end]=\"hasIconEnd()\"\n>\n @if (label()) {\n <label class=\"gog-input__label font-heading\" [attr.for]=\"inputId() || null\">{{\n label()\n }}</label>\n }\n <div class=\"gog-input__field-container\">\n @if (hasIconStart()) {\n @if (hasIconStartAction()) {\n <button\n type=\"button\"\n class=\"gog-input__icon gog-inline-center gog-input__icon--start gog-input__icon--action\"\n [attr.aria-label]=\"iconStartLabel() || null\"\n (click)=\"onIconStartClick()\"\n >\n <gog-icon [template]=\"iconStartTemplate()\" [name]=\"iconStart() || 'check'\" />\n </button>\n } @else {\n <span class=\"gog-input__icon gog-inline-center gog-input__icon--start\" aria-hidden=\"true\">\n <gog-icon [template]=\"iconStartTemplate()\" [name]=\"iconStart() || 'check'\" />\n </span>\n }\n }\n <input\n class=\"gog-input__field font-body\"\n [class.gog-input__field--error]=\"hasError()\"\n [attr.id]=\"inputId() || null\"\n [type]=\"type()\"\n [attr.name]=\"name() || null\"\n [placeholder]=\"placeholder()\"\n [value]=\"value()\"\n [disabled]=\"isDisabled()\"\n [autocomplete]=\"effectiveAutocomplete()\"\n [attr.aria-invalid]=\"hasError()\"\n [attr.aria-describedby]=\"hasError() && inputId() ? inputId() + '-error' : null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (hasIconEnd()) {\n @if (hasIconEndAction()) {\n <button\n type=\"button\"\n class=\"gog-input__icon gog-inline-center gog-input__icon--end gog-input__icon--action\"\n [attr.aria-label]=\"iconEndLabel() || null\"\n (click)=\"onIconEndClick()\"\n >\n <gog-icon [template]=\"iconEndTemplate()\" [name]=\"iconEnd() || 'check'\" />\n </button>\n } @else {\n <span class=\"gog-input__icon gog-inline-center gog-input__icon--end\" aria-hidden=\"true\">\n <gog-icon [template]=\"iconEndTemplate()\" [name]=\"iconEnd() || 'check'\" />\n </span>\n }\n }\n </div>\n @if (hasError() && errorMessage()) {\n <span\n class=\"gog-input__error font-body\"\n [attr.id]=\"inputId() ? inputId() + '-error' : null\"\n role=\"alert\"\n >{{ errorMessage() }}</span\n >\n }\n</div>\n", styles: ["@charset \"UTF-8\";.gog-input-wrapper{--gog-input-gap: 4px;--gog-input-label-color: var(--accent-color);--gog-input-field-bg: var(--surface-color);--gog-input-field-border: var(--accent-dim);--gog-input-field-color: var(--text-color);--gog-input-placeholder-color: var(--muted-text-color);--gog-input-focus-border: var(--accent-color);--gog-input-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-input-error-color: var(--danger-color);--gog-input-icon-color: var(--muted-text-color);--gog-input-icon-hover-color: var(--accent-color);display:flex;flex-direction:column;gap:var(--gog-input-gap);width:100%}.gog-input__label{font-size:var(--text-sm);color:var(--gog-input-label-color);text-transform:uppercase;letter-spacing:1px}.gog-input__field-container{position:relative;display:flex;align-items:center}.gog-input__field{--gog-input-padding-y: var(--control-padding-y, 10px);--gog-input-pl: var(--control-padding-x, 14px);--gog-input-pr: var(--control-padding-x, 14px);--gog-input-font: var(--text-md);width:100%;padding:var(--gog-input-padding-y) var(--gog-input-pr) var(--gog-input-padding-y) var(--gog-input-pl);font-size:var(--gog-input-font);color:var(--gog-input-field-color);background-color:var(--gog-input-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-input-field-border);border-radius:var(--radius);outline:none;transition:border-color .15s ease,box-shadow .15s ease}.gog-input-wrapper--sm .gog-input__field{--gog-input-padding-y: 6px;--gog-input-pl: 10px;--gog-input-pr: 10px;--gog-input-font: var(--text-sm)}.gog-input-wrapper--lg .gog-input__field{--gog-input-padding-y: 14px;--gog-input-pl: 18px;--gog-input-pr: 18px;--gog-input-font: var(--text-lg)}.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 36px}.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 36px}.gog-input-wrapper--sm.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 30px}.gog-input-wrapper--sm.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 30px}.gog-input-wrapper--lg.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 44px}.gog-input-wrapper--lg.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 44px}.gog-input__field::placeholder{color:var(--gog-input-placeholder-color)}.gog-input__field:focus{border-color:var(--gog-input-focus-border);box-shadow:0 0 8px var(--gog-input-focus-ring)}.gog-input__field:focus-visible{outline:3px solid var(--gog-input-focus-border);outline-offset:2px}.gog-input__field:disabled{opacity:.4;cursor:not-allowed}.gog-input__field--error{border-color:var(--gog-input-error-color)}.gog-input__icon{position:absolute;color:var(--gog-input-icon-color);font-size:var(--text-md);pointer-events:none;line-height:1}.gog-input__icon--action{padding:0;background:none;border:none;cursor:pointer;pointer-events:auto;border-radius:var(--gog-input-icon-action-radius, 4px);color:var(--gog-input-icon-color);transition:color .15s ease}.gog-input__icon--action:hover{color:var(--gog-input-icon-hover-color)}.gog-input__icon--action:focus-visible{outline:2px solid var(--gog-input-icon-hover-color);outline-offset:2px}.gog-input__icon--start{left:var(--control-icon-offset, 10px)}.gog-input__icon--end{right:var(--control-icon-offset, 10px)}.gog-input-wrapper--sm .gog-input__icon{font-size:var(--text-sm)}.gog-input-wrapper--sm .gog-input__icon--start{left:8px}.gog-input-wrapper--sm .gog-input__icon--end{right:8px}.gog-input-wrapper--lg .gog-input__icon{font-size:var(--text-lg)}.gog-input-wrapper--lg .gog-input__icon--start{left:14px}.gog-input-wrapper--lg .gog-input__icon--end{right:14px}.gog-input__error{font-size:var(--text-xs, 12px);color:var(--gog-input-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-input__field{transition:none}}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1027
|
+
}
|
|
1028
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: InputfieldComponent, decorators: [{
|
|
1029
|
+
type: Component,
|
|
1030
|
+
args: [{ selector: 'gog-inputfield', imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1031
|
+
{
|
|
1032
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1033
|
+
useExisting: forwardRef(() => InputfieldComponent),
|
|
1034
|
+
multi: true,
|
|
1035
|
+
},
|
|
1036
|
+
], template: "<div\n class=\"gog-input-wrapper gog-contained-layout\"\n [class.gog-input-wrapper--sm]=\"size() === 'sm'\"\n [class.gog-input-wrapper--lg]=\"size() === 'lg'\"\n [class.gog-input-wrapper--icon-start]=\"hasIconStart()\"\n [class.gog-input-wrapper--icon-end]=\"hasIconEnd()\"\n>\n @if (label()) {\n <label class=\"gog-input__label font-heading\" [attr.for]=\"inputId() || null\">{{\n label()\n }}</label>\n }\n <div class=\"gog-input__field-container\">\n @if (hasIconStart()) {\n @if (hasIconStartAction()) {\n <button\n type=\"button\"\n class=\"gog-input__icon gog-inline-center gog-input__icon--start gog-input__icon--action\"\n [attr.aria-label]=\"iconStartLabel() || null\"\n (click)=\"onIconStartClick()\"\n >\n <gog-icon [template]=\"iconStartTemplate()\" [name]=\"iconStart() || 'check'\" />\n </button>\n } @else {\n <span class=\"gog-input__icon gog-inline-center gog-input__icon--start\" aria-hidden=\"true\">\n <gog-icon [template]=\"iconStartTemplate()\" [name]=\"iconStart() || 'check'\" />\n </span>\n }\n }\n <input\n class=\"gog-input__field font-body\"\n [class.gog-input__field--error]=\"hasError()\"\n [attr.id]=\"inputId() || null\"\n [type]=\"type()\"\n [attr.name]=\"name() || null\"\n [placeholder]=\"placeholder()\"\n [value]=\"value()\"\n [disabled]=\"isDisabled()\"\n [autocomplete]=\"effectiveAutocomplete()\"\n [attr.aria-invalid]=\"hasError()\"\n [attr.aria-describedby]=\"hasError() && inputId() ? inputId() + '-error' : null\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n @if (hasIconEnd()) {\n @if (hasIconEndAction()) {\n <button\n type=\"button\"\n class=\"gog-input__icon gog-inline-center gog-input__icon--end gog-input__icon--action\"\n [attr.aria-label]=\"iconEndLabel() || null\"\n (click)=\"onIconEndClick()\"\n >\n <gog-icon [template]=\"iconEndTemplate()\" [name]=\"iconEnd() || 'check'\" />\n </button>\n } @else {\n <span class=\"gog-input__icon gog-inline-center gog-input__icon--end\" aria-hidden=\"true\">\n <gog-icon [template]=\"iconEndTemplate()\" [name]=\"iconEnd() || 'check'\" />\n </span>\n }\n }\n </div>\n @if (hasError() && errorMessage()) {\n <span\n class=\"gog-input__error font-body\"\n [attr.id]=\"inputId() ? inputId() + '-error' : null\"\n role=\"alert\"\n >{{ errorMessage() }}</span\n >\n }\n</div>\n", styles: ["@charset \"UTF-8\";.gog-input-wrapper{--gog-input-gap: 4px;--gog-input-label-color: var(--accent-color);--gog-input-field-bg: var(--surface-color);--gog-input-field-border: var(--accent-dim);--gog-input-field-color: var(--text-color);--gog-input-placeholder-color: var(--muted-text-color);--gog-input-focus-border: var(--accent-color);--gog-input-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-input-error-color: var(--danger-color);--gog-input-icon-color: var(--muted-text-color);--gog-input-icon-hover-color: var(--accent-color);display:flex;flex-direction:column;gap:var(--gog-input-gap);width:100%}.gog-input__label{font-size:var(--text-sm);color:var(--gog-input-label-color);text-transform:uppercase;letter-spacing:1px}.gog-input__field-container{position:relative;display:flex;align-items:center}.gog-input__field{--gog-input-padding-y: var(--control-padding-y, 10px);--gog-input-pl: var(--control-padding-x, 14px);--gog-input-pr: var(--control-padding-x, 14px);--gog-input-font: var(--text-md);width:100%;padding:var(--gog-input-padding-y) var(--gog-input-pr) var(--gog-input-padding-y) var(--gog-input-pl);font-size:var(--gog-input-font);color:var(--gog-input-field-color);background-color:var(--gog-input-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-input-field-border);border-radius:var(--radius);outline:none;transition:border-color .15s ease,box-shadow .15s ease}.gog-input-wrapper--sm .gog-input__field{--gog-input-padding-y: 6px;--gog-input-pl: 10px;--gog-input-pr: 10px;--gog-input-font: var(--text-sm)}.gog-input-wrapper--lg .gog-input__field{--gog-input-padding-y: 14px;--gog-input-pl: 18px;--gog-input-pr: 18px;--gog-input-font: var(--text-lg)}.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 36px}.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 36px}.gog-input-wrapper--sm.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 30px}.gog-input-wrapper--sm.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 30px}.gog-input-wrapper--lg.gog-input-wrapper--icon-start .gog-input__field{--gog-input-pl: 44px}.gog-input-wrapper--lg.gog-input-wrapper--icon-end .gog-input__field{--gog-input-pr: 44px}.gog-input__field::placeholder{color:var(--gog-input-placeholder-color)}.gog-input__field:focus{border-color:var(--gog-input-focus-border);box-shadow:0 0 8px var(--gog-input-focus-ring)}.gog-input__field:focus-visible{outline:3px solid var(--gog-input-focus-border);outline-offset:2px}.gog-input__field:disabled{opacity:.4;cursor:not-allowed}.gog-input__field--error{border-color:var(--gog-input-error-color)}.gog-input__icon{position:absolute;color:var(--gog-input-icon-color);font-size:var(--text-md);pointer-events:none;line-height:1}.gog-input__icon--action{padding:0;background:none;border:none;cursor:pointer;pointer-events:auto;border-radius:var(--gog-input-icon-action-radius, 4px);color:var(--gog-input-icon-color);transition:color .15s ease}.gog-input__icon--action:hover{color:var(--gog-input-icon-hover-color)}.gog-input__icon--action:focus-visible{outline:2px solid var(--gog-input-icon-hover-color);outline-offset:2px}.gog-input__icon--start{left:var(--control-icon-offset, 10px)}.gog-input__icon--end{right:var(--control-icon-offset, 10px)}.gog-input-wrapper--sm .gog-input__icon{font-size:var(--text-sm)}.gog-input-wrapper--sm .gog-input__icon--start{left:8px}.gog-input-wrapper--sm .gog-input__icon--end{right:8px}.gog-input-wrapper--lg .gog-input__icon{font-size:var(--text-lg)}.gog-input-wrapper--lg .gog-input__icon--start{left:14px}.gog-input-wrapper--lg .gog-input__icon--end{right:14px}.gog-input__error{font-size:var(--text-xs, 12px);color:var(--gog-input-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-input__field{transition:none}}\n"] }]
|
|
1037
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], iconStart: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconStart", required: false }] }], iconEnd: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconEnd", required: false }] }], iconStartTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconStartTemplate", required: false }] }], iconEndTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconEndTemplate", required: false }] }], iconStartFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconStartFn", required: false }] }], iconEndFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconEndFn", required: false }] }], iconStartLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconStartLabel", required: false }] }], iconEndLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconEndLabel", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1038
|
+
|
|
1039
|
+
class ChipComponent {
|
|
1040
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1041
|
+
shape = input('rounded', ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
1042
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1043
|
+
clickable = input(true, ...(ngDevMode ? [{ debugName: "clickable" }] : /* istanbul ignore next */ []));
|
|
1044
|
+
removable = input(false, ...(ngDevMode ? [{ debugName: "removable" }] : /* istanbul ignore next */ []));
|
|
1045
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1046
|
+
removeAriaLabel = input('Remove chip', ...(ngDevMode ? [{ debugName: "removeAriaLabel" }] : /* istanbul ignore next */ []));
|
|
1047
|
+
avatarUrl = input(null, ...(ngDevMode ? [{ debugName: "avatarUrl" }] : /* istanbul ignore next */ []));
|
|
1048
|
+
avatarAlt = input('', ...(ngDevMode ? [{ debugName: "avatarAlt" }] : /* istanbul ignore next */ []));
|
|
1049
|
+
iconName = input(null, ...(ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []));
|
|
1050
|
+
gogClick = output();
|
|
1051
|
+
gogRemove = output();
|
|
1052
|
+
hostClasses = computed(() => [
|
|
1053
|
+
'gog-chip',
|
|
1054
|
+
`gog-chip--${this.size()}`,
|
|
1055
|
+
`gog-chip--${this.shape()}`,
|
|
1056
|
+
this.removable() ? 'gog-chip--removable' : null,
|
|
1057
|
+
this.disabled() ? 'gog-chip--disabled' : 'gog-chip--interactive',
|
|
1058
|
+
this.avatarUrl() ? 'gog-chip--has-avatar' : null,
|
|
1059
|
+
this.iconName() ? 'gog-chip--has-icon' : null,
|
|
1060
|
+
]
|
|
1061
|
+
.filter((className) => className !== null)
|
|
1062
|
+
.join(' '), ...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
1063
|
+
isInteractive = computed(() => this.clickable() && !this.disabled(), ...(ngDevMode ? [{ debugName: "isInteractive" }] : /* istanbul ignore next */ []));
|
|
1064
|
+
onChipClick(event) {
|
|
1065
|
+
if (this.disabled())
|
|
1066
|
+
return;
|
|
1067
|
+
this.gogClick.emit(event);
|
|
1068
|
+
}
|
|
1069
|
+
onKeydown(event) {
|
|
1070
|
+
if (this.disabled())
|
|
1071
|
+
return;
|
|
1072
|
+
if (event.key !== 'Enter' && event.key !== ' ')
|
|
1073
|
+
return;
|
|
1074
|
+
event.preventDefault();
|
|
1075
|
+
this.gogClick.emit(event);
|
|
1076
|
+
}
|
|
1077
|
+
onRemoveClick(event) {
|
|
1078
|
+
event.stopPropagation();
|
|
1079
|
+
if (this.disabled())
|
|
1080
|
+
return;
|
|
1081
|
+
this.gogRemove.emit();
|
|
1082
|
+
}
|
|
1083
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1084
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: ChipComponent, isStandalone: true, selector: "gog-chip", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, removable: { classPropertyName: "removable", publicName: "removable", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, removeAriaLabel: { classPropertyName: "removeAriaLabel", publicName: "removeAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, avatarUrl: { classPropertyName: "avatarUrl", publicName: "avatarUrl", isSignal: true, isRequired: false, transformFunction: null }, avatarAlt: { classPropertyName: "avatarAlt", publicName: "avatarAlt", isSignal: true, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { gogClick: "gogClick", gogRemove: "gogRemove" }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<div\n class=\"gog-chip__surface\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.role]=\"isInteractive() ? 'button' : null\"\n [attr.tabindex]=\"isInteractive() ? 0 : null\"\n [style.cursor]=\"isInteractive() ? 'pointer' : 'default'\"\n (click)=\"onChipClick($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (avatarUrl()) {\n <img class=\"gog-chip__avatar\" [src]=\"avatarUrl()\" [alt]=\"avatarAlt()\" />\n }\n\n @if (iconName()) {\n <gog-icon class=\"gog-chip__icon\" [ariaHidden]=\"true\" [name]=\"iconName() ?? 'check'\" />\n }\n\n <span class=\"gog-chip__content\">\n <ng-content></ng-content>\n </span>\n\n @if (removable()) {\n <button\n class=\"gog-chip__remove\"\n type=\"button\"\n [attr.aria-label]=\"removeAriaLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gog-icon name=\"close\" />\n </button>\n }\n</div>\n", styles: [":host{display:inline-flex;max-width:100%;contain:layout style}.gog-chip__surface{--gog-chip-bg: color-mix(in srgb, var(--surface-color) 88%, var(--hover-color));--gog-chip-border: var(--border-color);--gog-chip-color: var(--text-color);--gog-chip-font-size: .875rem;--gog-chip-padding-block: .4rem;--gog-chip-padding-inline: .75rem;--gog-chip-gap: .5rem;--gog-chip-radius: max(var(--radius), 2px);--gog-chip-avatar-size: 1.25rem;--gog-chip-icon-size: .875rem;--gog-chip-remove-size: 1rem;--gog-chip-remove-color: var(--muted-text-color);display:inline-flex;align-items:center;gap:var(--gog-chip-gap);box-sizing:border-box;width:fit-content;max-width:100%;overflow:hidden;padding:var(--gog-chip-padding-block) var(--gog-chip-padding-inline);border:1px solid var(--gog-chip-border);border-radius:var(--gog-chip-radius);background-color:var(--gog-chip-bg);color:var(--gog-chip-color);font-size:var(--gog-chip-font-size);font-weight:500;line-height:1.2;white-space:nowrap;-webkit-user-select:none;user-select:none}.gog-chip__surface:focus-visible{outline:2px solid var(--gog-chip-border);outline-offset:2px}.gog-chip__surface:hover:not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hover-color) 45%,var(--surface-color))}.gog-chip__surface[aria-disabled=true]{opacity:.55;pointer-events:none}.gog-chip__content{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;line-height:1.2}.gog-chip__avatar{width:var(--gog-chip-avatar-size);height:var(--gog-chip-avatar-size);border-radius:50%;object-fit:cover;flex-shrink:0}.gog-chip__icon{flex-shrink:0;font-size:var(--gog-chip-icon-size)}.gog-chip__remove{display:inline-grid;place-items:center;width:var(--gog-chip-remove-size);height:var(--gog-chip-remove-size);padding:0;border:0;border-radius:50%;background:transparent;color:var(--gog-chip-remove-color);cursor:pointer;flex-shrink:0}.gog-chip__remove:hover:not(:disabled){color:var(--text-color)}.gog-chip__remove:focus-visible{outline:2px solid var(--gog-chip-border);outline-offset:2px}.gog-chip__remove:disabled{cursor:default}:host(.gog-chip--sm) .gog-chip__surface{--gog-chip-font-size: .75rem;--gog-chip-padding-block: .3rem;--gog-chip-padding-inline: .5rem;--gog-chip-gap: .375rem;--gog-chip-avatar-size: 1rem;--gog-chip-icon-size: .75rem;--gog-chip-remove-size: .875rem}:host(.gog-chip--md) .gog-chip__surface{--gog-chip-font-size: .875rem;--gog-chip-padding-block: .45rem;--gog-chip-padding-inline: .75rem;--gog-chip-gap: .5rem;--gog-chip-avatar-size: 1.25rem;--gog-chip-icon-size: .875rem;--gog-chip-remove-size: 1rem}:host(.gog-chip--lg) .gog-chip__surface{--gog-chip-font-size: 1rem;--gog-chip-padding-block: .6rem;--gog-chip-padding-inline: .875rem;--gog-chip-gap: .625rem;--gog-chip-avatar-size: 1.5rem;--gog-chip-icon-size: 1rem;--gog-chip-remove-size: 1.125rem}:host(.gog-chip--pill) .gog-chip__surface{--gog-chip-radius: 9999px}:host(.gog-chip--rounded) .gog-chip__surface{--gog-chip-radius: max(var(--radius), 2px)}:host(.gog-chip--has-avatar) .gog-chip__surface{padding-left:calc(var(--gog-chip-padding-inline) * .9)}:host(.gog-chip--removable) .gog-chip__surface{padding-right:calc(var(--gog-chip-padding-inline) * .85)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1085
|
+
}
|
|
1086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ChipComponent, decorators: [{
|
|
1087
|
+
type: Component,
|
|
1088
|
+
args: [{ selector: 'gog-chip', imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1089
|
+
'[class]': 'hostClasses()',
|
|
1090
|
+
}, template: "<div\n class=\"gog-chip__surface\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-disabled]=\"disabled() ? 'true' : null\"\n [attr.role]=\"isInteractive() ? 'button' : null\"\n [attr.tabindex]=\"isInteractive() ? 0 : null\"\n [style.cursor]=\"isInteractive() ? 'pointer' : 'default'\"\n (click)=\"onChipClick($event)\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (avatarUrl()) {\n <img class=\"gog-chip__avatar\" [src]=\"avatarUrl()\" [alt]=\"avatarAlt()\" />\n }\n\n @if (iconName()) {\n <gog-icon class=\"gog-chip__icon\" [ariaHidden]=\"true\" [name]=\"iconName() ?? 'check'\" />\n }\n\n <span class=\"gog-chip__content\">\n <ng-content></ng-content>\n </span>\n\n @if (removable()) {\n <button\n class=\"gog-chip__remove\"\n type=\"button\"\n [attr.aria-label]=\"removeAriaLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"onRemoveClick($event)\"\n >\n <gog-icon name=\"close\" />\n </button>\n }\n</div>\n", styles: [":host{display:inline-flex;max-width:100%;contain:layout style}.gog-chip__surface{--gog-chip-bg: color-mix(in srgb, var(--surface-color) 88%, var(--hover-color));--gog-chip-border: var(--border-color);--gog-chip-color: var(--text-color);--gog-chip-font-size: .875rem;--gog-chip-padding-block: .4rem;--gog-chip-padding-inline: .75rem;--gog-chip-gap: .5rem;--gog-chip-radius: max(var(--radius), 2px);--gog-chip-avatar-size: 1.25rem;--gog-chip-icon-size: .875rem;--gog-chip-remove-size: 1rem;--gog-chip-remove-color: var(--muted-text-color);display:inline-flex;align-items:center;gap:var(--gog-chip-gap);box-sizing:border-box;width:fit-content;max-width:100%;overflow:hidden;padding:var(--gog-chip-padding-block) var(--gog-chip-padding-inline);border:1px solid var(--gog-chip-border);border-radius:var(--gog-chip-radius);background-color:var(--gog-chip-bg);color:var(--gog-chip-color);font-size:var(--gog-chip-font-size);font-weight:500;line-height:1.2;white-space:nowrap;-webkit-user-select:none;user-select:none}.gog-chip__surface:focus-visible{outline:2px solid var(--gog-chip-border);outline-offset:2px}.gog-chip__surface:hover:not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hover-color) 45%,var(--surface-color))}.gog-chip__surface[aria-disabled=true]{opacity:.55;pointer-events:none}.gog-chip__content{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;line-height:1.2}.gog-chip__avatar{width:var(--gog-chip-avatar-size);height:var(--gog-chip-avatar-size);border-radius:50%;object-fit:cover;flex-shrink:0}.gog-chip__icon{flex-shrink:0;font-size:var(--gog-chip-icon-size)}.gog-chip__remove{display:inline-grid;place-items:center;width:var(--gog-chip-remove-size);height:var(--gog-chip-remove-size);padding:0;border:0;border-radius:50%;background:transparent;color:var(--gog-chip-remove-color);cursor:pointer;flex-shrink:0}.gog-chip__remove:hover:not(:disabled){color:var(--text-color)}.gog-chip__remove:focus-visible{outline:2px solid var(--gog-chip-border);outline-offset:2px}.gog-chip__remove:disabled{cursor:default}:host(.gog-chip--sm) .gog-chip__surface{--gog-chip-font-size: .75rem;--gog-chip-padding-block: .3rem;--gog-chip-padding-inline: .5rem;--gog-chip-gap: .375rem;--gog-chip-avatar-size: 1rem;--gog-chip-icon-size: .75rem;--gog-chip-remove-size: .875rem}:host(.gog-chip--md) .gog-chip__surface{--gog-chip-font-size: .875rem;--gog-chip-padding-block: .45rem;--gog-chip-padding-inline: .75rem;--gog-chip-gap: .5rem;--gog-chip-avatar-size: 1.25rem;--gog-chip-icon-size: .875rem;--gog-chip-remove-size: 1rem}:host(.gog-chip--lg) .gog-chip__surface{--gog-chip-font-size: 1rem;--gog-chip-padding-block: .6rem;--gog-chip-padding-inline: .875rem;--gog-chip-gap: .625rem;--gog-chip-avatar-size: 1.5rem;--gog-chip-icon-size: 1rem;--gog-chip-remove-size: 1.125rem}:host(.gog-chip--pill) .gog-chip__surface{--gog-chip-radius: 9999px}:host(.gog-chip--rounded) .gog-chip__surface{--gog-chip-radius: max(var(--radius), 2px)}:host(.gog-chip--has-avatar) .gog-chip__surface{padding-left:calc(var(--gog-chip-padding-inline) * .9)}:host(.gog-chip--removable) .gog-chip__surface{padding-right:calc(var(--gog-chip-padding-inline) * .85)}\n"] }]
|
|
1091
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clickable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clickable", required: false }] }], removable: [{ type: i0.Input, args: [{ isSignal: true, alias: "removable", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], removeAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "removeAriaLabel", required: false }] }], avatarUrl: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarUrl", required: false }] }], avatarAlt: [{ type: i0.Input, args: [{ isSignal: true, alias: "avatarAlt", required: false }] }], iconName: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconName", required: false }] }], gogClick: [{ type: i0.Output, args: ["gogClick"] }], gogRemove: [{ type: i0.Output, args: ["gogRemove"] }] } });
|
|
1092
|
+
|
|
1093
|
+
class TagComponent {
|
|
1094
|
+
variant = input('info', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
1095
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1096
|
+
shape = input('rounded', ...(ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []));
|
|
1097
|
+
iconName = input(null, ...(ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []));
|
|
1098
|
+
iconTemplate = input(null, ...(ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []));
|
|
1099
|
+
hasIcon = computed(() => this.iconTemplate() !== null || this.iconName() !== null, ...(ngDevMode ? [{ debugName: "hasIcon" }] : /* istanbul ignore next */ []));
|
|
1100
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TagComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1101
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TagComponent, isStandalone: true, selector: "gog-tag", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, shape: { classPropertyName: "shape", publicName: "shape", isSignal: true, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null }, iconTemplate: { classPropertyName: "iconTemplate", publicName: "iconTemplate", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "\"gog-tag gog-tag--\" + variant() + \" gog-tag--\" + size() + \" gog-tag--\" + shape() + (hasIcon() ? \" gog-tag--has-icon\" : \"\")" } }, ngImport: i0, template: "@if (hasIcon()) {\n <gog-icon\n class=\"gog-tag__icon\"\n [ariaHidden]=\"true\"\n [name]=\"iconName() ?? 'info'\"\n [template]=\"iconTemplate()\"\n />\n}\n\n<span class=\"gog-tag__content\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{--gog-tag-variant-color: var(--info-color, var(--muted-text-color));--gog-tag-bg: color-mix(in srgb, var(--gog-tag-variant-color) 10%, var(--surface-color));--gog-tag-border: var(--gog-tag-variant-color);--gog-tag-color: color-mix(in srgb, var(--gog-tag-variant-color) 82%, black);--gog-tag-font-size: .875rem;--gog-tag-padding-block: .375rem;--gog-tag-padding-inline: .75rem;--gog-tag-gap: .375rem;--gog-tag-radius: max(var(--radius), 2px);--gog-tag-icon-size: .875rem;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:fit-content;max-width:100%;padding:var(--gog-tag-padding-block) var(--gog-tag-padding-inline);border:1px solid var(--gog-tag-border);border-radius:var(--gog-tag-radius);background-color:var(--gog-tag-bg);box-shadow:inset 0 0 0 1px var(--gog-tag-border);color:var(--gog-tag-color);font-size:var(--gog-tag-font-size);font-weight:600;line-height:1;white-space:nowrap;gap:var(--gog-tag-gap)}:host(.gog-tag--success){--gog-tag-variant-color: var(--success-color)}:host(.gog-tag--danger){--gog-tag-variant-color: var(--danger-color)}:host(.gog-tag--warning){--gog-tag-variant-color: var(--warning-color)}:host(.gog-tag--info){--gog-tag-variant-color: var(--info-color)}:host(.gog-tag--sm){--gog-tag-font-size: .75rem;--gog-tag-padding-block: .25rem;--gog-tag-padding-inline: .5rem;--gog-tag-gap: .25rem;--gog-tag-icon-size: .75rem}:host(.gog-tag--md){--gog-tag-font-size: .875rem;--gog-tag-padding-block: .375rem;--gog-tag-padding-inline: .75rem;--gog-tag-gap: .375rem;--gog-tag-icon-size: .875rem}:host(.gog-tag--lg){--gog-tag-font-size: 1rem;--gog-tag-padding-block: .5rem;--gog-tag-padding-inline: .875rem;--gog-tag-gap: .5rem;--gog-tag-icon-size: 1rem}:host(.gog-tag--rounded){--gog-tag-radius: max(var(--radius), 2px)}:host(.gog-tag--pill){--gog-tag-radius: var(--gog-tag-pill-radius, 9999px)}.gog-tag__content{min-width:0}.gog-tag__icon{flex-shrink:0;font-size:var(--gog-tag-icon-size)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1102
|
+
}
|
|
1103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TagComponent, decorators: [{
|
|
1104
|
+
type: Component,
|
|
1105
|
+
args: [{ selector: 'gog-tag', imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1106
|
+
'[class]': '"gog-tag gog-tag--" + variant() + " gog-tag--" + size() + " gog-tag--" + shape() + (hasIcon() ? " gog-tag--has-icon" : "")',
|
|
1107
|
+
}, template: "@if (hasIcon()) {\n <gog-icon\n class=\"gog-tag__icon\"\n [ariaHidden]=\"true\"\n [name]=\"iconName() ?? 'info'\"\n [template]=\"iconTemplate()\"\n />\n}\n\n<span class=\"gog-tag__content\">\n <ng-content></ng-content>\n</span>\n", styles: [":host{--gog-tag-variant-color: var(--info-color, var(--muted-text-color));--gog-tag-bg: color-mix(in srgb, var(--gog-tag-variant-color) 10%, var(--surface-color));--gog-tag-border: var(--gog-tag-variant-color);--gog-tag-color: color-mix(in srgb, var(--gog-tag-variant-color) 82%, black);--gog-tag-font-size: .875rem;--gog-tag-padding-block: .375rem;--gog-tag-padding-inline: .75rem;--gog-tag-gap: .375rem;--gog-tag-radius: max(var(--radius), 2px);--gog-tag-icon-size: .875rem;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:fit-content;max-width:100%;padding:var(--gog-tag-padding-block) var(--gog-tag-padding-inline);border:1px solid var(--gog-tag-border);border-radius:var(--gog-tag-radius);background-color:var(--gog-tag-bg);box-shadow:inset 0 0 0 1px var(--gog-tag-border);color:var(--gog-tag-color);font-size:var(--gog-tag-font-size);font-weight:600;line-height:1;white-space:nowrap;gap:var(--gog-tag-gap)}:host(.gog-tag--success){--gog-tag-variant-color: var(--success-color)}:host(.gog-tag--danger){--gog-tag-variant-color: var(--danger-color)}:host(.gog-tag--warning){--gog-tag-variant-color: var(--warning-color)}:host(.gog-tag--info){--gog-tag-variant-color: var(--info-color)}:host(.gog-tag--sm){--gog-tag-font-size: .75rem;--gog-tag-padding-block: .25rem;--gog-tag-padding-inline: .5rem;--gog-tag-gap: .25rem;--gog-tag-icon-size: .75rem}:host(.gog-tag--md){--gog-tag-font-size: .875rem;--gog-tag-padding-block: .375rem;--gog-tag-padding-inline: .75rem;--gog-tag-gap: .375rem;--gog-tag-icon-size: .875rem}:host(.gog-tag--lg){--gog-tag-font-size: 1rem;--gog-tag-padding-block: .5rem;--gog-tag-padding-inline: .875rem;--gog-tag-gap: .5rem;--gog-tag-icon-size: 1rem}:host(.gog-tag--rounded){--gog-tag-radius: max(var(--radius), 2px)}:host(.gog-tag--pill){--gog-tag-radius: var(--gog-tag-pill-radius, 9999px)}.gog-tag__content{min-width:0}.gog-tag__icon{flex-shrink:0;font-size:var(--gog-tag-icon-size)}\n"] }]
|
|
1108
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], shape: [{ type: i0.Input, args: [{ isSignal: true, alias: "shape", required: false }] }], iconName: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconName", required: false }] }], iconTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconTemplate", required: false }] }] } });
|
|
1109
|
+
|
|
1110
|
+
const DEFAULT_GAP = 8;
|
|
1111
|
+
const DEFAULT_VIEWPORT_PADDING = 8;
|
|
1112
|
+
function resolveDropdownDirection(direction, triggerRect, panelHeight, viewportHeight, gap = DEFAULT_GAP, viewportPadding = DEFAULT_VIEWPORT_PADDING) {
|
|
1113
|
+
if (direction !== 'auto') {
|
|
1114
|
+
return direction;
|
|
1115
|
+
}
|
|
1116
|
+
const spaceAbove = Math.max(0, triggerRect.top - gap - viewportPadding);
|
|
1117
|
+
const spaceBelow = Math.max(0, viewportHeight - triggerRect.bottom - gap - viewportPadding);
|
|
1118
|
+
if (spaceBelow >= panelHeight && spaceAbove < panelHeight) {
|
|
1119
|
+
return 'down';
|
|
1120
|
+
}
|
|
1121
|
+
if (spaceAbove >= panelHeight && spaceBelow < panelHeight) {
|
|
1122
|
+
return 'up';
|
|
1123
|
+
}
|
|
1124
|
+
return spaceBelow >= spaceAbove ? 'down' : 'up';
|
|
1125
|
+
}
|
|
1126
|
+
function resolveDropdownPlacement(direction, triggerRect, panelHeight, viewportHeight, gap = DEFAULT_GAP, viewportPadding = DEFAULT_VIEWPORT_PADDING) {
|
|
1127
|
+
const resolvedDirection = resolveDropdownDirection(direction, triggerRect, panelHeight, viewportHeight, gap, viewportPadding);
|
|
1128
|
+
if (resolvedDirection === 'up') {
|
|
1129
|
+
const maxHeight = Math.max(0, triggerRect.top - gap - viewportPadding);
|
|
1130
|
+
const actualHeight = Math.min(panelHeight, maxHeight || panelHeight);
|
|
1131
|
+
return {
|
|
1132
|
+
direction: resolvedDirection,
|
|
1133
|
+
top: Math.max(viewportPadding, triggerRect.top - gap - actualHeight),
|
|
1134
|
+
left: triggerRect.left,
|
|
1135
|
+
width: triggerRect.width,
|
|
1136
|
+
maxHeight,
|
|
1137
|
+
};
|
|
1138
|
+
}
|
|
1139
|
+
const maxHeight = Math.max(0, viewportHeight - triggerRect.bottom - gap - viewportPadding);
|
|
1140
|
+
return {
|
|
1141
|
+
direction: resolvedDirection,
|
|
1142
|
+
top: triggerRect.bottom + gap,
|
|
1143
|
+
left: triggerRect.left,
|
|
1144
|
+
width: triggerRect.width,
|
|
1145
|
+
maxHeight,
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
class GogSelectDropdownPortal {
|
|
1150
|
+
top = 0;
|
|
1151
|
+
left = 0;
|
|
1152
|
+
width = 200;
|
|
1153
|
+
maxHeight = 260;
|
|
1154
|
+
zIndex = 300;
|
|
1155
|
+
listboxId = '';
|
|
1156
|
+
direction = 'down';
|
|
1157
|
+
options = [];
|
|
1158
|
+
selectedValue = null;
|
|
1159
|
+
onSelect = () => { };
|
|
1160
|
+
isSelected(id) {
|
|
1161
|
+
return this.selectedValue === id;
|
|
1162
|
+
}
|
|
1163
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogSelectDropdownPortal, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1164
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: GogSelectDropdownPortal, isStandalone: true, selector: "gog-select-dropdown-portal", ngImport: i0, template: `
|
|
1165
|
+
<div
|
|
1166
|
+
[id]="listboxId"
|
|
1167
|
+
class="gog-select__dropdown gog-select__dropdown--portal"
|
|
1168
|
+
[style.top.px]="top"
|
|
1169
|
+
[style.left.px]="left"
|
|
1170
|
+
[style.width.px]="width"
|
|
1171
|
+
[style.max-height.px]="maxHeight"
|
|
1172
|
+
[style.z-index]="zIndex"
|
|
1173
|
+
role="listbox"
|
|
1174
|
+
>
|
|
1175
|
+
@for (option of options; track option.id) {
|
|
1176
|
+
<button
|
|
1177
|
+
type="button"
|
|
1178
|
+
class="gog-select__option font-body"
|
|
1179
|
+
role="option"
|
|
1180
|
+
[attr.aria-selected]="isSelected(option.id)"
|
|
1181
|
+
[attr.aria-disabled]="option.disabled ?? false"
|
|
1182
|
+
[class.gog-select__option--selected]="isSelected(option.id)"
|
|
1183
|
+
[class.gog-select__option--disabled]="option.disabled ?? false"
|
|
1184
|
+
(click)="onSelect(option, $event)"
|
|
1185
|
+
>
|
|
1186
|
+
<span class="gog-select__option-mark" aria-hidden="true">
|
|
1187
|
+
@if (isSelected(option.id)) {
|
|
1188
|
+
<gog-icon name="check" />
|
|
1189
|
+
}
|
|
1190
|
+
</span>
|
|
1191
|
+
<span class="gog-select__option-label">{{ option.name }}</span>
|
|
1192
|
+
</button>
|
|
1193
|
+
}
|
|
1194
|
+
</div>
|
|
1195
|
+
`, isInline: true, styles: [":host{display:block}.gog-select{--gog-select-gap: 4px;--gog-select-label-color: var(--accent-color);--gog-select-field-bg: var(--surface-color);--gog-select-field-border: var(--accent-dim);--gog-select-field-color: var(--text-color);--gog-select-focus-border: var(--accent-color);--gog-select-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-select-error-color: var(--danger-color);--gog-select-chevron-color: var(--accent-color);--gog-select-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-select-option-selected-color: var(--accent-color);--gog-select-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-select-gap);width:100%}.gog-select--disabled{opacity:var(--gog-select-disabled-opacity)}.gog-select--disabled .gog-select__label,.gog-select--disabled .gog-select__field{cursor:not-allowed}.gog-select__label{font-size:var(--text-sm);color:var(--gog-select-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-select__field{position:relative;cursor:pointer}.gog-select__control{--gog-select-control-padding-y: var(--control-padding-y, 10px);--gog-select-control-padding-x: var(--control-padding-x, 14px);width:100%;min-height:44px;padding:var(--gog-select-control-padding-y) 40px var(--gog-select-control-padding-y) var(--gog-select-control-padding-x);display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:var(--text-md);color:var(--gog-select-field-color);background-color:var(--gog-select-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);outline:none;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.gog-select__control:focus{border-color:var(--gog-select-focus-border);box-shadow:0 0 8px var(--gog-select-focus-ring)}.gog-select__control:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:2px}.gog-select__control:disabled{cursor:not-allowed}.gog-select--open .gog-select__control{border-color:var(--gog-select-focus-border)}.gog-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.gog-select__value--placeholder{color:var(--muted-text-color)}.gog-select__chevron{width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--gog-select-chevron-color);pointer-events:none;flex-shrink:0}.gog-select__chevron gog-icon{font-size:.875rem}.gog-select__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--surface-color);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-select__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-select__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-select__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-select-control-padding-x);border:0;background:transparent;text-align:left;font:inherit;color:var(--text-color);cursor:pointer;transition:background-color .12s ease}.gog-select__option:hover{background-color:var(--gog-select-option-hover-bg)}.gog-select__option--selected{color:var(--gog-select-option-selected-color)}.gog-select__option--disabled{opacity:.5;cursor:not-allowed}.gog-select__option:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:-3px}.gog-select__option-mark{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.gog-select__option-mark gog-icon{font-size:.875rem}.gog-select__error{font-size:var(--text-xs);color:var(--gog-select-error-color)}@media(prefers-reduced-motion:reduce){.gog-select__control,.gog-select__option{transition:none}}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1196
|
+
}
|
|
1197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogSelectDropdownPortal, decorators: [{
|
|
1198
|
+
type: Component,
|
|
1199
|
+
args: [{ selector: 'gog-select-dropdown-portal', imports: [IconComponent], template: `
|
|
1200
|
+
<div
|
|
1201
|
+
[id]="listboxId"
|
|
1202
|
+
class="gog-select__dropdown gog-select__dropdown--portal"
|
|
1203
|
+
[style.top.px]="top"
|
|
1204
|
+
[style.left.px]="left"
|
|
1205
|
+
[style.width.px]="width"
|
|
1206
|
+
[style.max-height.px]="maxHeight"
|
|
1207
|
+
[style.z-index]="zIndex"
|
|
1208
|
+
role="listbox"
|
|
1209
|
+
>
|
|
1210
|
+
@for (option of options; track option.id) {
|
|
1211
|
+
<button
|
|
1212
|
+
type="button"
|
|
1213
|
+
class="gog-select__option font-body"
|
|
1214
|
+
role="option"
|
|
1215
|
+
[attr.aria-selected]="isSelected(option.id)"
|
|
1216
|
+
[attr.aria-disabled]="option.disabled ?? false"
|
|
1217
|
+
[class.gog-select__option--selected]="isSelected(option.id)"
|
|
1218
|
+
[class.gog-select__option--disabled]="option.disabled ?? false"
|
|
1219
|
+
(click)="onSelect(option, $event)"
|
|
1220
|
+
>
|
|
1221
|
+
<span class="gog-select__option-mark" aria-hidden="true">
|
|
1222
|
+
@if (isSelected(option.id)) {
|
|
1223
|
+
<gog-icon name="check" />
|
|
1224
|
+
}
|
|
1225
|
+
</span>
|
|
1226
|
+
<span class="gog-select__option-label">{{ option.name }}</span>
|
|
1227
|
+
</button>
|
|
1228
|
+
}
|
|
1229
|
+
</div>
|
|
1230
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block}.gog-select{--gog-select-gap: 4px;--gog-select-label-color: var(--accent-color);--gog-select-field-bg: var(--surface-color);--gog-select-field-border: var(--accent-dim);--gog-select-field-color: var(--text-color);--gog-select-focus-border: var(--accent-color);--gog-select-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-select-error-color: var(--danger-color);--gog-select-chevron-color: var(--accent-color);--gog-select-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-select-option-selected-color: var(--accent-color);--gog-select-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-select-gap);width:100%}.gog-select--disabled{opacity:var(--gog-select-disabled-opacity)}.gog-select--disabled .gog-select__label,.gog-select--disabled .gog-select__field{cursor:not-allowed}.gog-select__label{font-size:var(--text-sm);color:var(--gog-select-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-select__field{position:relative;cursor:pointer}.gog-select__control{--gog-select-control-padding-y: var(--control-padding-y, 10px);--gog-select-control-padding-x: var(--control-padding-x, 14px);width:100%;min-height:44px;padding:var(--gog-select-control-padding-y) 40px var(--gog-select-control-padding-y) var(--gog-select-control-padding-x);display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:var(--text-md);color:var(--gog-select-field-color);background-color:var(--gog-select-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);outline:none;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.gog-select__control:focus{border-color:var(--gog-select-focus-border);box-shadow:0 0 8px var(--gog-select-focus-ring)}.gog-select__control:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:2px}.gog-select__control:disabled{cursor:not-allowed}.gog-select--open .gog-select__control{border-color:var(--gog-select-focus-border)}.gog-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.gog-select__value--placeholder{color:var(--muted-text-color)}.gog-select__chevron{width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--gog-select-chevron-color);pointer-events:none;flex-shrink:0}.gog-select__chevron gog-icon{font-size:.875rem}.gog-select__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--surface-color);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-select__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-select__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-select__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-select-control-padding-x);border:0;background:transparent;text-align:left;font:inherit;color:var(--text-color);cursor:pointer;transition:background-color .12s ease}.gog-select__option:hover{background-color:var(--gog-select-option-hover-bg)}.gog-select__option--selected{color:var(--gog-select-option-selected-color)}.gog-select__option--disabled{opacity:.5;cursor:not-allowed}.gog-select__option:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:-3px}.gog-select__option-mark{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.gog-select__option-mark gog-icon{font-size:.875rem}.gog-select__error{font-size:var(--text-xs);color:var(--gog-select-error-color)}@media(prefers-reduced-motion:reduce){.gog-select__control,.gog-select__option{transition:none}}\n"] }]
|
|
1231
|
+
}] });
|
|
1232
|
+
class SelectComponent {
|
|
1233
|
+
static nextId = 0;
|
|
1234
|
+
generatedId = `gog-select-${++SelectComponent.nextId}`;
|
|
1235
|
+
generatedListboxId = `gog-select-listbox-${SelectComponent.nextId}`;
|
|
1236
|
+
inputId = input('', ...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
1237
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1238
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1239
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1240
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1241
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
1242
|
+
dropdownDirection = input('auto', ...(ngDevMode ? [{ debugName: "dropdownDirection" }] : /* istanbul ignore next */ []));
|
|
1243
|
+
dropdownZIndex = input(null, ...(ngDevMode ? [{ debugName: "dropdownZIndex" }] : /* istanbul ignore next */ []));
|
|
1244
|
+
appendToBody = input(false, ...(ngDevMode ? [{ debugName: "appendToBody" }] : /* istanbul ignore next */ []));
|
|
1245
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1246
|
+
chevronTemplate = input(null, ...(ngDevMode ? [{ debugName: "chevronTemplate" }] : /* istanbul ignore next */ []));
|
|
1247
|
+
/** Two-way bindable selected value: `[(value)]="signal"`. */
|
|
1248
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1249
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
1250
|
+
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
1251
|
+
dropdownDirectionState = signal('down', ...(ngDevMode ? [{ debugName: "dropdownDirectionState" }] : /* istanbul ignore next */ []));
|
|
1252
|
+
elRef = inject((ElementRef));
|
|
1253
|
+
appRef = inject(ApplicationRef);
|
|
1254
|
+
envInjector = inject(EnvironmentInjector);
|
|
1255
|
+
destroyRef = inject(DestroyRef);
|
|
1256
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
1257
|
+
triggerId = computed(() => this.inputId() || this.generatedId, ...(ngDevMode ? [{ debugName: "triggerId" }] : /* istanbul ignore next */ []));
|
|
1258
|
+
listboxId = computed(() => this.inputId() ? `${this.inputId()}-listbox` : this.generatedListboxId, ...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
1259
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1260
|
+
selectedOption = computed(() => this.options().find((option) => String(option.id) === String(this.value())) ?? null, ...(ngDevMode ? [{ debugName: "selectedOption" }] : /* istanbul ignore next */ []));
|
|
1261
|
+
hasError = computed(() => !!this.errorMessage() && this.value() === null, ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
1262
|
+
errorId = computed(() => (this.hasError() ? `${this.triggerId()}-error` : null), ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
1263
|
+
portalHost = null;
|
|
1264
|
+
portalRef = null;
|
|
1265
|
+
onChange = () => { };
|
|
1266
|
+
onTouched = () => { };
|
|
1267
|
+
constructor() {
|
|
1268
|
+
this.destroyRef.onDestroy(() => this.destroyPortal());
|
|
1269
|
+
}
|
|
1270
|
+
writeValue(val) {
|
|
1271
|
+
this.value.set(val ?? null);
|
|
1272
|
+
}
|
|
1273
|
+
registerOnChange(fn) {
|
|
1274
|
+
this.onChange = fn;
|
|
1275
|
+
}
|
|
1276
|
+
registerOnTouched(fn) {
|
|
1277
|
+
this.onTouched = fn;
|
|
1278
|
+
}
|
|
1279
|
+
setDisabledState(isDisabled) {
|
|
1280
|
+
this.cvaDisabled.set(isDisabled);
|
|
1281
|
+
if (isDisabled) {
|
|
1282
|
+
this.close();
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
toggle() {
|
|
1286
|
+
if (this.isDisabled())
|
|
1287
|
+
return;
|
|
1288
|
+
const next = !this.isOpen();
|
|
1289
|
+
this.isOpen.set(next);
|
|
1290
|
+
if (next) {
|
|
1291
|
+
this.openDropdown();
|
|
1292
|
+
}
|
|
1293
|
+
else {
|
|
1294
|
+
this.destroyPortal();
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
close() {
|
|
1298
|
+
if (!this.isOpen())
|
|
1299
|
+
return;
|
|
1300
|
+
this.isOpen.set(false);
|
|
1301
|
+
this.destroyPortal();
|
|
1302
|
+
}
|
|
1303
|
+
onDocumentClick(event) {
|
|
1304
|
+
if (!this.isOpen())
|
|
1305
|
+
return;
|
|
1306
|
+
const target = event.target;
|
|
1307
|
+
const insideTrigger = target ? this.elRef.nativeElement.contains(target) : false;
|
|
1308
|
+
const insidePortal = target ? this.portalHost?.contains(target) ?? false : false;
|
|
1309
|
+
if (!insideTrigger && !insidePortal) {
|
|
1310
|
+
this.close();
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
onScrollOrResize() {
|
|
1314
|
+
if (!this.isOpen())
|
|
1315
|
+
return;
|
|
1316
|
+
if (this.appendToBody()) {
|
|
1317
|
+
this.updatePortalPosition();
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
this.updateInlineDirection();
|
|
1321
|
+
}
|
|
1322
|
+
selectOption(option, event) {
|
|
1323
|
+
event.preventDefault();
|
|
1324
|
+
event.stopPropagation();
|
|
1325
|
+
if (option.disabled) {
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
this.value.set(option.id);
|
|
1329
|
+
this.onChange(option.id);
|
|
1330
|
+
this.onTouched();
|
|
1331
|
+
this.close();
|
|
1332
|
+
}
|
|
1333
|
+
openDropdown() {
|
|
1334
|
+
this.onTouched();
|
|
1335
|
+
if (this.appendToBody()) {
|
|
1336
|
+
this.openPortal();
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
this.updateInlineDirection();
|
|
1340
|
+
}
|
|
1341
|
+
estimatePanelHeight() {
|
|
1342
|
+
return Math.min(Math.max(this.options().length, 1) * 40, 260);
|
|
1343
|
+
}
|
|
1344
|
+
updateInlineDirection() {
|
|
1345
|
+
if (!this.isBrowser)
|
|
1346
|
+
return;
|
|
1347
|
+
const placement = resolveDropdownPlacement(this.dropdownDirection(), this.elRef.nativeElement.getBoundingClientRect(), this.estimatePanelHeight(), window.innerHeight, 2, 8);
|
|
1348
|
+
this.dropdownDirectionState.set(placement.direction);
|
|
1349
|
+
}
|
|
1350
|
+
openPortal() {
|
|
1351
|
+
if (!this.isBrowser)
|
|
1352
|
+
return;
|
|
1353
|
+
this.destroyPortal();
|
|
1354
|
+
this.portalHost = document.createElement('div');
|
|
1355
|
+
document.body.appendChild(this.portalHost);
|
|
1356
|
+
this.portalRef = createComponent(GogSelectDropdownPortal, {
|
|
1357
|
+
environmentInjector: this.envInjector,
|
|
1358
|
+
hostElement: this.portalHost,
|
|
1359
|
+
});
|
|
1360
|
+
const inst = this.portalRef.instance;
|
|
1361
|
+
inst.options = this.options();
|
|
1362
|
+
inst.selectedValue = this.value();
|
|
1363
|
+
inst.listboxId = this.listboxId();
|
|
1364
|
+
inst.zIndex = this.dropdownZIndex() ?? 300;
|
|
1365
|
+
inst.onSelect = (option, event) => this.selectOption(option, event);
|
|
1366
|
+
this.updatePortalPosition();
|
|
1367
|
+
this.appRef.attachView(this.portalRef.hostView);
|
|
1368
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1369
|
+
}
|
|
1370
|
+
updatePortalPosition() {
|
|
1371
|
+
if (!this.portalRef || !this.isBrowser)
|
|
1372
|
+
return;
|
|
1373
|
+
const placement = resolveDropdownPlacement(this.dropdownDirection(), this.elRef.nativeElement.getBoundingClientRect(), this.estimatePanelHeight(), window.innerHeight, 2, 8);
|
|
1374
|
+
const inst = this.portalRef.instance;
|
|
1375
|
+
inst.direction = placement.direction;
|
|
1376
|
+
inst.top = placement.top;
|
|
1377
|
+
inst.left = placement.left;
|
|
1378
|
+
inst.width = placement.width;
|
|
1379
|
+
inst.maxHeight = placement.maxHeight;
|
|
1380
|
+
inst.zIndex = this.dropdownZIndex() ?? 300;
|
|
1381
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1382
|
+
}
|
|
1383
|
+
destroyPortal() {
|
|
1384
|
+
if (this.portalRef) {
|
|
1385
|
+
this.appRef.detachView(this.portalRef.hostView);
|
|
1386
|
+
this.portalRef.destroy();
|
|
1387
|
+
this.portalRef = null;
|
|
1388
|
+
}
|
|
1389
|
+
if (this.portalHost) {
|
|
1390
|
+
this.portalHost.remove();
|
|
1391
|
+
this.portalHost = null;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1395
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SelectComponent, isStandalone: true, selector: "gog-select", inputs: { inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, dropdownDirection: { classPropertyName: "dropdownDirection", publicName: "dropdownDirection", isSignal: true, isRequired: false, transformFunction: null }, dropdownZIndex: { classPropertyName: "dropdownZIndex", publicName: "dropdownZIndex", isSignal: true, isRequired: false, transformFunction: null }, appendToBody: { classPropertyName: "appendToBody", publicName: "appendToBody", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, chevronTemplate: { classPropertyName: "chevronTemplate", publicName: "chevronTemplate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "window:scroll": "onScrollOrResize()", "window:resize": "onScrollOrResize()" } }, providers: [
|
|
1396
|
+
{
|
|
1397
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1398
|
+
useExisting: forwardRef(() => SelectComponent),
|
|
1399
|
+
multi: true,
|
|
1400
|
+
},
|
|
1401
|
+
], ngImport: i0, template: "<div\r\n class=\"gog-select gog-contained-layout\"\r\n [class.gog-select--disabled]=\"isDisabled()\"\r\n [class.gog-select--open]=\"isOpen()\"\r\n>\r\n @if (label()) {\r\n <label class=\"gog-select__label font-heading\" [attr.for]=\"triggerId()\">{{ label() }}</label>\r\n }\r\n\r\n <div class=\"gog-select__field\">\r\n <button\r\n type=\"button\"\r\n class=\"gog-select__control font-body\"\r\n [id]=\"triggerId()\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-label]=\"label() ? null : ariaLabel() || placeholder() || 'Select'\"\r\n [attr.aria-controls]=\"listboxId()\"\r\n [attr.aria-expanded]=\"isOpen()\"\r\n [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-invalid]=\"hasError()\"\r\n [attr.aria-describedby]=\"errorId()\"\r\n (click)=\"toggle()\"\r\n (keydown.enter)=\"toggle(); $event.preventDefault()\"\r\n (keydown.space)=\"toggle(); $event.preventDefault()\"\r\n (keydown.escape)=\"close()\"\r\n >\r\n <span class=\"gog-select__value\" [class.gog-select__value--placeholder]=\"!selectedOption()\">\r\n {{ selectedOption()?.name || placeholder() }}\r\n </span>\r\n\r\n <span class=\"gog-select__chevron\" aria-hidden=\"true\">\r\n <gog-icon [template]=\"chevronTemplate()\" name=\"chevron-down\" />\r\n </span>\r\n </button>\r\n\r\n @if (isOpen() && !appendToBody()) {\r\n <div\r\n [id]=\"listboxId()\"\r\n class=\"gog-select__dropdown\"\r\n [class.gog-select__dropdown--up]=\"dropdownDirectionState() === 'up'\"\r\n [style.z-index]=\"dropdownZIndex() ?? null\"\r\n role=\"listbox\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n @for (option of options(); track option.id) {\r\n <button\r\n type=\"button\"\r\n class=\"gog-select__option font-body\"\r\n role=\"option\"\r\n [attr.aria-selected]=\"selectedOption()?.id === option.id\"\r\n [attr.aria-disabled]=\"option.disabled ?? false\"\r\n [class.gog-select__option--selected]=\"selectedOption()?.id === option.id\"\r\n [class.gog-select__option--disabled]=\"option.disabled ?? false\"\r\n (click)=\"selectOption(option, $event)\"\r\n >\r\n <span class=\"gog-select__option-mark\" aria-hidden=\"true\">\r\n @if (selectedOption()?.id === option.id) {\r\n <gog-icon name=\"check\" />\r\n }\r\n </span>\r\n <span class=\"gog-select__option-label\">{{ option.name }}</span>\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (hasError()) {\r\n <span class=\"gog-select__error font-body\" [attr.id]=\"errorId()\" role=\"alert\">\r\n {{ errorMessage() }}\r\n </span>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.gog-select{--gog-select-gap: 4px;--gog-select-label-color: var(--accent-color);--gog-select-field-bg: var(--surface-color);--gog-select-field-border: var(--accent-dim);--gog-select-field-color: var(--text-color);--gog-select-focus-border: var(--accent-color);--gog-select-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-select-error-color: var(--danger-color);--gog-select-chevron-color: var(--accent-color);--gog-select-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-select-option-selected-color: var(--accent-color);--gog-select-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-select-gap);width:100%}.gog-select--disabled{opacity:var(--gog-select-disabled-opacity)}.gog-select--disabled .gog-select__label,.gog-select--disabled .gog-select__field{cursor:not-allowed}.gog-select__label{font-size:var(--text-sm);color:var(--gog-select-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-select__field{position:relative;cursor:pointer}.gog-select__control{--gog-select-control-padding-y: var(--control-padding-y, 10px);--gog-select-control-padding-x: var(--control-padding-x, 14px);width:100%;min-height:44px;padding:var(--gog-select-control-padding-y) 40px var(--gog-select-control-padding-y) var(--gog-select-control-padding-x);display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:var(--text-md);color:var(--gog-select-field-color);background-color:var(--gog-select-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);outline:none;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.gog-select__control:focus{border-color:var(--gog-select-focus-border);box-shadow:0 0 8px var(--gog-select-focus-ring)}.gog-select__control:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:2px}.gog-select__control:disabled{cursor:not-allowed}.gog-select--open .gog-select__control{border-color:var(--gog-select-focus-border)}.gog-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.gog-select__value--placeholder{color:var(--muted-text-color)}.gog-select__chevron{width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--gog-select-chevron-color);pointer-events:none;flex-shrink:0}.gog-select__chevron gog-icon{font-size:.875rem}.gog-select__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--surface-color);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-select__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-select__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-select__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-select-control-padding-x);border:0;background:transparent;text-align:left;font:inherit;color:var(--text-color);cursor:pointer;transition:background-color .12s ease}.gog-select__option:hover{background-color:var(--gog-select-option-hover-bg)}.gog-select__option--selected{color:var(--gog-select-option-selected-color)}.gog-select__option--disabled{opacity:.5;cursor:not-allowed}.gog-select__option:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:-3px}.gog-select__option-mark{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.gog-select__option-mark gog-icon{font-size:.875rem}.gog-select__error{font-size:var(--text-xs);color:var(--gog-select-error-color)}@media(prefers-reduced-motion:reduce){.gog-select__control,.gog-select__option{transition:none}}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1402
|
+
}
|
|
1403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SelectComponent, decorators: [{
|
|
1404
|
+
type: Component,
|
|
1405
|
+
args: [{ selector: 'gog-select', imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1406
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
1407
|
+
'(window:scroll)': 'onScrollOrResize()',
|
|
1408
|
+
'(window:resize)': 'onScrollOrResize()',
|
|
1409
|
+
}, providers: [
|
|
1410
|
+
{
|
|
1411
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1412
|
+
useExisting: forwardRef(() => SelectComponent),
|
|
1413
|
+
multi: true,
|
|
1414
|
+
},
|
|
1415
|
+
], template: "<div\r\n class=\"gog-select gog-contained-layout\"\r\n [class.gog-select--disabled]=\"isDisabled()\"\r\n [class.gog-select--open]=\"isOpen()\"\r\n>\r\n @if (label()) {\r\n <label class=\"gog-select__label font-heading\" [attr.for]=\"triggerId()\">{{ label() }}</label>\r\n }\r\n\r\n <div class=\"gog-select__field\">\r\n <button\r\n type=\"button\"\r\n class=\"gog-select__control font-body\"\r\n [id]=\"triggerId()\"\r\n [disabled]=\"isDisabled()\"\r\n [attr.aria-label]=\"label() ? null : ariaLabel() || placeholder() || 'Select'\"\r\n [attr.aria-controls]=\"listboxId()\"\r\n [attr.aria-expanded]=\"isOpen()\"\r\n [attr.aria-haspopup]=\"'listbox'\"\r\n [attr.aria-invalid]=\"hasError()\"\r\n [attr.aria-describedby]=\"errorId()\"\r\n (click)=\"toggle()\"\r\n (keydown.enter)=\"toggle(); $event.preventDefault()\"\r\n (keydown.space)=\"toggle(); $event.preventDefault()\"\r\n (keydown.escape)=\"close()\"\r\n >\r\n <span class=\"gog-select__value\" [class.gog-select__value--placeholder]=\"!selectedOption()\">\r\n {{ selectedOption()?.name || placeholder() }}\r\n </span>\r\n\r\n <span class=\"gog-select__chevron\" aria-hidden=\"true\">\r\n <gog-icon [template]=\"chevronTemplate()\" name=\"chevron-down\" />\r\n </span>\r\n </button>\r\n\r\n @if (isOpen() && !appendToBody()) {\r\n <div\r\n [id]=\"listboxId()\"\r\n class=\"gog-select__dropdown\"\r\n [class.gog-select__dropdown--up]=\"dropdownDirectionState() === 'up'\"\r\n [style.z-index]=\"dropdownZIndex() ?? null\"\r\n role=\"listbox\"\r\n (click)=\"$event.stopPropagation()\"\r\n >\r\n @for (option of options(); track option.id) {\r\n <button\r\n type=\"button\"\r\n class=\"gog-select__option font-body\"\r\n role=\"option\"\r\n [attr.aria-selected]=\"selectedOption()?.id === option.id\"\r\n [attr.aria-disabled]=\"option.disabled ?? false\"\r\n [class.gog-select__option--selected]=\"selectedOption()?.id === option.id\"\r\n [class.gog-select__option--disabled]=\"option.disabled ?? false\"\r\n (click)=\"selectOption(option, $event)\"\r\n >\r\n <span class=\"gog-select__option-mark\" aria-hidden=\"true\">\r\n @if (selectedOption()?.id === option.id) {\r\n <gog-icon name=\"check\" />\r\n }\r\n </span>\r\n <span class=\"gog-select__option-label\">{{ option.name }}</span>\r\n </button>\r\n }\r\n </div>\r\n }\r\n </div>\r\n\r\n @if (hasError()) {\r\n <span class=\"gog-select__error font-body\" [attr.id]=\"errorId()\" role=\"alert\">\r\n {{ errorMessage() }}\r\n </span>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.gog-select{--gog-select-gap: 4px;--gog-select-label-color: var(--accent-color);--gog-select-field-bg: var(--surface-color);--gog-select-field-border: var(--accent-dim);--gog-select-field-color: var(--text-color);--gog-select-focus-border: var(--accent-color);--gog-select-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-select-error-color: var(--danger-color);--gog-select-chevron-color: var(--accent-color);--gog-select-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-select-option-selected-color: var(--accent-color);--gog-select-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-select-gap);width:100%}.gog-select--disabled{opacity:var(--gog-select-disabled-opacity)}.gog-select--disabled .gog-select__label,.gog-select--disabled .gog-select__field{cursor:not-allowed}.gog-select__label{font-size:var(--text-sm);color:var(--gog-select-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-select__field{position:relative;cursor:pointer}.gog-select__control{--gog-select-control-padding-y: var(--control-padding-y, 10px);--gog-select-control-padding-x: var(--control-padding-x, 14px);width:100%;min-height:44px;padding:var(--gog-select-control-padding-y) 40px var(--gog-select-control-padding-y) var(--gog-select-control-padding-x);display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:var(--text-md);color:var(--gog-select-field-color);background-color:var(--gog-select-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);outline:none;cursor:pointer;transition:border-color .15s ease,box-shadow .15s ease}.gog-select__control:focus{border-color:var(--gog-select-focus-border);box-shadow:0 0 8px var(--gog-select-focus-ring)}.gog-select__control:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:2px}.gog-select__control:disabled{cursor:not-allowed}.gog-select--open .gog-select__control{border-color:var(--gog-select-focus-border)}.gog-select__value{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}.gog-select__value--placeholder{color:var(--muted-text-color)}.gog-select__chevron{width:16px;height:16px;display:flex;align-items:center;justify-content:center;color:var(--gog-select-chevron-color);pointer-events:none;flex-shrink:0}.gog-select__chevron gog-icon{font-size:.875rem}.gog-select__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--surface-color);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-select-field-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-select__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-select__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-select__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-select-control-padding-x);border:0;background:transparent;text-align:left;font:inherit;color:var(--text-color);cursor:pointer;transition:background-color .12s ease}.gog-select__option:hover{background-color:var(--gog-select-option-hover-bg)}.gog-select__option--selected{color:var(--gog-select-option-selected-color)}.gog-select__option--disabled{opacity:.5;cursor:not-allowed}.gog-select__option:focus-visible{outline:3px solid var(--gog-select-focus-border);outline-offset:-3px}.gog-select__option-mark{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.gog-select__option-mark gog-icon{font-size:.875rem}.gog-select__error{font-size:var(--text-xs);color:var(--gog-select-error-color)}@media(prefers-reduced-motion:reduce){.gog-select__control,.gog-select__option{transition:none}}\n"] }]
|
|
1416
|
+
}], ctorParameters: () => [], propDecorators: { inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], dropdownDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownDirection", required: false }] }], dropdownZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownZIndex", required: false }] }], appendToBody: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendToBody", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], chevronTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "chevronTemplate", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1417
|
+
|
|
1418
|
+
class GogMultiselectDropdownPortal {
|
|
1419
|
+
top = 0;
|
|
1420
|
+
left = 0;
|
|
1421
|
+
width = 200;
|
|
1422
|
+
maxHeight = 260;
|
|
1423
|
+
zIndex = 9999;
|
|
1424
|
+
listboxId = '';
|
|
1425
|
+
direction = 'down';
|
|
1426
|
+
options = [];
|
|
1427
|
+
selectedIds = [];
|
|
1428
|
+
showControls = false;
|
|
1429
|
+
onToggle = () => { };
|
|
1430
|
+
onSelectAll = () => { };
|
|
1431
|
+
onClearAll = () => { };
|
|
1432
|
+
isSelected(id) {
|
|
1433
|
+
return this.selectedIds.includes(id);
|
|
1434
|
+
}
|
|
1435
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogMultiselectDropdownPortal, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1436
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: GogMultiselectDropdownPortal, isStandalone: true, selector: "gog-multiselect-dropdown-portal", ngImport: i0, template: `
|
|
1437
|
+
<div
|
|
1438
|
+
[id]="listboxId"
|
|
1439
|
+
class="gog-ms__dropdown gog-ms__dropdown--portal"
|
|
1440
|
+
[style.top.px]="top"
|
|
1441
|
+
[style.left.px]="left"
|
|
1442
|
+
[style.width.px]="width"
|
|
1443
|
+
[style.max-height.px]="maxHeight"
|
|
1444
|
+
[style.z-index]="zIndex"
|
|
1445
|
+
role="listbox"
|
|
1446
|
+
aria-multiselectable="true"
|
|
1447
|
+
>
|
|
1448
|
+
@if (showControls) {
|
|
1449
|
+
<div class="gog-ms__controls">
|
|
1450
|
+
<gog-button variant="ghost" size="sm" (click)="onSelectAll($event)">Select all</gog-button>
|
|
1451
|
+
<gog-button variant="ghost" size="sm" (click)="onClearAll($event)">Clear</gog-button>
|
|
1452
|
+
</div>
|
|
1453
|
+
}
|
|
1454
|
+
<div class="gog-ms__options">
|
|
1455
|
+
@for (option of options; track option.id) {
|
|
1456
|
+
<button
|
|
1457
|
+
type="button"
|
|
1458
|
+
class="gog-ms__option font-body"
|
|
1459
|
+
role="option"
|
|
1460
|
+
[attr.aria-selected]="isSelected(option.id)"
|
|
1461
|
+
[class.gog-ms__option--selected]="isSelected(option.id)"
|
|
1462
|
+
(click)="onToggle(option, $event)"
|
|
1463
|
+
>
|
|
1464
|
+
<span class="gog-ms__option-mark" aria-hidden="true">
|
|
1465
|
+
<svg viewBox="0 0 16 16" fill="none" focusable="false" aria-hidden="true">
|
|
1466
|
+
<rect
|
|
1467
|
+
x="2.5"
|
|
1468
|
+
y="2.5"
|
|
1469
|
+
width="11"
|
|
1470
|
+
height="11"
|
|
1471
|
+
rx="2"
|
|
1472
|
+
[attr.fill]="isSelected(option.id) ? 'currentColor' : 'none'"
|
|
1473
|
+
stroke="currentColor"
|
|
1474
|
+
stroke-width="1.5"
|
|
1475
|
+
/>
|
|
1476
|
+
@if (isSelected(option.id)) {
|
|
1477
|
+
<path
|
|
1478
|
+
d="M4 8L6.75 10.75L12 5.5"
|
|
1479
|
+
stroke="var(--gog-ms-checkbox-checked-color)"
|
|
1480
|
+
stroke-width="1.75"
|
|
1481
|
+
stroke-linecap="round"
|
|
1482
|
+
stroke-linejoin="round"
|
|
1483
|
+
/>
|
|
1484
|
+
}
|
|
1485
|
+
</svg>
|
|
1486
|
+
</span>
|
|
1487
|
+
{{ option.name }}
|
|
1488
|
+
</button>
|
|
1489
|
+
}
|
|
1490
|
+
</div>
|
|
1491
|
+
</div>
|
|
1492
|
+
`, isInline: true, styles: [".gog-ms-wrapper{--gog-ms-gap: 4px;--gog-ms-option-gap: 4px;--gog-ms-options-padding: 4px;--gog-ms-label-color: var(--accent-color);--gog-ms-field-bg: var(--surface-color);--gog-ms-field-border: var(--accent-dim);--gog-ms-field-color: var(--text-color);--gog-ms-value-color: var(--text-color);--gog-ms-placeholder-color: var(--muted-text-color);--gog-ms-focus-border: var(--accent-color);--gog-ms-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-ms-error-color: var(--danger-color);--gog-ms-border-color: var(--accent-color);--gog-ms-panel-bg: var(--surface-color);--gog-ms-panel-border: var(--accent-color);--gog-ms-panel-shadow: 0 8px 24px rgba(0, 0, 0, .3);--gog-ms-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-ms-checkbox-border: var(--accent-dim);--gog-ms-checkbox-bg: var(--background-color);--gog-ms-checkbox-checked-bg: var(--accent-color);--gog-ms-checkbox-checked-color: var(--primary-color);--gog-ms-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-ms-gap);position:relative;width:100%}.gog-ms__label{font-size:var(--text-sm);color:var(--gog-ms-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-ms{--gog-ms-padding-y: var(--control-padding-y, 10px);--gog-ms-padding-x: var(--control-padding-x, 14px);display:flex;align-items:center;justify-content:space-between;padding:var(--gog-ms-padding-y) var(--gog-ms-padding-x);background-color:var(--gog-ms-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border);border-radius:var(--radius);color:var(--gog-ms-field-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s ease,box-shadow .15s ease;min-height:44px}.gog-ms:hover:not(.gog-ms--disabled){border-color:var(--gog-ms-focus-border)}.gog-ms:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms--open{border-color:var(--gog-ms-border-color);box-shadow:0 0 8px var(--gog-ms-focus-ring)}.gog-ms--disabled{opacity:var(--gog-ms-disabled-opacity);cursor:not-allowed}.gog-ms--disabled .gog-ms__label{cursor:not-allowed}.gog-ms--error{border-color:var(--gog-ms-error-color)}.gog-ms__value{font-size:var(--text-md);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gog-ms-value-color)}.gog-ms__value--placeholder{color:var(--gog-ms-placeholder-color)}.gog-ms__actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.gog-ms__clear{width:1rem;height:1rem;padding:0;border:0;border-radius:var(--gog-ms-clear-radius, 2px);background:transparent;color:var(--gog-ms-placeholder-color);line-height:1;cursor:pointer;transition:color .15s ease}.gog-ms__clear gog-icon{font-size:.7rem}.gog-ms__clear:hover{color:var(--gog-ms-field-color)}.gog-ms__clear:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms__arrow{color:var(--gog-ms-border-color);transition:transform .2s ease;display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem}.gog-ms__arrow gog-icon{font-size:.875rem}.gog-ms__arrow--up{transform:rotate(180deg)}.gog-ms__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--gog-ms-panel-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-panel-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-ms__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-ms__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-ms__controls{display:flex;gap:4px;padding:6px 10px;border-bottom:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border)}.gog-ms__options{display:flex;flex-direction:column;padding:var(--gog-ms-options-padding);gap:var(--gog-ms-option-gap)}.gog-ms__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-ms-padding-x);border:0;background:transparent;text-align:left;font:inherit;font-size:var(--text-md);cursor:pointer;border-radius:calc(var(--radius) - 2px);transition:background-color .12s ease;color:var(--text-color)}.gog-ms__option:hover{background-color:var(--gog-ms-option-hover-bg)}.gog-ms__option--selected{color:var(--gog-ms-border-color)}.gog-ms__option:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:-3px}.gog-ms__option-mark{display:flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--gog-ms-checkbox-border)}.gog-ms__option--selected .gog-ms__option-mark{color:var(--gog-ms-checkbox-checked-bg)}.gog-ms__option-mark svg{width:18px;height:18px}.gog-ms__error{font-size:var(--text-xs);color:var(--gog-ms-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-ms,.gog-ms__clear,.gog-ms__arrow,.gog-ms__option,.gog-ms__option-mark{transition:none}}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "gog-button", inputs: ["variant", "size", "disabled", "fullWidth", "type", "debounce", "loading"], outputs: ["gogClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1493
|
+
}
|
|
1494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: GogMultiselectDropdownPortal, decorators: [{
|
|
1495
|
+
type: Component,
|
|
1496
|
+
args: [{ selector: 'gog-multiselect-dropdown-portal', imports: [ButtonComponent], template: `
|
|
1497
|
+
<div
|
|
1498
|
+
[id]="listboxId"
|
|
1499
|
+
class="gog-ms__dropdown gog-ms__dropdown--portal"
|
|
1500
|
+
[style.top.px]="top"
|
|
1501
|
+
[style.left.px]="left"
|
|
1502
|
+
[style.width.px]="width"
|
|
1503
|
+
[style.max-height.px]="maxHeight"
|
|
1504
|
+
[style.z-index]="zIndex"
|
|
1505
|
+
role="listbox"
|
|
1506
|
+
aria-multiselectable="true"
|
|
1507
|
+
>
|
|
1508
|
+
@if (showControls) {
|
|
1509
|
+
<div class="gog-ms__controls">
|
|
1510
|
+
<gog-button variant="ghost" size="sm" (click)="onSelectAll($event)">Select all</gog-button>
|
|
1511
|
+
<gog-button variant="ghost" size="sm" (click)="onClearAll($event)">Clear</gog-button>
|
|
1512
|
+
</div>
|
|
1513
|
+
}
|
|
1514
|
+
<div class="gog-ms__options">
|
|
1515
|
+
@for (option of options; track option.id) {
|
|
1516
|
+
<button
|
|
1517
|
+
type="button"
|
|
1518
|
+
class="gog-ms__option font-body"
|
|
1519
|
+
role="option"
|
|
1520
|
+
[attr.aria-selected]="isSelected(option.id)"
|
|
1521
|
+
[class.gog-ms__option--selected]="isSelected(option.id)"
|
|
1522
|
+
(click)="onToggle(option, $event)"
|
|
1523
|
+
>
|
|
1524
|
+
<span class="gog-ms__option-mark" aria-hidden="true">
|
|
1525
|
+
<svg viewBox="0 0 16 16" fill="none" focusable="false" aria-hidden="true">
|
|
1526
|
+
<rect
|
|
1527
|
+
x="2.5"
|
|
1528
|
+
y="2.5"
|
|
1529
|
+
width="11"
|
|
1530
|
+
height="11"
|
|
1531
|
+
rx="2"
|
|
1532
|
+
[attr.fill]="isSelected(option.id) ? 'currentColor' : 'none'"
|
|
1533
|
+
stroke="currentColor"
|
|
1534
|
+
stroke-width="1.5"
|
|
1535
|
+
/>
|
|
1536
|
+
@if (isSelected(option.id)) {
|
|
1537
|
+
<path
|
|
1538
|
+
d="M4 8L6.75 10.75L12 5.5"
|
|
1539
|
+
stroke="var(--gog-ms-checkbox-checked-color)"
|
|
1540
|
+
stroke-width="1.75"
|
|
1541
|
+
stroke-linecap="round"
|
|
1542
|
+
stroke-linejoin="round"
|
|
1543
|
+
/>
|
|
1544
|
+
}
|
|
1545
|
+
</svg>
|
|
1546
|
+
</span>
|
|
1547
|
+
{{ option.name }}
|
|
1548
|
+
</button>
|
|
1549
|
+
}
|
|
1550
|
+
</div>
|
|
1551
|
+
</div>
|
|
1552
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".gog-ms-wrapper{--gog-ms-gap: 4px;--gog-ms-option-gap: 4px;--gog-ms-options-padding: 4px;--gog-ms-label-color: var(--accent-color);--gog-ms-field-bg: var(--surface-color);--gog-ms-field-border: var(--accent-dim);--gog-ms-field-color: var(--text-color);--gog-ms-value-color: var(--text-color);--gog-ms-placeholder-color: var(--muted-text-color);--gog-ms-focus-border: var(--accent-color);--gog-ms-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-ms-error-color: var(--danger-color);--gog-ms-border-color: var(--accent-color);--gog-ms-panel-bg: var(--surface-color);--gog-ms-panel-border: var(--accent-color);--gog-ms-panel-shadow: 0 8px 24px rgba(0, 0, 0, .3);--gog-ms-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-ms-checkbox-border: var(--accent-dim);--gog-ms-checkbox-bg: var(--background-color);--gog-ms-checkbox-checked-bg: var(--accent-color);--gog-ms-checkbox-checked-color: var(--primary-color);--gog-ms-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-ms-gap);position:relative;width:100%}.gog-ms__label{font-size:var(--text-sm);color:var(--gog-ms-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-ms{--gog-ms-padding-y: var(--control-padding-y, 10px);--gog-ms-padding-x: var(--control-padding-x, 14px);display:flex;align-items:center;justify-content:space-between;padding:var(--gog-ms-padding-y) var(--gog-ms-padding-x);background-color:var(--gog-ms-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border);border-radius:var(--radius);color:var(--gog-ms-field-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s ease,box-shadow .15s ease;min-height:44px}.gog-ms:hover:not(.gog-ms--disabled){border-color:var(--gog-ms-focus-border)}.gog-ms:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms--open{border-color:var(--gog-ms-border-color);box-shadow:0 0 8px var(--gog-ms-focus-ring)}.gog-ms--disabled{opacity:var(--gog-ms-disabled-opacity);cursor:not-allowed}.gog-ms--disabled .gog-ms__label{cursor:not-allowed}.gog-ms--error{border-color:var(--gog-ms-error-color)}.gog-ms__value{font-size:var(--text-md);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gog-ms-value-color)}.gog-ms__value--placeholder{color:var(--gog-ms-placeholder-color)}.gog-ms__actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.gog-ms__clear{width:1rem;height:1rem;padding:0;border:0;border-radius:var(--gog-ms-clear-radius, 2px);background:transparent;color:var(--gog-ms-placeholder-color);line-height:1;cursor:pointer;transition:color .15s ease}.gog-ms__clear gog-icon{font-size:.7rem}.gog-ms__clear:hover{color:var(--gog-ms-field-color)}.gog-ms__clear:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms__arrow{color:var(--gog-ms-border-color);transition:transform .2s ease;display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem}.gog-ms__arrow gog-icon{font-size:.875rem}.gog-ms__arrow--up{transform:rotate(180deg)}.gog-ms__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--gog-ms-panel-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-panel-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-ms__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-ms__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-ms__controls{display:flex;gap:4px;padding:6px 10px;border-bottom:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border)}.gog-ms__options{display:flex;flex-direction:column;padding:var(--gog-ms-options-padding);gap:var(--gog-ms-option-gap)}.gog-ms__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-ms-padding-x);border:0;background:transparent;text-align:left;font:inherit;font-size:var(--text-md);cursor:pointer;border-radius:calc(var(--radius) - 2px);transition:background-color .12s ease;color:var(--text-color)}.gog-ms__option:hover{background-color:var(--gog-ms-option-hover-bg)}.gog-ms__option--selected{color:var(--gog-ms-border-color)}.gog-ms__option:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:-3px}.gog-ms__option-mark{display:flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--gog-ms-checkbox-border)}.gog-ms__option--selected .gog-ms__option-mark{color:var(--gog-ms-checkbox-checked-bg)}.gog-ms__option-mark svg{width:18px;height:18px}.gog-ms__error{font-size:var(--text-xs);color:var(--gog-ms-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-ms,.gog-ms__clear,.gog-ms__arrow,.gog-ms__option,.gog-ms__option-mark{transition:none}}\n"] }]
|
|
1553
|
+
}] });
|
|
1554
|
+
class MultiselectComponent {
|
|
1555
|
+
static nextId = 0;
|
|
1556
|
+
instanceId = ++MultiselectComponent.nextId;
|
|
1557
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1558
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1559
|
+
placeholder = input('Select...', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
1560
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
1561
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
1562
|
+
showControls = input(false, ...(ngDevMode ? [{ debugName: "showControls" }] : /* istanbul ignore next */ []));
|
|
1563
|
+
dropdownDirection = input('auto', ...(ngDevMode ? [{ debugName: "dropdownDirection" }] : /* istanbul ignore next */ []));
|
|
1564
|
+
dropdownZIndex = input(null, ...(ngDevMode ? [{ debugName: "dropdownZIndex" }] : /* istanbul ignore next */ []));
|
|
1565
|
+
appendToBody = input(false, ...(ngDevMode ? [{ debugName: "appendToBody" }] : /* istanbul ignore next */ []));
|
|
1566
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1567
|
+
chevronTemplate = input(null, ...(ngDevMode ? [{ debugName: "chevronTemplate" }] : /* istanbul ignore next */ []));
|
|
1568
|
+
clearIconTemplate = input(null, ...(ngDevMode ? [{ debugName: "clearIconTemplate" }] : /* istanbul ignore next */ []));
|
|
1569
|
+
/** Two-way bindable selected ids: `[(value)]="signal"`. */
|
|
1570
|
+
value = model([], ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1571
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
1572
|
+
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
1573
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1574
|
+
dropdownDirectionState = signal('down', ...(ngDevMode ? [{ debugName: "dropdownDirectionState" }] : /* istanbul ignore next */ []));
|
|
1575
|
+
elRef = inject((ElementRef));
|
|
1576
|
+
appRef = inject(ApplicationRef);
|
|
1577
|
+
envInjector = inject(EnvironmentInjector);
|
|
1578
|
+
destroyRef = inject(DestroyRef);
|
|
1579
|
+
isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
|
|
1580
|
+
ngControl = inject(NgControl, { optional: true, self: true });
|
|
1581
|
+
_touched = signal(false, ...(ngDevMode ? [{ debugName: "_touched" }] : /* istanbul ignore next */ []));
|
|
1582
|
+
formStatus = this.ngControl?.statusChanges
|
|
1583
|
+
? toSignal(this.ngControl.statusChanges, { initialValue: this.ngControl.status ?? 'VALID' })
|
|
1584
|
+
: signal('VALID');
|
|
1585
|
+
hasError = computed(() => {
|
|
1586
|
+
if (this.ngControl) {
|
|
1587
|
+
return this._touched() && this.formStatus() === 'INVALID';
|
|
1588
|
+
}
|
|
1589
|
+
return !!this.errorMessage() && this.value().length === 0;
|
|
1590
|
+
}, ...(ngDevMode ? [{ debugName: "hasError" }] : /* istanbul ignore next */ []));
|
|
1591
|
+
visibleError = computed(() => (this.hasError() ? this.errorMessage() : ''), ...(ngDevMode ? [{ debugName: "visibleError" }] : /* istanbul ignore next */ []));
|
|
1592
|
+
portalHost = null;
|
|
1593
|
+
portalRef = null;
|
|
1594
|
+
selectedNames = computed(() => this.value()
|
|
1595
|
+
.map((id) => this.options().find((o) => o.id === id)?.name)
|
|
1596
|
+
.filter(Boolean)
|
|
1597
|
+
.join(', '), ...(ngDevMode ? [{ debugName: "selectedNames" }] : /* istanbul ignore next */ []));
|
|
1598
|
+
_onChange = () => { };
|
|
1599
|
+
_onTouched = () => { };
|
|
1600
|
+
constructor() {
|
|
1601
|
+
if (this.ngControl) {
|
|
1602
|
+
this.ngControl.valueAccessor = this;
|
|
1603
|
+
}
|
|
1604
|
+
this.destroyRef.onDestroy(() => this.destroyPortal());
|
|
1605
|
+
}
|
|
1606
|
+
onDocumentClick(e) {
|
|
1607
|
+
const inside = this.elRef.nativeElement.contains(e.target) ||
|
|
1608
|
+
(this.portalHost?.contains(e.target) ?? false);
|
|
1609
|
+
if (!inside) {
|
|
1610
|
+
this.isOpen.set(false);
|
|
1611
|
+
if (this.appendToBody())
|
|
1612
|
+
this.destroyPortal();
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
onScrollOrResize() {
|
|
1616
|
+
if (!this.isOpen())
|
|
1617
|
+
return;
|
|
1618
|
+
if (this.appendToBody()) {
|
|
1619
|
+
this.updatePortalPosition();
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
this.updateInlineDirection();
|
|
1623
|
+
}
|
|
1624
|
+
writeValue(val) {
|
|
1625
|
+
this.value.set(val ?? []);
|
|
1626
|
+
}
|
|
1627
|
+
registerOnChange(fn) {
|
|
1628
|
+
this._onChange = fn;
|
|
1629
|
+
}
|
|
1630
|
+
registerOnTouched(fn) {
|
|
1631
|
+
this._onTouched = fn;
|
|
1632
|
+
}
|
|
1633
|
+
setDisabledState(isDisabled) {
|
|
1634
|
+
this.cvaDisabled.set(isDisabled);
|
|
1635
|
+
}
|
|
1636
|
+
isSelected(id) {
|
|
1637
|
+
return this.value().includes(id);
|
|
1638
|
+
}
|
|
1639
|
+
toggle() {
|
|
1640
|
+
if (this.isDisabled())
|
|
1641
|
+
return;
|
|
1642
|
+
const next = !this.isOpen();
|
|
1643
|
+
this.isOpen.set(next);
|
|
1644
|
+
if (this.appendToBody()) {
|
|
1645
|
+
if (next)
|
|
1646
|
+
this.openPortal();
|
|
1647
|
+
else
|
|
1648
|
+
this.destroyPortal();
|
|
1649
|
+
}
|
|
1650
|
+
else if (next) {
|
|
1651
|
+
this.updateInlineDirection();
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
toggleOption(option, e) {
|
|
1655
|
+
e.stopPropagation();
|
|
1656
|
+
this.applyToggle(option.id);
|
|
1657
|
+
if (this.appendToBody() && this.portalRef) {
|
|
1658
|
+
this.portalRef.instance.selectedIds = [...this.value()];
|
|
1659
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
applyToggle(id) {
|
|
1663
|
+
const current = this.value();
|
|
1664
|
+
const next = this.isSelected(id) ? current.filter((x) => x !== id) : [...current, id];
|
|
1665
|
+
this.value.set(next);
|
|
1666
|
+
this._onChange(next);
|
|
1667
|
+
this._onTouched();
|
|
1668
|
+
this._touched.set(true);
|
|
1669
|
+
}
|
|
1670
|
+
selectAll(e) {
|
|
1671
|
+
e.stopPropagation();
|
|
1672
|
+
const all = this.options().map((o) => o.id);
|
|
1673
|
+
this.value.set(all);
|
|
1674
|
+
this._onChange(all);
|
|
1675
|
+
this._onTouched();
|
|
1676
|
+
this._touched.set(true);
|
|
1677
|
+
if (this.appendToBody() && this.portalRef) {
|
|
1678
|
+
this.portalRef.instance.selectedIds = [...all];
|
|
1679
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
clearAll(e) {
|
|
1683
|
+
e.stopPropagation();
|
|
1684
|
+
this.value.set([]);
|
|
1685
|
+
this._onChange([]);
|
|
1686
|
+
this._onTouched();
|
|
1687
|
+
this._touched.set(true);
|
|
1688
|
+
if (this.appendToBody() && this.portalRef) {
|
|
1689
|
+
this.portalRef.instance.selectedIds = [];
|
|
1690
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
clearTrigger(e) {
|
|
1694
|
+
e.stopPropagation();
|
|
1695
|
+
this.value.set([]);
|
|
1696
|
+
this._onChange([]);
|
|
1697
|
+
this._onTouched();
|
|
1698
|
+
this._touched.set(true);
|
|
1699
|
+
}
|
|
1700
|
+
close() {
|
|
1701
|
+
if (!this.isOpen())
|
|
1702
|
+
return;
|
|
1703
|
+
this.isOpen.set(false);
|
|
1704
|
+
if (this.appendToBody())
|
|
1705
|
+
this.destroyPortal();
|
|
1706
|
+
}
|
|
1707
|
+
estimatePanelHeight() {
|
|
1708
|
+
const controlsHeight = this.showControls() ? 38 : 0;
|
|
1709
|
+
const optionsCount = Math.max(this.options().length, 1);
|
|
1710
|
+
const optionsPadding = this.getOptionPadding() * 2;
|
|
1711
|
+
const optionGap = this.getOptionGap();
|
|
1712
|
+
const optionsHeight = optionsCount * 40 + Math.max(optionsCount - 1, 0) * optionGap + optionsPadding;
|
|
1713
|
+
return Math.min(optionsHeight + controlsHeight, 260);
|
|
1714
|
+
}
|
|
1715
|
+
getOptionGap() {
|
|
1716
|
+
if (!this.isBrowser) {
|
|
1717
|
+
return 4;
|
|
1718
|
+
}
|
|
1719
|
+
const gap = getComputedStyle(this.elRef.nativeElement).getPropertyValue('--gog-ms-option-gap').trim();
|
|
1720
|
+
const parsedGap = Number.parseFloat(gap);
|
|
1721
|
+
return Number.isFinite(parsedGap) ? parsedGap : 4;
|
|
1722
|
+
}
|
|
1723
|
+
getOptionPadding() {
|
|
1724
|
+
if (!this.isBrowser) {
|
|
1725
|
+
return 4;
|
|
1726
|
+
}
|
|
1727
|
+
const padding = getComputedStyle(this.elRef.nativeElement)
|
|
1728
|
+
.getPropertyValue('--gog-ms-options-padding')
|
|
1729
|
+
.trim();
|
|
1730
|
+
const parsedPadding = Number.parseFloat(padding);
|
|
1731
|
+
return Number.isFinite(parsedPadding) ? parsedPadding : 4;
|
|
1732
|
+
}
|
|
1733
|
+
updateInlineDirection() {
|
|
1734
|
+
if (!this.isBrowser)
|
|
1735
|
+
return;
|
|
1736
|
+
const placement = resolveDropdownPlacement(this.dropdownDirection(), this.elRef.nativeElement.getBoundingClientRect(), this.estimatePanelHeight(), window.innerHeight, 2, 8);
|
|
1737
|
+
this.dropdownDirectionState.set(placement.direction);
|
|
1738
|
+
}
|
|
1739
|
+
openPortal() {
|
|
1740
|
+
if (!this.isBrowser)
|
|
1741
|
+
return;
|
|
1742
|
+
this.destroyPortal();
|
|
1743
|
+
this.portalHost = document.createElement('div');
|
|
1744
|
+
document.body.appendChild(this.portalHost);
|
|
1745
|
+
this.portalRef = createComponent(GogMultiselectDropdownPortal, {
|
|
1746
|
+
environmentInjector: this.envInjector,
|
|
1747
|
+
hostElement: this.portalHost,
|
|
1748
|
+
});
|
|
1749
|
+
const inst = this.portalRef.instance;
|
|
1750
|
+
inst.options = this.options();
|
|
1751
|
+
inst.selectedIds = [...this.value()];
|
|
1752
|
+
inst.showControls = this.showControls();
|
|
1753
|
+
inst.listboxId = `gog-ms-listbox-${this.instanceId}`;
|
|
1754
|
+
inst.zIndex = this.dropdownZIndex() ?? 9999;
|
|
1755
|
+
inst.direction = this.dropdownDirectionState();
|
|
1756
|
+
inst.maxHeight = this.estimatePanelHeight();
|
|
1757
|
+
inst.onToggle = (o, e) => this.toggleOption(o, e);
|
|
1758
|
+
inst.onSelectAll = (e) => this.selectAll(e);
|
|
1759
|
+
inst.onClearAll = (e) => this.clearAll(e);
|
|
1760
|
+
this.updatePortalPosition();
|
|
1761
|
+
this.appRef.attachView(this.portalRef.hostView);
|
|
1762
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1763
|
+
}
|
|
1764
|
+
updatePortalPosition() {
|
|
1765
|
+
if (!this.portalRef || !this.isBrowser)
|
|
1766
|
+
return;
|
|
1767
|
+
const placement = resolveDropdownPlacement(this.dropdownDirection(), this.elRef.nativeElement.getBoundingClientRect(), this.estimatePanelHeight(), window.innerHeight, 2, 8);
|
|
1768
|
+
this.portalRef.instance.direction = placement.direction;
|
|
1769
|
+
this.portalRef.instance.top = placement.top;
|
|
1770
|
+
this.portalRef.instance.left = placement.left;
|
|
1771
|
+
this.portalRef.instance.width = placement.width;
|
|
1772
|
+
this.portalRef.instance.maxHeight = placement.maxHeight;
|
|
1773
|
+
this.dropdownDirectionState.set(placement.direction);
|
|
1774
|
+
this.portalRef.changeDetectorRef.detectChanges();
|
|
1775
|
+
}
|
|
1776
|
+
destroyPortal() {
|
|
1777
|
+
if (this.portalRef) {
|
|
1778
|
+
this.appRef.detachView(this.portalRef.hostView);
|
|
1779
|
+
this.portalRef.destroy();
|
|
1780
|
+
this.portalRef = null;
|
|
1781
|
+
}
|
|
1782
|
+
if (this.portalHost) {
|
|
1783
|
+
this.portalHost.remove();
|
|
1784
|
+
this.portalHost = null;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: MultiselectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1788
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: MultiselectComponent, isStandalone: true, selector: "gog-multiselect", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, showControls: { classPropertyName: "showControls", publicName: "showControls", isSignal: true, isRequired: false, transformFunction: null }, dropdownDirection: { classPropertyName: "dropdownDirection", publicName: "dropdownDirection", isSignal: true, isRequired: false, transformFunction: null }, dropdownZIndex: { classPropertyName: "dropdownZIndex", publicName: "dropdownZIndex", isSignal: true, isRequired: false, transformFunction: null }, appendToBody: { classPropertyName: "appendToBody", publicName: "appendToBody", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, chevronTemplate: { classPropertyName: "chevronTemplate", publicName: "chevronTemplate", isSignal: true, isRequired: false, transformFunction: null }, clearIconTemplate: { classPropertyName: "clearIconTemplate", publicName: "clearIconTemplate", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "document:click": "onDocumentClick($event)", "window:scroll": "onScrollOrResize()", "window:resize": "onScrollOrResize()" } }, ngImport: i0, template: "<div class=\"gog-ms-wrapper gog-contained-layout\">\n @if (label()) {\n <label class=\"gog-ms__label font-heading\">{{ label() }}</label>\n }\n\n <div\n class=\"gog-ms\"\n role=\"combobox\"\n tabindex=\"0\"\n [attr.aria-expanded]=\"isOpen()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"'gog-ms-listbox-' + instanceId\"\n [attr.aria-disabled]=\"isDisabled()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || placeholder() || 'Select'\"\n [class.gog-ms--open]=\"isOpen()\"\n [class.gog-ms--disabled]=\"isDisabled()\"\n [class.gog-ms--error]=\"hasError()\"\n (click)=\"toggle()\"\n (keydown.enter)=\"toggle()\"\n (keydown.space)=\"toggle(); $event.preventDefault()\"\n (keydown.escape)=\"close()\"\n >\n <span class=\"gog-ms__value font-body\" [class.gog-ms__value--placeholder]=\"!selectedNames()\">\n {{ selectedNames() || placeholder() }}\n </span>\n\n <span class=\"gog-ms__actions\">\n @if (selectedNames()) {\n <button\n type=\"button\"\n type=\"button\"\n class=\"gog-ms__clear gog-inline-center\"\n (click)=\"clearTrigger($event)\"\n aria-label=\"Clear selection\"\n >\n <gog-icon [template]=\"clearIconTemplate()\" name=\"close\" />\n </button>\n }\n <span class=\"gog-ms__arrow\" [class.gog-ms__arrow--up]=\"isOpen()\" aria-hidden=\"true\">\n <gog-icon [template]=\"chevronTemplate()\" [name]=\"isOpen() ? 'chevron-up' : 'chevron-down'\" />\n </span>\n </span>\n </div>\n\n @if (isOpen()) {\n <div\n [id]=\"'gog-ms-listbox-' + instanceId\"\n class=\"gog-ms__dropdown\"\n [class.gog-ms__dropdown--up]=\"dropdownDirectionState() === 'up'\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [style.z-index]=\"dropdownZIndex() ?? null\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (showControls()) {\n <div class=\"gog-ms__controls\">\n <gog-button variant=\"ghost\" size=\"sm\" (click)=\"selectAll($event)\">Select all</gog-button>\n <gog-button variant=\"ghost\" size=\"sm\" (click)=\"clearAll($event)\">Clear</gog-button>\n </div>\n }\n <div class=\"gog-ms__options\">\n @for (option of options(); track option.id) {\n <button\n type=\"button\"\n class=\"gog-ms__option font-body\"\n role=\"option\"\n [attr.aria-selected]=\"isSelected(option.id)\"\n [class.gog-ms__option--selected]=\"isSelected(option.id)\"\n (click)=\"toggleOption(option, $event)\"\n >\n <span class=\"gog-ms__option-mark\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" focusable=\"false\" aria-hidden=\"true\">\n <rect\n x=\"2.5\"\n y=\"2.5\"\n width=\"11\"\n height=\"11\"\n rx=\"2\"\n [attr.fill]=\"isSelected(option.id) ? 'currentColor' : 'none'\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n />\n @if (isSelected(option.id)) {\n <path\n d=\"M4 8L6.75 10.75L12 5.5\"\n stroke=\"var(--gog-ms-checkbox-checked-color)\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n }\n </svg>\n </span>\n {{ option.name }}\n </button>\n }\n </div>\n </div>\n }\n\n @if (visibleError()) {\n <span class=\"gog-ms__error font-body\" role=\"alert\">{{ visibleError() }}</span>\n }\n</div>\n", styles: [".gog-ms-wrapper{--gog-ms-gap: 4px;--gog-ms-option-gap: 4px;--gog-ms-options-padding: 4px;--gog-ms-label-color: var(--accent-color);--gog-ms-field-bg: var(--surface-color);--gog-ms-field-border: var(--accent-dim);--gog-ms-field-color: var(--text-color);--gog-ms-value-color: var(--text-color);--gog-ms-placeholder-color: var(--muted-text-color);--gog-ms-focus-border: var(--accent-color);--gog-ms-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-ms-error-color: var(--danger-color);--gog-ms-border-color: var(--accent-color);--gog-ms-panel-bg: var(--surface-color);--gog-ms-panel-border: var(--accent-color);--gog-ms-panel-shadow: 0 8px 24px rgba(0, 0, 0, .3);--gog-ms-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-ms-checkbox-border: var(--accent-dim);--gog-ms-checkbox-bg: var(--background-color);--gog-ms-checkbox-checked-bg: var(--accent-color);--gog-ms-checkbox-checked-color: var(--primary-color);--gog-ms-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-ms-gap);position:relative;width:100%}.gog-ms__label{font-size:var(--text-sm);color:var(--gog-ms-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-ms{--gog-ms-padding-y: var(--control-padding-y, 10px);--gog-ms-padding-x: var(--control-padding-x, 14px);display:flex;align-items:center;justify-content:space-between;padding:var(--gog-ms-padding-y) var(--gog-ms-padding-x);background-color:var(--gog-ms-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border);border-radius:var(--radius);color:var(--gog-ms-field-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s ease,box-shadow .15s ease;min-height:44px}.gog-ms:hover:not(.gog-ms--disabled){border-color:var(--gog-ms-focus-border)}.gog-ms:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms--open{border-color:var(--gog-ms-border-color);box-shadow:0 0 8px var(--gog-ms-focus-ring)}.gog-ms--disabled{opacity:var(--gog-ms-disabled-opacity);cursor:not-allowed}.gog-ms--disabled .gog-ms__label{cursor:not-allowed}.gog-ms--error{border-color:var(--gog-ms-error-color)}.gog-ms__value{font-size:var(--text-md);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gog-ms-value-color)}.gog-ms__value--placeholder{color:var(--gog-ms-placeholder-color)}.gog-ms__actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.gog-ms__clear{width:1rem;height:1rem;padding:0;border:0;border-radius:var(--gog-ms-clear-radius, 2px);background:transparent;color:var(--gog-ms-placeholder-color);line-height:1;cursor:pointer;transition:color .15s ease}.gog-ms__clear gog-icon{font-size:.7rem}.gog-ms__clear:hover{color:var(--gog-ms-field-color)}.gog-ms__clear:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms__arrow{color:var(--gog-ms-border-color);transition:transform .2s ease;display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem}.gog-ms__arrow gog-icon{font-size:.875rem}.gog-ms__arrow--up{transform:rotate(180deg)}.gog-ms__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--gog-ms-panel-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-panel-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-ms__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-ms__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-ms__controls{display:flex;gap:4px;padding:6px 10px;border-bottom:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border)}.gog-ms__options{display:flex;flex-direction:column;padding:var(--gog-ms-options-padding);gap:var(--gog-ms-option-gap)}.gog-ms__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-ms-padding-x);border:0;background:transparent;text-align:left;font:inherit;font-size:var(--text-md);cursor:pointer;border-radius:calc(var(--radius) - 2px);transition:background-color .12s ease;color:var(--text-color)}.gog-ms__option:hover{background-color:var(--gog-ms-option-hover-bg)}.gog-ms__option--selected{color:var(--gog-ms-border-color)}.gog-ms__option:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:-3px}.gog-ms__option-mark{display:flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--gog-ms-checkbox-border)}.gog-ms__option--selected .gog-ms__option-mark{color:var(--gog-ms-checkbox-checked-bg)}.gog-ms__option-mark svg{width:18px;height:18px}.gog-ms__error{font-size:var(--text-xs);color:var(--gog-ms-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-ms,.gog-ms__clear,.gog-ms__arrow,.gog-ms__option,.gog-ms__option-mark{transition:none}}\n"], dependencies: [{ kind: "component", type: ButtonComponent, selector: "gog-button", inputs: ["variant", "size", "disabled", "fullWidth", "type", "debounce", "loading"], outputs: ["gogClick"] }, { kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1789
|
+
}
|
|
1790
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: MultiselectComponent, decorators: [{
|
|
1791
|
+
type: Component,
|
|
1792
|
+
args: [{ selector: 'gog-multiselect', imports: [ButtonComponent, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1793
|
+
'(document:click)': 'onDocumentClick($event)',
|
|
1794
|
+
'(window:scroll)': 'onScrollOrResize()',
|
|
1795
|
+
'(window:resize)': 'onScrollOrResize()',
|
|
1796
|
+
}, template: "<div class=\"gog-ms-wrapper gog-contained-layout\">\n @if (label()) {\n <label class=\"gog-ms__label font-heading\">{{ label() }}</label>\n }\n\n <div\n class=\"gog-ms\"\n role=\"combobox\"\n tabindex=\"0\"\n [attr.aria-expanded]=\"isOpen()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"'gog-ms-listbox-' + instanceId\"\n [attr.aria-disabled]=\"isDisabled()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || placeholder() || 'Select'\"\n [class.gog-ms--open]=\"isOpen()\"\n [class.gog-ms--disabled]=\"isDisabled()\"\n [class.gog-ms--error]=\"hasError()\"\n (click)=\"toggle()\"\n (keydown.enter)=\"toggle()\"\n (keydown.space)=\"toggle(); $event.preventDefault()\"\n (keydown.escape)=\"close()\"\n >\n <span class=\"gog-ms__value font-body\" [class.gog-ms__value--placeholder]=\"!selectedNames()\">\n {{ selectedNames() || placeholder() }}\n </span>\n\n <span class=\"gog-ms__actions\">\n @if (selectedNames()) {\n <button\n type=\"button\"\n type=\"button\"\n class=\"gog-ms__clear gog-inline-center\"\n (click)=\"clearTrigger($event)\"\n aria-label=\"Clear selection\"\n >\n <gog-icon [template]=\"clearIconTemplate()\" name=\"close\" />\n </button>\n }\n <span class=\"gog-ms__arrow\" [class.gog-ms__arrow--up]=\"isOpen()\" aria-hidden=\"true\">\n <gog-icon [template]=\"chevronTemplate()\" [name]=\"isOpen() ? 'chevron-up' : 'chevron-down'\" />\n </span>\n </span>\n </div>\n\n @if (isOpen()) {\n <div\n [id]=\"'gog-ms-listbox-' + instanceId\"\n class=\"gog-ms__dropdown\"\n [class.gog-ms__dropdown--up]=\"dropdownDirectionState() === 'up'\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [style.z-index]=\"dropdownZIndex() ?? null\"\n (click)=\"$event.stopPropagation()\"\n >\n @if (showControls()) {\n <div class=\"gog-ms__controls\">\n <gog-button variant=\"ghost\" size=\"sm\" (click)=\"selectAll($event)\">Select all</gog-button>\n <gog-button variant=\"ghost\" size=\"sm\" (click)=\"clearAll($event)\">Clear</gog-button>\n </div>\n }\n <div class=\"gog-ms__options\">\n @for (option of options(); track option.id) {\n <button\n type=\"button\"\n class=\"gog-ms__option font-body\"\n role=\"option\"\n [attr.aria-selected]=\"isSelected(option.id)\"\n [class.gog-ms__option--selected]=\"isSelected(option.id)\"\n (click)=\"toggleOption(option, $event)\"\n >\n <span class=\"gog-ms__option-mark\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 16 16\" fill=\"none\" focusable=\"false\" aria-hidden=\"true\">\n <rect\n x=\"2.5\"\n y=\"2.5\"\n width=\"11\"\n height=\"11\"\n rx=\"2\"\n [attr.fill]=\"isSelected(option.id) ? 'currentColor' : 'none'\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n />\n @if (isSelected(option.id)) {\n <path\n d=\"M4 8L6.75 10.75L12 5.5\"\n stroke=\"var(--gog-ms-checkbox-checked-color)\"\n stroke-width=\"1.75\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n }\n </svg>\n </span>\n {{ option.name }}\n </button>\n }\n </div>\n </div>\n }\n\n @if (visibleError()) {\n <span class=\"gog-ms__error font-body\" role=\"alert\">{{ visibleError() }}</span>\n }\n</div>\n", styles: [".gog-ms-wrapper{--gog-ms-gap: 4px;--gog-ms-option-gap: 4px;--gog-ms-options-padding: 4px;--gog-ms-label-color: var(--accent-color);--gog-ms-field-bg: var(--surface-color);--gog-ms-field-border: var(--accent-dim);--gog-ms-field-color: var(--text-color);--gog-ms-value-color: var(--text-color);--gog-ms-placeholder-color: var(--muted-text-color);--gog-ms-focus-border: var(--accent-color);--gog-ms-focus-ring: color-mix(in srgb, var(--accent-color) 25%, transparent);--gog-ms-error-color: var(--danger-color);--gog-ms-border-color: var(--accent-color);--gog-ms-panel-bg: var(--surface-color);--gog-ms-panel-border: var(--accent-color);--gog-ms-panel-shadow: 0 8px 24px rgba(0, 0, 0, .3);--gog-ms-option-hover-bg: color-mix(in srgb, var(--accent-color) 10%, transparent);--gog-ms-checkbox-border: var(--accent-dim);--gog-ms-checkbox-bg: var(--background-color);--gog-ms-checkbox-checked-bg: var(--accent-color);--gog-ms-checkbox-checked-color: var(--primary-color);--gog-ms-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-ms-gap);position:relative;width:100%}.gog-ms__label{font-size:var(--text-sm);color:var(--gog-ms-label-color);text-transform:uppercase;letter-spacing:1px;cursor:pointer}.gog-ms{--gog-ms-padding-y: var(--control-padding-y, 10px);--gog-ms-padding-x: var(--control-padding-x, 14px);display:flex;align-items:center;justify-content:space-between;padding:var(--gog-ms-padding-y) var(--gog-ms-padding-x);background-color:var(--gog-ms-field-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border);border-radius:var(--radius);color:var(--gog-ms-field-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color .15s ease,box-shadow .15s ease;min-height:44px}.gog-ms:hover:not(.gog-ms--disabled){border-color:var(--gog-ms-focus-border)}.gog-ms:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms--open{border-color:var(--gog-ms-border-color);box-shadow:0 0 8px var(--gog-ms-focus-ring)}.gog-ms--disabled{opacity:var(--gog-ms-disabled-opacity);cursor:not-allowed}.gog-ms--disabled .gog-ms__label{cursor:not-allowed}.gog-ms--error{border-color:var(--gog-ms-error-color)}.gog-ms__value{font-size:var(--text-md);flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--gog-ms-value-color)}.gog-ms__value--placeholder{color:var(--gog-ms-placeholder-color)}.gog-ms__actions{display:flex;align-items:center;gap:6px;flex-shrink:0}.gog-ms__clear{width:1rem;height:1rem;padding:0;border:0;border-radius:var(--gog-ms-clear-radius, 2px);background:transparent;color:var(--gog-ms-placeholder-color);line-height:1;cursor:pointer;transition:color .15s ease}.gog-ms__clear gog-icon{font-size:.7rem}.gog-ms__clear:hover{color:var(--gog-ms-field-color)}.gog-ms__clear:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:2px}.gog-ms__arrow{color:var(--gog-ms-border-color);transition:transform .2s ease;display:inline-flex;align-items:center;justify-content:center;width:1rem;height:1rem}.gog-ms__arrow gog-icon{font-size:.875rem}.gog-ms__arrow--up{transform:rotate(180deg)}.gog-ms__dropdown{position:absolute;top:calc(100% + 2px);left:0;right:0;z-index:var(--dropdown-z, 300);background-color:var(--gog-ms-panel-bg);border:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-panel-border);border-radius:var(--radius);max-height:260px;overflow-y:auto;box-shadow:var(--panel-shadow)}.gog-ms__dropdown--up{top:auto;bottom:calc(100% + 2px)}.gog-ms__dropdown--portal{position:fixed;top:unset;bottom:unset;left:unset;right:unset}.gog-ms__controls{display:flex;gap:4px;padding:6px 10px;border-bottom:var(--control-border-width, 2px) var(--control-border-style, solid) var(--gog-ms-field-border)}.gog-ms__options{display:flex;flex-direction:column;padding:var(--gog-ms-options-padding);gap:var(--gog-ms-option-gap)}.gog-ms__option{width:100%;display:flex;align-items:center;gap:10px;padding:var(--control-padding-y, 10px) var(--gog-ms-padding-x);border:0;background:transparent;text-align:left;font:inherit;font-size:var(--text-md);cursor:pointer;border-radius:calc(var(--radius) - 2px);transition:background-color .12s ease;color:var(--text-color)}.gog-ms__option:hover{background-color:var(--gog-ms-option-hover-bg)}.gog-ms__option--selected{color:var(--gog-ms-border-color)}.gog-ms__option:focus-visible{outline:3px solid var(--gog-ms-focus-ring);outline-offset:-3px}.gog-ms__option-mark{display:flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0;color:var(--gog-ms-checkbox-border)}.gog-ms__option--selected .gog-ms__option-mark{color:var(--gog-ms-checkbox-checked-bg)}.gog-ms__option-mark svg{width:18px;height:18px}.gog-ms__error{font-size:var(--text-xs);color:var(--gog-ms-error-color);margin-top:2px}@media(prefers-reduced-motion:reduce){.gog-ms,.gog-ms__clear,.gog-ms__arrow,.gog-ms__option,.gog-ms__option-mark{transition:none}}\n"] }]
|
|
1797
|
+
}], ctorParameters: () => [], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], showControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "showControls", required: false }] }], dropdownDirection: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownDirection", required: false }] }], dropdownZIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "dropdownZIndex", required: false }] }], appendToBody: [{ type: i0.Input, args: [{ isSignal: true, alias: "appendToBody", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], chevronTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "chevronTemplate", required: false }] }], clearIconTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearIconTemplate", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1798
|
+
|
|
1799
|
+
class SliderComponent {
|
|
1800
|
+
static nextId = 0;
|
|
1801
|
+
inputId = `gog-slider-${++SliderComponent.nextId}`;
|
|
1802
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1803
|
+
min = input(0, ...(ngDevMode ? [{ debugName: "min" }] : /* istanbul ignore next */ []));
|
|
1804
|
+
max = input(100, ...(ngDevMode ? [{ debugName: "max" }] : /* istanbul ignore next */ []));
|
|
1805
|
+
step = input(1, ...(ngDevMode ? [{ debugName: "step" }] : /* istanbul ignore next */ []));
|
|
1806
|
+
showValue = input(true, ...(ngDevMode ? [{ debugName: "showValue" }] : /* istanbul ignore next */ []));
|
|
1807
|
+
showThumb = input(true, ...(ngDevMode ? [{ debugName: "showThumb" }] : /* istanbul ignore next */ []));
|
|
1808
|
+
errorMessage = input('', ...(ngDevMode ? [{ debugName: "errorMessage" }] : /* istanbul ignore next */ []));
|
|
1809
|
+
ariaLabel = input('', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1810
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
1811
|
+
/** Two-way bindable value: `[(value)]="signal"`. */
|
|
1812
|
+
value = model(0, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1813
|
+
cvaDisabled = signal(false, ...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
1814
|
+
isDisabled = computed(() => this.disabled() || this.cvaDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
1815
|
+
clampedValue = computed(() => {
|
|
1816
|
+
const value = this.value();
|
|
1817
|
+
return Math.min(this.max(), Math.max(this.min(), value));
|
|
1818
|
+
}, ...(ngDevMode ? [{ debugName: "clampedValue" }] : /* istanbul ignore next */ []));
|
|
1819
|
+
fillPercent = computed(() => {
|
|
1820
|
+
const range = this.max() - this.min();
|
|
1821
|
+
if (range === 0)
|
|
1822
|
+
return 0;
|
|
1823
|
+
return ((this.clampedValue() - this.min()) / range) * 100;
|
|
1824
|
+
}, ...(ngDevMode ? [{ debugName: "fillPercent" }] : /* istanbul ignore next */ []));
|
|
1825
|
+
thumbPos = computed(() => `${this.fillPercent()}%`, ...(ngDevMode ? [{ debugName: "thumbPos" }] : /* istanbul ignore next */ []));
|
|
1826
|
+
fillScale = computed(() => this.fillPercent() / 100, ...(ngDevMode ? [{ debugName: "fillScale" }] : /* istanbul ignore next */ []));
|
|
1827
|
+
errorId = computed(() => (this.errorMessage() ? `${this.inputId}-error` : null), ...(ngDevMode ? [{ debugName: "errorId" }] : /* istanbul ignore next */ []));
|
|
1828
|
+
onChange = () => { };
|
|
1829
|
+
onTouched = () => { };
|
|
1830
|
+
writeValue(val) {
|
|
1831
|
+
const next = val ?? this.min();
|
|
1832
|
+
this.value.set(Math.min(this.max(), Math.max(this.min(), next)));
|
|
1833
|
+
}
|
|
1834
|
+
registerOnChange(fn) {
|
|
1835
|
+
this.onChange = fn;
|
|
1836
|
+
}
|
|
1837
|
+
registerOnTouched(fn) {
|
|
1838
|
+
this.onTouched = fn;
|
|
1839
|
+
}
|
|
1840
|
+
setDisabledState(isDisabled) {
|
|
1841
|
+
this.cvaDisabled.set(isDisabled);
|
|
1842
|
+
}
|
|
1843
|
+
onInput(event) {
|
|
1844
|
+
const input = event.target;
|
|
1845
|
+
const next = Number(input.value);
|
|
1846
|
+
const value = Math.min(this.max(), Math.max(this.min(), next));
|
|
1847
|
+
this.value.set(value);
|
|
1848
|
+
this.onChange(value);
|
|
1849
|
+
}
|
|
1850
|
+
onBlur() {
|
|
1851
|
+
this.onTouched();
|
|
1852
|
+
}
|
|
1853
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1854
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SliderComponent, isStandalone: true, selector: "gog-slider", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, showThumb: { classPropertyName: "showThumb", publicName: "showThumb", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "style.--thumb-pos": "thumbPos()", "style.--fill-scale": "fillScale()" } }, providers: [
|
|
1855
|
+
{
|
|
1856
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1857
|
+
useExisting: forwardRef(() => SliderComponent),
|
|
1858
|
+
multi: true,
|
|
1859
|
+
},
|
|
1860
|
+
], ngImport: i0, template: "<div\n class=\"gog-slider gog-contained-layout\"\n [class.gog-slider--disabled]=\"isDisabled()\"\n [class.gog-slider--thumb-hidden]=\"!showThumb()\"\n>\n <div class=\"gog-slider__header\">\n @if (label()) {\n <label [attr.for]=\"inputId\" class=\"gog-slider__label font-heading\">{{ label() }}</label>\n }\n\n @if (showValue()) {\n <span class=\"gog-slider__value font-mono\">{{ clampedValue() }}</span>\n }\n </div>\n\n <div class=\"gog-slider__track-container\">\n <div class=\"gog-slider__track\">\n <div class=\"gog-slider__fill\"></div>\n </div>\n\n @if (showThumb()) {\n <div class=\"gog-slider__thumb\" aria-hidden=\"true\"></div>\n }\n\n <input\n [id]=\"inputId\"\n class=\"gog-slider__input\"\n type=\"range\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || 'Slider'\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"clampedValue()\"\n [attr.aria-invalid]=\"!!errorMessage()\"\n [attr.aria-describedby]=\"errorId()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"clampedValue()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n\n <div class=\"gog-slider__range-labels font-mono\">\n <span>{{ min() }}</span>\n <span>{{ max() }}</span>\n </div>\n\n @if (errorMessage()) {\n <span class=\"gog-slider__error font-body\" [attr.id]=\"errorId()\" role=\"alert\">\n {{ errorMessage() }}\n </span>\n }\n</div>\n", styles: [":host{display:block}.gog-slider{--gog-slider-gap: 6px;--gog-slider-label-color: var(--accent-color);--gog-slider-value-color: var(--accent-color);--gog-slider-track-bg: var(--accent-dim);--gog-slider-fill-bg: var(--accent-color);--gog-slider-thumb-bg: var(--accent-color);--gog-slider-thumb-border: var(--background-color);--gog-slider-thumb-shadow: color-mix(in srgb, var(--accent-bright) 40%, transparent);--gog-slider-focus-ring: color-mix(in srgb, var(--accent-color) 30%, transparent);--gog-slider-range-color: var(--muted-text-color);--gog-slider-error-color: var(--danger-color);--gog-slider-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-slider-gap);width:100%}.gog-slider--disabled{opacity:var(--gog-slider-disabled-opacity);pointer-events:none}.gog-slider--thumb-hidden .gog-slider__thumb{display:none}.gog-slider__header{display:flex;align-items:center;justify-content:space-between}.gog-slider__label{font-size:var(--text-sm);color:var(--gog-slider-label-color);text-transform:uppercase;letter-spacing:1px}.gog-slider__value{min-width:40px;font-size:var(--text-sm);color:var(--gog-slider-value-color);text-align:right}.gog-slider__track-container{position:relative;display:flex;align-items:center;height:20px}.gog-slider__track{position:absolute;inset-inline:0;height:4px;overflow:hidden;background-color:var(--gog-slider-track-bg);pointer-events:none}.gog-slider__fill{width:100%;height:100%;background-color:var(--gog-slider-fill-bg);transform:scaleX(var(--fill-scale, 0));transform-origin:left center;will-change:transform}.gog-slider__thumb{position:absolute;top:50%;left:var(--thumb-pos, 0%);width:16px;height:16px;border:2px solid var(--gog-slider-thumb-border);border-radius:50%;background-color:var(--gog-slider-thumb-bg);pointer-events:none;translate:-50% -50%;will-change:translate;box-shadow:0 0 6px var(--gog-slider-thumb-shadow)}.gog-slider__track-container:focus-within .gog-slider__thumb{box-shadow:0 0 0 3px var(--gog-slider-focus-ring),0 0 6px var(--gog-slider-thumb-shadow)}.gog-slider__input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;outline:none}.gog-slider__range-labels{display:flex;justify-content:space-between;font-size:var(--text-xs);color:var(--gog-slider-range-color)}.gog-slider__error{font-size:var(--text-xs);color:var(--gog-slider-error-color)}@media(prefers-reduced-motion:reduce){.gog-slider__fill,.gog-slider__thumb{will-change:auto}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1861
|
+
}
|
|
1862
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SliderComponent, decorators: [{
|
|
1863
|
+
type: Component,
|
|
1864
|
+
args: [{ selector: 'gog-slider', imports: [], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1865
|
+
{
|
|
1866
|
+
provide: NG_VALUE_ACCESSOR,
|
|
1867
|
+
useExisting: forwardRef(() => SliderComponent),
|
|
1868
|
+
multi: true,
|
|
1869
|
+
},
|
|
1870
|
+
], host: {
|
|
1871
|
+
'[style.--thumb-pos]': 'thumbPos()',
|
|
1872
|
+
'[style.--fill-scale]': 'fillScale()',
|
|
1873
|
+
}, template: "<div\n class=\"gog-slider gog-contained-layout\"\n [class.gog-slider--disabled]=\"isDisabled()\"\n [class.gog-slider--thumb-hidden]=\"!showThumb()\"\n>\n <div class=\"gog-slider__header\">\n @if (label()) {\n <label [attr.for]=\"inputId\" class=\"gog-slider__label font-heading\">{{ label() }}</label>\n }\n\n @if (showValue()) {\n <span class=\"gog-slider__value font-mono\">{{ clampedValue() }}</span>\n }\n </div>\n\n <div class=\"gog-slider__track-container\">\n <div class=\"gog-slider__track\">\n <div class=\"gog-slider__fill\"></div>\n </div>\n\n @if (showThumb()) {\n <div class=\"gog-slider__thumb\" aria-hidden=\"true\"></div>\n }\n\n <input\n [id]=\"inputId\"\n class=\"gog-slider__input\"\n type=\"range\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || 'Slider'\"\n [attr.aria-valuemin]=\"min()\"\n [attr.aria-valuemax]=\"max()\"\n [attr.aria-valuenow]=\"clampedValue()\"\n [attr.aria-invalid]=\"!!errorMessage()\"\n [attr.aria-describedby]=\"errorId()\"\n [min]=\"min()\"\n [max]=\"max()\"\n [step]=\"step()\"\n [value]=\"clampedValue()\"\n [disabled]=\"isDisabled()\"\n (input)=\"onInput($event)\"\n (blur)=\"onBlur()\"\n />\n </div>\n\n <div class=\"gog-slider__range-labels font-mono\">\n <span>{{ min() }}</span>\n <span>{{ max() }}</span>\n </div>\n\n @if (errorMessage()) {\n <span class=\"gog-slider__error font-body\" [attr.id]=\"errorId()\" role=\"alert\">\n {{ errorMessage() }}\n </span>\n }\n</div>\n", styles: [":host{display:block}.gog-slider{--gog-slider-gap: 6px;--gog-slider-label-color: var(--accent-color);--gog-slider-value-color: var(--accent-color);--gog-slider-track-bg: var(--accent-dim);--gog-slider-fill-bg: var(--accent-color);--gog-slider-thumb-bg: var(--accent-color);--gog-slider-thumb-border: var(--background-color);--gog-slider-thumb-shadow: color-mix(in srgb, var(--accent-bright) 40%, transparent);--gog-slider-focus-ring: color-mix(in srgb, var(--accent-color) 30%, transparent);--gog-slider-range-color: var(--muted-text-color);--gog-slider-error-color: var(--danger-color);--gog-slider-disabled-opacity: .4;display:flex;flex-direction:column;gap:var(--gog-slider-gap);width:100%}.gog-slider--disabled{opacity:var(--gog-slider-disabled-opacity);pointer-events:none}.gog-slider--thumb-hidden .gog-slider__thumb{display:none}.gog-slider__header{display:flex;align-items:center;justify-content:space-between}.gog-slider__label{font-size:var(--text-sm);color:var(--gog-slider-label-color);text-transform:uppercase;letter-spacing:1px}.gog-slider__value{min-width:40px;font-size:var(--text-sm);color:var(--gog-slider-value-color);text-align:right}.gog-slider__track-container{position:relative;display:flex;align-items:center;height:20px}.gog-slider__track{position:absolute;inset-inline:0;height:4px;overflow:hidden;background-color:var(--gog-slider-track-bg);pointer-events:none}.gog-slider__fill{width:100%;height:100%;background-color:var(--gog-slider-fill-bg);transform:scaleX(var(--fill-scale, 0));transform-origin:left center;will-change:transform}.gog-slider__thumb{position:absolute;top:50%;left:var(--thumb-pos, 0%);width:16px;height:16px;border:2px solid var(--gog-slider-thumb-border);border-radius:50%;background-color:var(--gog-slider-thumb-bg);pointer-events:none;translate:-50% -50%;will-change:translate;box-shadow:0 0 6px var(--gog-slider-thumb-shadow)}.gog-slider__track-container:focus-within .gog-slider__thumb{box-shadow:0 0 0 3px var(--gog-slider-focus-ring),0 0 6px var(--gog-slider-thumb-shadow)}.gog-slider__input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer;outline:none}.gog-slider__range-labels{display:flex;justify-content:space-between;font-size:var(--text-xs);color:var(--gog-slider-range-color)}.gog-slider__error{font-size:var(--text-xs);color:var(--gog-slider-error-color)}@media(prefers-reduced-motion:reduce){.gog-slider__fill,.gog-slider__thumb{will-change:auto}}\n"] }]
|
|
1874
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], showThumb: [{ type: i0.Input, args: [{ isSignal: true, alias: "showThumb", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }] } });
|
|
1875
|
+
|
|
1876
|
+
class SpinnerOverlayComponent {
|
|
1877
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1878
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1879
|
+
ariaLabel = input('Loading', ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1880
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SpinnerOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1881
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: SpinnerOverlayComponent, isStandalone: true, selector: "gog-spinner-overlay", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "loading() ? \"true\" : null" }, classAttribute: "gog-spinner-overlay-host" }, ngImport: i0, template: "<div class=\"gog-spinner-overlay\">\r\n <div class=\"gog-spinner-overlay__content\">\r\n <ng-content />\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"gog-spinner-overlay__scrim\">\r\n <gog-spinner [size]=\"size()\" [ariaLabel]=\"ariaLabel()\" />\r\n </div>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.gog-spinner-overlay{position:relative}.gog-spinner-overlay__content{min-height:inherit}.gog-spinner-overlay__scrim{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:var(--gog-spinner-overlay-bg, rgba(10, 8, 3, .65));-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:gog-spinner-overlay-fade-in .2s ease}@keyframes gog-spinner-overlay-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.gog-spinner-overlay__scrim{animation:none}}\n"], dependencies: [{ kind: "component", type: SpinnerComponent, selector: "gog-spinner", inputs: ["size", "overlay", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1882
|
+
}
|
|
1883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: SpinnerOverlayComponent, decorators: [{
|
|
1884
|
+
type: Component,
|
|
1885
|
+
args: [{ selector: 'gog-spinner-overlay', imports: [SpinnerComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1886
|
+
class: 'gog-spinner-overlay-host',
|
|
1887
|
+
'[attr.aria-busy]': 'loading() ? "true" : null',
|
|
1888
|
+
}, template: "<div class=\"gog-spinner-overlay\">\r\n <div class=\"gog-spinner-overlay__content\">\r\n <ng-content />\r\n </div>\r\n\r\n @if (loading()) {\r\n <div class=\"gog-spinner-overlay__scrim\">\r\n <gog-spinner [size]=\"size()\" [ariaLabel]=\"ariaLabel()\" />\r\n </div>\r\n }\r\n</div>\r\n", styles: [":host{display:block}.gog-spinner-overlay{position:relative}.gog-spinner-overlay__content{min-height:inherit}.gog-spinner-overlay__scrim{position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:var(--gog-spinner-overlay-bg, rgba(10, 8, 3, .65));-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);animation:gog-spinner-overlay-fade-in .2s ease}@keyframes gog-spinner-overlay-fade-in{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.gog-spinner-overlay__scrim{animation:none}}\n"] }]
|
|
1889
|
+
}], propDecorators: { loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
1890
|
+
|
|
1891
|
+
class Column {
|
|
1892
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : /* istanbul ignore next */ []));
|
|
1893
|
+
header = input('', ...(ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []));
|
|
1894
|
+
sortable = input(false, ...(ngDevMode ? [{ debugName: "sortable" }] : /* istanbul ignore next */ []));
|
|
1895
|
+
/** Fixed width, e.g. "120px" or "20%" */
|
|
1896
|
+
width = input('', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
1897
|
+
/** Min width, e.g. "80px" */
|
|
1898
|
+
minWidth = input('', ...(ngDevMode ? [{ debugName: "minWidth" }] : /* istanbul ignore next */ []));
|
|
1899
|
+
/** Max width, e.g. "300px" */
|
|
1900
|
+
maxWidth = input('', ...(ngDevMode ? [{ debugName: "maxWidth" }] : /* istanbul ignore next */ []));
|
|
1901
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: Column, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1902
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.17", type: Column, isStandalone: true, selector: "column", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, sortable: { classPropertyName: "sortable", publicName: "sortable", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, minWidth: { classPropertyName: "minWidth", publicName: "minWidth", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
1903
|
+
}
|
|
1904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: Column, decorators: [{
|
|
1905
|
+
type: Directive,
|
|
1906
|
+
args: [{
|
|
1907
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
1908
|
+
selector: 'column',
|
|
1909
|
+
}]
|
|
1910
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], sortable: [{ type: i0.Input, args: [{ isSignal: true, alias: "sortable", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], minWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "minWidth", required: false }] }], maxWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxWidth", required: false }] }] } });
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* Marks a <ng-template> inside <gog-table> with a field name and optional type.
|
|
1914
|
+
*
|
|
1915
|
+
* Usage:
|
|
1916
|
+
* <ng-template template="status" type="body" let-row>...</ng-template>
|
|
1917
|
+
* <ng-template template="status" type="header">...</ng-template>
|
|
1918
|
+
*/
|
|
1919
|
+
class TemplateDirective {
|
|
1920
|
+
template = input.required(...(ngDevMode ? [{ debugName: "template" }] : /* istanbul ignore next */ []));
|
|
1921
|
+
type = input('body', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1922
|
+
templateRef = inject((TemplateRef));
|
|
1923
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
1924
|
+
return true;
|
|
1925
|
+
}
|
|
1926
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1927
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.17", type: TemplateDirective, isStandalone: true, selector: "[template]", inputs: { template: { classPropertyName: "template", publicName: "template", isSignal: true, isRequired: true, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
1928
|
+
}
|
|
1929
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TemplateDirective, decorators: [{
|
|
1930
|
+
type: Directive,
|
|
1931
|
+
args: [{
|
|
1932
|
+
selector: '[template]',
|
|
1933
|
+
}]
|
|
1934
|
+
}], propDecorators: { template: [{ type: i0.Input, args: [{ isSignal: true, alias: "template", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }] } });
|
|
1935
|
+
|
|
1936
|
+
class TableComponent {
|
|
1937
|
+
value = input([], ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
1938
|
+
/** 0 = no pagination */
|
|
1939
|
+
pageSize = input(0, ...(ngDevMode ? [{ debugName: "pageSize" }] : /* istanbul ignore next */ []));
|
|
1940
|
+
showRowNumbers = input(true, ...(ngDevMode ? [{ debugName: "showRowNumbers" }] : /* istanbul ignore next */ []));
|
|
1941
|
+
showTotal = input(false, ...(ngDevMode ? [{ debugName: "showTotal" }] : /* istanbul ignore next */ []));
|
|
1942
|
+
emptyPlaceholder = input('-', ...(ngDevMode ? [{ debugName: "emptyPlaceholder" }] : /* istanbul ignore next */ []));
|
|
1943
|
+
/** Alignment of pagination controls */
|
|
1944
|
+
paginatorPosition = input('center', ...(ngDevMode ? [{ debugName: "paginatorPosition" }] : /* istanbul ignore next */ []));
|
|
1945
|
+
/** Alignment of total count label (only when showTotal=true) */
|
|
1946
|
+
totalPosition = input('opposite', ...(ngDevMode ? [{ debugName: "totalPosition" }] : /* istanbul ignore next */ []));
|
|
1947
|
+
/** Show loading spinner instead of rows */
|
|
1948
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
1949
|
+
/** Show vertical borders between columns */
|
|
1950
|
+
showColumnBorders = input(false, ...(ngDevMode ? [{ debugName: "showColumnBorders" }] : /* istanbul ignore next */ []));
|
|
1951
|
+
/** Stick header row to the top of the viewport while scrolling */
|
|
1952
|
+
stickyHeader = input(false, ...(ngDevMode ? [{ debugName: "stickyHeader" }] : /* istanbul ignore next */ []));
|
|
1953
|
+
/** Row density: lg (default) / md (compact) / sm (dense) */
|
|
1954
|
+
size = input('lg', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1955
|
+
columns = contentChildren(Column, ...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1956
|
+
templates = contentChildren(TemplateDirective, ...(ngDevMode ? [{ debugName: "templates" }] : /* istanbul ignore next */ []));
|
|
1957
|
+
currentPage = signal(1, ...(ngDevMode ? [{ debugName: "currentPage" }] : /* istanbul ignore next */ []));
|
|
1958
|
+
sortState = signal({ field: '', direction: null }, ...(ngDevMode ? [{ debugName: "sortState" }] : /* istanbul ignore next */ []));
|
|
1959
|
+
constructor() {
|
|
1960
|
+
effect(() => {
|
|
1961
|
+
this.value();
|
|
1962
|
+
this.pageSize();
|
|
1963
|
+
this.currentPage();
|
|
1964
|
+
const total = this.totalPages();
|
|
1965
|
+
if (this.currentPage() > total) {
|
|
1966
|
+
this.currentPage.set(total);
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
}
|
|
1970
|
+
sortedData = computed(() => {
|
|
1971
|
+
const { field, direction } = this.sortState();
|
|
1972
|
+
const rows = [...this.value()];
|
|
1973
|
+
if (!field || !direction)
|
|
1974
|
+
return rows;
|
|
1975
|
+
return rows.sort((a, b) => {
|
|
1976
|
+
const av = a[field];
|
|
1977
|
+
const bv = b[field];
|
|
1978
|
+
if (av == null && bv == null)
|
|
1979
|
+
return 0;
|
|
1980
|
+
if (av == null)
|
|
1981
|
+
return 1;
|
|
1982
|
+
if (bv == null)
|
|
1983
|
+
return -1;
|
|
1984
|
+
const cmp = av < bv ? -1 : av > bv ? 1 : 0;
|
|
1985
|
+
return direction === 'asc' ? cmp : -cmp;
|
|
1986
|
+
});
|
|
1987
|
+
}, ...(ngDevMode ? [{ debugName: "sortedData" }] : /* istanbul ignore next */ []));
|
|
1988
|
+
totalPages = computed(() => {
|
|
1989
|
+
const size = this.pageSize();
|
|
1990
|
+
if (!size)
|
|
1991
|
+
return 1;
|
|
1992
|
+
return Math.max(1, Math.ceil(this.sortedData().length / size));
|
|
1993
|
+
}, ...(ngDevMode ? [{ debugName: "totalPages" }] : /* istanbul ignore next */ []));
|
|
1994
|
+
visibleRows = computed(() => {
|
|
1995
|
+
const size = this.pageSize();
|
|
1996
|
+
if (!size)
|
|
1997
|
+
return this.sortedData();
|
|
1998
|
+
const page = this.currentPage();
|
|
1999
|
+
const start = (page - 1) * size;
|
|
2000
|
+
return this.sortedData().slice(start, start + size);
|
|
2001
|
+
}, ...(ngDevMode ? [{ debugName: "visibleRows" }] : /* istanbul ignore next */ []));
|
|
2002
|
+
pageNumbers = computed(() => {
|
|
2003
|
+
const total = this.totalPages();
|
|
2004
|
+
const current = this.currentPage();
|
|
2005
|
+
const delta = 2;
|
|
2006
|
+
const range = [];
|
|
2007
|
+
for (let i = 1; i <= total; i++) {
|
|
2008
|
+
if (i === 1 || i === total || (i >= current - delta && i <= current + delta)) {
|
|
2009
|
+
range.push(i);
|
|
2010
|
+
}
|
|
2011
|
+
else if (range[range.length - 1] !== '...') {
|
|
2012
|
+
range.push('...');
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
return range;
|
|
2016
|
+
}, ...(ngDevMode ? [{ debugName: "pageNumbers" }] : /* istanbul ignore next */ []));
|
|
2017
|
+
hasPagination = computed(() => !this.loading() && this.pageSize() > 0 && this.totalPages() > 1, ...(ngDevMode ? [{ debugName: "hasPagination" }] : /* istanbul ignore next */ []));
|
|
2018
|
+
emptyColspan = computed(() => this.columns().length + (this.showRowNumbers() ? 1 : 0), ...(ngDevMode ? [{ debugName: "emptyColspan" }] : /* istanbul ignore next */ []));
|
|
2019
|
+
getBodyTemplate(field) {
|
|
2020
|
+
return this.bodyTemplateMap().get(field) ?? null;
|
|
2021
|
+
}
|
|
2022
|
+
getHeaderTemplate(field) {
|
|
2023
|
+
return this.headerTemplateMap().get(field) ?? null;
|
|
2024
|
+
}
|
|
2025
|
+
toggleSort(col) {
|
|
2026
|
+
if (!col.sortable())
|
|
2027
|
+
return;
|
|
2028
|
+
const cur = this.sortState();
|
|
2029
|
+
const field = col.field();
|
|
2030
|
+
if (cur.field !== field) {
|
|
2031
|
+
this.sortState.set({ field, direction: 'asc' });
|
|
2032
|
+
}
|
|
2033
|
+
else if (cur.direction === 'asc') {
|
|
2034
|
+
this.sortState.set({ field, direction: 'desc' });
|
|
2035
|
+
}
|
|
2036
|
+
else {
|
|
2037
|
+
this.sortState.set({ field: '', direction: null });
|
|
2038
|
+
}
|
|
2039
|
+
this.currentPage.set(1);
|
|
2040
|
+
}
|
|
2041
|
+
getSortDirection(field) {
|
|
2042
|
+
const s = this.sortState();
|
|
2043
|
+
return s.field === field ? s.direction : null;
|
|
2044
|
+
}
|
|
2045
|
+
getAriaSort(field) {
|
|
2046
|
+
const direction = this.getSortDirection(field);
|
|
2047
|
+
if (direction === 'asc')
|
|
2048
|
+
return 'ascending';
|
|
2049
|
+
if (direction === 'desc')
|
|
2050
|
+
return 'descending';
|
|
2051
|
+
return null;
|
|
2052
|
+
}
|
|
2053
|
+
goTo(page) {
|
|
2054
|
+
if (page < 1 || page > this.totalPages())
|
|
2055
|
+
return;
|
|
2056
|
+
this.currentPage.set(page);
|
|
2057
|
+
}
|
|
2058
|
+
prev() {
|
|
2059
|
+
this.goTo(this.currentPage() - 1);
|
|
2060
|
+
}
|
|
2061
|
+
next() {
|
|
2062
|
+
this.goTo(this.currentPage() + 1);
|
|
2063
|
+
}
|
|
2064
|
+
handleSortClick(col) {
|
|
2065
|
+
if (!this.loading())
|
|
2066
|
+
this.toggleSort(col);
|
|
2067
|
+
}
|
|
2068
|
+
isNumber(val) {
|
|
2069
|
+
return typeof val === 'number';
|
|
2070
|
+
}
|
|
2071
|
+
getCellValue(row, field) {
|
|
2072
|
+
return row[field];
|
|
2073
|
+
}
|
|
2074
|
+
formatCellValue(row, field) {
|
|
2075
|
+
const value = this.getCellValue(row, field);
|
|
2076
|
+
return value == null ? this.emptyPlaceholder() : String(value);
|
|
2077
|
+
}
|
|
2078
|
+
globalRowIndex(localIndex) {
|
|
2079
|
+
const size = this.pageSize();
|
|
2080
|
+
if (!size)
|
|
2081
|
+
return localIndex + 1;
|
|
2082
|
+
return (this.currentPage() - 1) * size + localIndex + 1;
|
|
2083
|
+
}
|
|
2084
|
+
/** CSS grid-area for the total label: left slot or right slot */
|
|
2085
|
+
totalGridArea = computed(() => {
|
|
2086
|
+
const totalPos = this.totalPosition();
|
|
2087
|
+
const paginatorPos = this.paginatorPosition();
|
|
2088
|
+
if (totalPos === 'opposite')
|
|
2089
|
+
return paginatorPos === 'right' ? 'left' : 'right';
|
|
2090
|
+
return totalPos;
|
|
2091
|
+
}, ...(ngDevMode ? [{ debugName: "totalGridArea" }] : /* istanbul ignore next */ []));
|
|
2092
|
+
/** CSS grid-area for the pagination block */
|
|
2093
|
+
paginatorGridArea = computed(() => this.paginatorPosition(), ...(ngDevMode ? [{ debugName: "paginatorGridArea" }] : /* istanbul ignore next */ []));
|
|
2094
|
+
bodyTemplateMap = computed(() => {
|
|
2095
|
+
const map = new Map();
|
|
2096
|
+
for (const t of this.templates()) {
|
|
2097
|
+
if (t.type() === 'body')
|
|
2098
|
+
map.set(t.template(), t.templateRef);
|
|
2099
|
+
}
|
|
2100
|
+
return map;
|
|
2101
|
+
}, ...(ngDevMode ? [{ debugName: "bodyTemplateMap" }] : /* istanbul ignore next */ []));
|
|
2102
|
+
headerTemplateMap = computed(() => {
|
|
2103
|
+
const map = new Map();
|
|
2104
|
+
for (const t of this.templates()) {
|
|
2105
|
+
if (t.type() === 'header')
|
|
2106
|
+
map.set(t.template(), t.templateRef);
|
|
2107
|
+
}
|
|
2108
|
+
return map;
|
|
2109
|
+
}, ...(ngDevMode ? [{ debugName: "headerTemplateMap" }] : /* istanbul ignore next */ []));
|
|
2110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2111
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TableComponent, isStandalone: true, selector: "gog-table", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, showRowNumbers: { classPropertyName: "showRowNumbers", publicName: "showRowNumbers", isSignal: true, isRequired: false, transformFunction: null }, showTotal: { classPropertyName: "showTotal", publicName: "showTotal", isSignal: true, isRequired: false, transformFunction: null }, emptyPlaceholder: { classPropertyName: "emptyPlaceholder", publicName: "emptyPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, paginatorPosition: { classPropertyName: "paginatorPosition", publicName: "paginatorPosition", isSignal: true, isRequired: false, transformFunction: null }, totalPosition: { classPropertyName: "totalPosition", publicName: "totalPosition", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, showColumnBorders: { classPropertyName: "showColumnBorders", publicName: "showColumnBorders", isSignal: true, isRequired: false, transformFunction: null }, stickyHeader: { classPropertyName: "stickyHeader", publicName: "stickyHeader", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "style.display": "\"block\"", "style.width": "\"100%\"" }, classAttribute: "gog-table-host" }, queries: [{ propertyName: "columns", predicate: Column, isSignal: true }, { propertyName: "templates", predicate: TemplateDirective, isSignal: true }], ngImport: i0, template: "<div class=\"gog-table-wrapper gog-contained-layout\">\n <div class=\"gog-table-scroll\">\n <table\n class=\"gog-table font-body\"\n [class.gog-table--col-borders]=\"showColumnBorders()\"\n [class.gog-table--loading]=\"loading()\"\n [class.gog-table--md]=\"size() === 'md'\"\n [class.gog-table--sticky-header]=\"stickyHeader()\"\n [class.gog-table--sm]=\"size() === 'sm'\"\n >\n <colgroup>\n @if (showRowNumbers()) {\n <col class=\"gog-table__col--num\" />\n }\n @for (col of columns(); track col.field()) {\n <col\n [style.width]=\"col.width() || null\"\n [style.min-width]=\"col.minWidth() || null\"\n [style.max-width]=\"col.maxWidth() || null\"\n />\n }\n </colgroup>\n <thead>\n <tr>\n @if (showRowNumbers()) {\n <th class=\"gog-table__th gog-table__th--num font-heading\" scope=\"col\">#</th>\n }\n @for (col of columns(); track col.field()) {\n <th\n class=\"gog-table__th font-heading\"\n scope=\"col\"\n [class.gog-table__th--sortable]=\"col.sortable() && !loading()\"\n [class.gog-table__th--sorted]=\"getSortDirection(col.field())\"\n [attr.aria-sort]=\"getAriaSort(col.field())\"\n [attr.tabindex]=\"col.sortable() && !loading() ? 0 : null\"\n (click)=\"handleSortClick(col)\"\n (keydown.enter)=\"handleSortClick(col)\"\n (keydown.space)=\"handleSortClick(col); $event.preventDefault()\"\n >\n @if (getHeaderTemplate(col.field()); as headerTpl) {\n <ng-container *ngTemplateOutlet=\"headerTpl\" />\n } @else {\n <span class=\"gog-table__th-inner\">\n {{ col.header() || col.field() }}\n @if (col.sortable() && !loading()) {\n <span class=\"gog-table__sort-icon\" aria-hidden=\"true\">\n @if (getSortDirection(col.field()) === 'asc') {\n <gog-icon name=\"sort-up\" />\n } @else if (getSortDirection(col.field()) === 'desc') {\n <gog-icon name=\"sort-down\" />\n } @else {\n <gog-icon name=\"sort\" />\n }\n </span>\n }\n </span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @if (loading()) {\n <tr>\n <td class=\"gog-table__loading-cell\" [attr.colspan]=\"emptyColspan()\">\n <gog-spinner size=\"md\" />\n </td>\n </tr>\n } @else if (visibleRows().length === 0) {\n <tr>\n <td class=\"gog-table__empty\" [attr.colspan]=\"emptyColspan()\">\u2014</td>\n </tr>\n } @else {\n @for (row of visibleRows(); track $index; let i = $index) {\n <tr class=\"gog-table__row\">\n @if (showRowNumbers()) {\n <td class=\"gog-table__td gog-table__td--num\">{{ globalRowIndex(i) }}</td>\n }\n @for (col of columns(); track col.field()) {\n <td class=\"gog-table__td\">\n @if (getBodyTemplate(col.field()); as bodyTpl) {\n <ng-container\n *ngTemplateOutlet=\"bodyTpl; context: { $implicit: row, index: i }\"\n />\n } @else {\n {{ formatCellValue(row, col.field()) }}\n }\n </td>\n }\n </tr>\n }\n }\n </tbody>\n </table>\n </div>\n\n @if (hasPagination() || showTotal()) {\n <div class=\"gog-table__footer\">\n @if (showTotal()) {\n <span class=\"gog-table__total font-body\" [style.grid-area]=\"totalGridArea()\">\n Total: {{ value().length }}\n </span>\n }\n\n @if (hasPagination()) {\n <nav\n class=\"gog-table__pagination\"\n [style.grid-area]=\"paginatorGridArea()\"\n aria-label=\"Table pagination\"\n >\n <gog-button variant=\"ghost\" size=\"sm\" [disabled]=\"currentPage() === 1\" (gogClick)=\"prev()\"\n >\u2039</gog-button\n >\n @for (page of pageNumbers(); track $index) {\n @if (isNumber(page)) {\n <gog-button\n size=\"sm\"\n [variant]=\"page === currentPage() ? 'primary' : 'ghost'\"\n (gogClick)=\"goTo(page)\"\n >{{ page }}</gog-button\n >\n } @else {\n <span class=\"gog-table__pagination-ellipsis\">\u2026</span>\n }\n }\n <gog-button\n variant=\"ghost\"\n size=\"sm\"\n [disabled]=\"currentPage() === totalPages()\"\n (gogClick)=\"next()\"\n >\u203A</gog-button\n >\n </nav>\n }\n </div>\n }\n</div>\n", styles: [".gog-table-wrapper{--gog-table-border-color: var(--accent-dim);--gog-table-surface: var(--surface-color);--gog-table-text-color: var(--text-color);--gog-table-accent-color: var(--accent-color);--gog-table-accent-bright: var(--accent-bright);--gog-table-hover-bg: var(--accent-pale);--gog-table-muted-color: var(--muted-text-color);--gog-table-focus-ring: var(--accent-color);--gog-table-pagination-gap: 4px;--gog-table-footer-gap: 8px;--gog-table-loading-opacity: .5;--gog-table-scroll-shadow: 0 8px 24px rgba(0, 0, 0, .3);display:flex;flex-direction:column;gap:12px;width:100%;overflow-anchor:none}.gog-table-scroll{width:100%;overflow-x:auto}.gog-table{width:100%;border-collapse:collapse;border:2px solid var(--gog-table-border-color);background-color:var(--gog-table-surface);color:var(--gog-table-text-color);table-layout:fixed;--tbl-th-padding-v: 10px;--tbl-td-padding-v: 10px;--tbl-padding-h: 14px;--tbl-th-font-size: var(--text-sm);--tbl-td-font-size: var(--text-md)}.gog-table--md{--tbl-th-padding-v: 6px;--tbl-td-padding-v: 6px;--tbl-th-font-size: var(--text-xs);--tbl-td-font-size: var(--text-sm)}.gog-table--sm{--tbl-th-padding-v: 3px;--tbl-td-padding-v: 3px;--tbl-th-font-size: var(--text-xs);--tbl-td-font-size: var(--text-xs)}.gog-table__col--num{width:48px}.gog-table__th{padding:var(--tbl-th-padding-v) var(--tbl-padding-h);text-align:left;font-size:var(--tbl-th-font-size);text-transform:uppercase;letter-spacing:1px;color:var(--gog-table-accent-color);background-color:var(--gog-table-surface);border-bottom:2px solid var(--gog-table-border-color);white-space:normal;overflow:hidden}.gog-table--sticky-header .gog-table__th{position:sticky;top:0;z-index:1}.gog-table__th--num{width:48px;text-align:center;color:var(--gog-table-muted-color)}.gog-table__th--sortable{cursor:pointer;-webkit-user-select:none;user-select:none}.gog-table__th--sortable:focus-visible{outline:3px solid var(--gog-table-focus-ring);outline-offset:-3px}.gog-table__th--sortable:hover,.gog-table__th--sorted{color:var(--gog-table-accent-bright)}.gog-table__th-inner{display:inline-flex;align-items:center;gap:6px;width:100%}.gog-table__sort-icon{display:inline-block;width:1em;text-align:center;font-size:.8rem;opacity:.6;flex-shrink:0}.gog-table__sort-icon gog-icon{font-size:.8rem}.gog-table__th--sorted .gog-table__sort-icon{opacity:1}.gog-table__td{padding:var(--tbl-td-padding-v) var(--tbl-padding-h);font-size:var(--tbl-td-font-size);border-bottom:1px solid var(--gog-table-border-color);vertical-align:middle;overflow-wrap:break-word;word-break:break-word;overflow:hidden}.gog-table__td--num{text-align:center;color:var(--gog-table-muted-color);font-size:var(--text-xs);font-family:var(--font-mono);width:48px}.gog-table__row:last-child .gog-table__td{border-bottom:none}.gog-table__row{transition:background-color .12s ease}.gog-table__row:hover{background-color:var(--gog-table-hover-bg)}.gog-table__empty{padding:24px 14px;text-align:center;color:var(--gog-table-muted-color);font-size:var(--text-md)}.gog-table--loading thead{opacity:var(--gog-table-loading-opacity);pointer-events:none}.gog-table__loading-cell{padding:32px 14px;text-align:center}.gog-table--col-borders .gog-table__th:not(:last-child),.gog-table--col-borders .gog-table__td:not(:last-child){border-right:1px solid var(--gog-table-border-color)}.gog-table__footer{display:grid;grid-template-columns:1fr auto 1fr;grid-template-areas:\"left center right\";align-items:center;min-height:32px;gap:var(--gog-table-footer-gap)}.gog-table__total{font-size:var(--text-xs);color:var(--gog-table-muted-color);font-family:var(--font-mono);text-transform:uppercase;letter-spacing:.5px}.gog-table__total[style*=\"grid-area: right\"]{text-align:right}.gog-table__pagination{display:flex;align-items:center;gap:var(--gog-table-pagination-gap);flex-wrap:wrap}.gog-table__pagination[style*=\"grid-area: left\"]{justify-content:flex-start}.gog-table__pagination[style*=\"grid-area: center\"]{justify-content:center}.gog-table__pagination[style*=\"grid-area: right\"]{justify-content:flex-end}.gog-table__pagination-ellipsis{display:inline-flex;align-items:center;justify-content:center;min-width:32px;color:var(--gog-table-muted-color);font-size:var(--text-sm);-webkit-user-select:none;user-select:none}@media(prefers-reduced-motion:reduce){.gog-table__row{transition:none}}\n"], dependencies: [{ kind: "component", type: SpinnerComponent, selector: "gog-spinner", inputs: ["size", "overlay", "ariaLabel"] }, { kind: "component", type: ButtonComponent, selector: "gog-button", inputs: ["variant", "size", "disabled", "fullWidth", "type", "debounce", "loading"], outputs: ["gogClick"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: IconComponent, selector: "gog-icon", inputs: ["name", "template", "title", "ariaHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2112
|
+
}
|
|
2113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TableComponent, decorators: [{
|
|
2114
|
+
type: Component,
|
|
2115
|
+
args: [{ selector: 'gog-table', imports: [SpinnerComponent, ButtonComponent, NgTemplateOutlet, IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2116
|
+
class: 'gog-table-host',
|
|
2117
|
+
'[style.display]': '"block"',
|
|
2118
|
+
'[style.width]': '"100%"',
|
|
2119
|
+
}, template: "<div class=\"gog-table-wrapper gog-contained-layout\">\n <div class=\"gog-table-scroll\">\n <table\n class=\"gog-table font-body\"\n [class.gog-table--col-borders]=\"showColumnBorders()\"\n [class.gog-table--loading]=\"loading()\"\n [class.gog-table--md]=\"size() === 'md'\"\n [class.gog-table--sticky-header]=\"stickyHeader()\"\n [class.gog-table--sm]=\"size() === 'sm'\"\n >\n <colgroup>\n @if (showRowNumbers()) {\n <col class=\"gog-table__col--num\" />\n }\n @for (col of columns(); track col.field()) {\n <col\n [style.width]=\"col.width() || null\"\n [style.min-width]=\"col.minWidth() || null\"\n [style.max-width]=\"col.maxWidth() || null\"\n />\n }\n </colgroup>\n <thead>\n <tr>\n @if (showRowNumbers()) {\n <th class=\"gog-table__th gog-table__th--num font-heading\" scope=\"col\">#</th>\n }\n @for (col of columns(); track col.field()) {\n <th\n class=\"gog-table__th font-heading\"\n scope=\"col\"\n [class.gog-table__th--sortable]=\"col.sortable() && !loading()\"\n [class.gog-table__th--sorted]=\"getSortDirection(col.field())\"\n [attr.aria-sort]=\"getAriaSort(col.field())\"\n [attr.tabindex]=\"col.sortable() && !loading() ? 0 : null\"\n (click)=\"handleSortClick(col)\"\n (keydown.enter)=\"handleSortClick(col)\"\n (keydown.space)=\"handleSortClick(col); $event.preventDefault()\"\n >\n @if (getHeaderTemplate(col.field()); as headerTpl) {\n <ng-container *ngTemplateOutlet=\"headerTpl\" />\n } @else {\n <span class=\"gog-table__th-inner\">\n {{ col.header() || col.field() }}\n @if (col.sortable() && !loading()) {\n <span class=\"gog-table__sort-icon\" aria-hidden=\"true\">\n @if (getSortDirection(col.field()) === 'asc') {\n <gog-icon name=\"sort-up\" />\n } @else if (getSortDirection(col.field()) === 'desc') {\n <gog-icon name=\"sort-down\" />\n } @else {\n <gog-icon name=\"sort\" />\n }\n </span>\n }\n </span>\n }\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @if (loading()) {\n <tr>\n <td class=\"gog-table__loading-cell\" [attr.colspan]=\"emptyColspan()\">\n <gog-spinner size=\"md\" />\n </td>\n </tr>\n } @else if (visibleRows().length === 0) {\n <tr>\n <td class=\"gog-table__empty\" [attr.colspan]=\"emptyColspan()\">\u2014</td>\n </tr>\n } @else {\n @for (row of visibleRows(); track $index; let i = $index) {\n <tr class=\"gog-table__row\">\n @if (showRowNumbers()) {\n <td class=\"gog-table__td gog-table__td--num\">{{ globalRowIndex(i) }}</td>\n }\n @for (col of columns(); track col.field()) {\n <td class=\"gog-table__td\">\n @if (getBodyTemplate(col.field()); as bodyTpl) {\n <ng-container\n *ngTemplateOutlet=\"bodyTpl; context: { $implicit: row, index: i }\"\n />\n } @else {\n {{ formatCellValue(row, col.field()) }}\n }\n </td>\n }\n </tr>\n }\n }\n </tbody>\n </table>\n </div>\n\n @if (hasPagination() || showTotal()) {\n <div class=\"gog-table__footer\">\n @if (showTotal()) {\n <span class=\"gog-table__total font-body\" [style.grid-area]=\"totalGridArea()\">\n Total: {{ value().length }}\n </span>\n }\n\n @if (hasPagination()) {\n <nav\n class=\"gog-table__pagination\"\n [style.grid-area]=\"paginatorGridArea()\"\n aria-label=\"Table pagination\"\n >\n <gog-button variant=\"ghost\" size=\"sm\" [disabled]=\"currentPage() === 1\" (gogClick)=\"prev()\"\n >\u2039</gog-button\n >\n @for (page of pageNumbers(); track $index) {\n @if (isNumber(page)) {\n <gog-button\n size=\"sm\"\n [variant]=\"page === currentPage() ? 'primary' : 'ghost'\"\n (gogClick)=\"goTo(page)\"\n >{{ page }}</gog-button\n >\n } @else {\n <span class=\"gog-table__pagination-ellipsis\">\u2026</span>\n }\n }\n <gog-button\n variant=\"ghost\"\n size=\"sm\"\n [disabled]=\"currentPage() === totalPages()\"\n (gogClick)=\"next()\"\n >\u203A</gog-button\n >\n </nav>\n }\n </div>\n }\n</div>\n", styles: [".gog-table-wrapper{--gog-table-border-color: var(--accent-dim);--gog-table-surface: var(--surface-color);--gog-table-text-color: var(--text-color);--gog-table-accent-color: var(--accent-color);--gog-table-accent-bright: var(--accent-bright);--gog-table-hover-bg: var(--accent-pale);--gog-table-muted-color: var(--muted-text-color);--gog-table-focus-ring: var(--accent-color);--gog-table-pagination-gap: 4px;--gog-table-footer-gap: 8px;--gog-table-loading-opacity: .5;--gog-table-scroll-shadow: 0 8px 24px rgba(0, 0, 0, .3);display:flex;flex-direction:column;gap:12px;width:100%;overflow-anchor:none}.gog-table-scroll{width:100%;overflow-x:auto}.gog-table{width:100%;border-collapse:collapse;border:2px solid var(--gog-table-border-color);background-color:var(--gog-table-surface);color:var(--gog-table-text-color);table-layout:fixed;--tbl-th-padding-v: 10px;--tbl-td-padding-v: 10px;--tbl-padding-h: 14px;--tbl-th-font-size: var(--text-sm);--tbl-td-font-size: var(--text-md)}.gog-table--md{--tbl-th-padding-v: 6px;--tbl-td-padding-v: 6px;--tbl-th-font-size: var(--text-xs);--tbl-td-font-size: var(--text-sm)}.gog-table--sm{--tbl-th-padding-v: 3px;--tbl-td-padding-v: 3px;--tbl-th-font-size: var(--text-xs);--tbl-td-font-size: var(--text-xs)}.gog-table__col--num{width:48px}.gog-table__th{padding:var(--tbl-th-padding-v) var(--tbl-padding-h);text-align:left;font-size:var(--tbl-th-font-size);text-transform:uppercase;letter-spacing:1px;color:var(--gog-table-accent-color);background-color:var(--gog-table-surface);border-bottom:2px solid var(--gog-table-border-color);white-space:normal;overflow:hidden}.gog-table--sticky-header .gog-table__th{position:sticky;top:0;z-index:1}.gog-table__th--num{width:48px;text-align:center;color:var(--gog-table-muted-color)}.gog-table__th--sortable{cursor:pointer;-webkit-user-select:none;user-select:none}.gog-table__th--sortable:focus-visible{outline:3px solid var(--gog-table-focus-ring);outline-offset:-3px}.gog-table__th--sortable:hover,.gog-table__th--sorted{color:var(--gog-table-accent-bright)}.gog-table__th-inner{display:inline-flex;align-items:center;gap:6px;width:100%}.gog-table__sort-icon{display:inline-block;width:1em;text-align:center;font-size:.8rem;opacity:.6;flex-shrink:0}.gog-table__sort-icon gog-icon{font-size:.8rem}.gog-table__th--sorted .gog-table__sort-icon{opacity:1}.gog-table__td{padding:var(--tbl-td-padding-v) var(--tbl-padding-h);font-size:var(--tbl-td-font-size);border-bottom:1px solid var(--gog-table-border-color);vertical-align:middle;overflow-wrap:break-word;word-break:break-word;overflow:hidden}.gog-table__td--num{text-align:center;color:var(--gog-table-muted-color);font-size:var(--text-xs);font-family:var(--font-mono);width:48px}.gog-table__row:last-child .gog-table__td{border-bottom:none}.gog-table__row{transition:background-color .12s ease}.gog-table__row:hover{background-color:var(--gog-table-hover-bg)}.gog-table__empty{padding:24px 14px;text-align:center;color:var(--gog-table-muted-color);font-size:var(--text-md)}.gog-table--loading thead{opacity:var(--gog-table-loading-opacity);pointer-events:none}.gog-table__loading-cell{padding:32px 14px;text-align:center}.gog-table--col-borders .gog-table__th:not(:last-child),.gog-table--col-borders .gog-table__td:not(:last-child){border-right:1px solid var(--gog-table-border-color)}.gog-table__footer{display:grid;grid-template-columns:1fr auto 1fr;grid-template-areas:\"left center right\";align-items:center;min-height:32px;gap:var(--gog-table-footer-gap)}.gog-table__total{font-size:var(--text-xs);color:var(--gog-table-muted-color);font-family:var(--font-mono);text-transform:uppercase;letter-spacing:.5px}.gog-table__total[style*=\"grid-area: right\"]{text-align:right}.gog-table__pagination{display:flex;align-items:center;gap:var(--gog-table-pagination-gap);flex-wrap:wrap}.gog-table__pagination[style*=\"grid-area: left\"]{justify-content:flex-start}.gog-table__pagination[style*=\"grid-area: center\"]{justify-content:center}.gog-table__pagination[style*=\"grid-area: right\"]{justify-content:flex-end}.gog-table__pagination-ellipsis{display:inline-flex;align-items:center;justify-content:center;min-width:32px;color:var(--gog-table-muted-color);font-size:var(--text-sm);-webkit-user-select:none;user-select:none}@media(prefers-reduced-motion:reduce){.gog-table__row{transition:none}}\n"] }]
|
|
2120
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], showRowNumbers: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRowNumbers", required: false }] }], showTotal: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTotal", required: false }] }], emptyPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyPlaceholder", required: false }] }], paginatorPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "paginatorPosition", required: false }] }], totalPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "totalPosition", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], showColumnBorders: [{ type: i0.Input, args: [{ isSignal: true, alias: "showColumnBorders", required: false }] }], stickyHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "stickyHeader", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], columns: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Column), { isSignal: true }] }], templates: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TemplateDirective), { isSignal: true }] }] } });
|
|
2121
|
+
|
|
2122
|
+
class ThemeService {
|
|
2123
|
+
document = inject(DOCUMENT);
|
|
2124
|
+
root = this.document.documentElement;
|
|
2125
|
+
theme = signal(this.readTheme(), ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
2126
|
+
constructor() {
|
|
2127
|
+
this.applyTheme(this.theme());
|
|
2128
|
+
}
|
|
2129
|
+
setTheme(theme) {
|
|
2130
|
+
this.theme.set(theme);
|
|
2131
|
+
this.applyTheme(theme);
|
|
2132
|
+
}
|
|
2133
|
+
toggleTheme() {
|
|
2134
|
+
this.setTheme(this.theme() === 'dark' ? 'light' : 'dark');
|
|
2135
|
+
}
|
|
2136
|
+
readTheme() {
|
|
2137
|
+
return this.root.getAttribute('data-theme') ?? 'light';
|
|
2138
|
+
}
|
|
2139
|
+
applyTheme(theme) {
|
|
2140
|
+
this.root.setAttribute('data-theme', theme);
|
|
2141
|
+
}
|
|
2142
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2143
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
2144
|
+
}
|
|
2145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: ThemeService, decorators: [{
|
|
2146
|
+
type: Injectable,
|
|
2147
|
+
args: [{ providedIn: 'root' }]
|
|
2148
|
+
}], ctorParameters: () => [] });
|
|
2149
|
+
|
|
2150
|
+
/*
|
|
2151
|
+
* Public API Surface of ui
|
|
2152
|
+
*/
|
|
2153
|
+
|
|
2154
|
+
/**
|
|
2155
|
+
* Generated bundle index. Do not edit.
|
|
2156
|
+
*/
|
|
2157
|
+
|
|
2158
|
+
export { AccordionComponent, ButtonComponent, CheckboxComponent, ChipComponent, Column, ConfirmationDialogComponent, DIALOG_DATA, DIALOG_REF, DialogComponent, DialogService, GogAccordionChevronDirective, GogAccordionContentDirective, GogAccordionHeaderDirective, GogMultiselectDropdownPortal, IconComponent, InputfieldComponent, MultiselectComponent, SelectComponent, SliderComponent, SpinnerComponent, SpinnerOverlayComponent, TableComponent, TagComponent, TemplateDirective, ThemeService, ToastComponent, ToastContainerComponent, ToastService };
|
|
2159
|
+
//# sourceMappingURL=guildofgleks-ui.mjs.map
|