ng-hub-ui-buttons 22.1.0
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 +426 -0
- package/fesm2022/ng-hub-ui-buttons.mjs +483 -0
- package/fesm2022/ng-hub-ui-buttons.mjs.map +1 -0
- package/ng-hub-ui-buttons-22.1.0.tgz +0 -0
- package/package.json +46 -0
- package/styles/_btn-mixins.scss +140 -0
- package/styles/_dropdown-mixins.scss +58 -0
- package/styles/_fab-mixins.scss +29 -0
- package/styles/_index.scss +16 -0
- package/types/ng-hub-ui-buttons.d.ts +239 -0
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, input, HostBinding, ChangeDetectionStrategy, Component, output, signal, inject, DestroyRef, ViewEncapsulation, model, Directive, ElementRef, ViewContainerRef } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { fromEvent } from 'rxjs';
|
|
5
|
+
import { debounceTime, filter, take } from 'rxjs/operators';
|
|
6
|
+
import { OverlayService } from 'ng-hub-ui-utils';
|
|
7
|
+
|
|
8
|
+
/** Injection token for DropdownContext. */
|
|
9
|
+
const DROPDOWN_CONTEXT = new InjectionToken('HubDropdownContext');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Styled button component. Applies hub-btn CSS classes computed from signal inputs.
|
|
13
|
+
* Use <hub-btn> when the element type can be this component, or [hubBtn] directive
|
|
14
|
+
* when a native element (button, a, etc.) must keep its tag.
|
|
15
|
+
*/
|
|
16
|
+
class HubBtnComponent {
|
|
17
|
+
/** Visual style of the button. */
|
|
18
|
+
variant = input('solid', /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
20
|
+
/** Semantic color token. */
|
|
21
|
+
color = input('primary', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
23
|
+
/** Size token. */
|
|
24
|
+
size = input('md', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
26
|
+
/** When true, enforces equal width/height (icon-only layout). */
|
|
27
|
+
iconOnly = input(false, /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []));
|
|
29
|
+
/** When true, shows a spinner and blocks pointer events. */
|
|
30
|
+
loading = input(false, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
32
|
+
/** Mirrors the native disabled attribute on the host element. */
|
|
33
|
+
disabled = input(false, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
35
|
+
/** Computed CSS classes applied to the host element via HostBinding. */
|
|
36
|
+
get _hostClass() {
|
|
37
|
+
return [
|
|
38
|
+
`hub-btn-${this.variant()}`,
|
|
39
|
+
`hub-btn-${this.color()}`,
|
|
40
|
+
`hub-btn-${this.size()}`,
|
|
41
|
+
this.iconOnly() ? 'hub-btn-icon' : '',
|
|
42
|
+
this.loading() ? 'hub-btn-loading' : '',
|
|
43
|
+
this.disabled() ? 'hub-btn-disabled' : ''
|
|
44
|
+
]
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join(' ');
|
|
47
|
+
}
|
|
48
|
+
/** Reflects the disabled state as a native HTML attribute. */
|
|
49
|
+
get _disabledAttr() {
|
|
50
|
+
return this.disabled() ? true : null;
|
|
51
|
+
}
|
|
52
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubBtnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
53
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: HubBtnComponent, isStandalone: true, selector: "hub-btn", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, iconOnly: { classPropertyName: "iconOnly", publicName: "iconOnly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this._hostClass", "attr.disabled": "this._disabledAttr" }, classAttribute: "hub-btn" }, ngImport: i0, template: "@if (loading()) {\n\t<span class=\"hub-btn__spinner\" aria-hidden=\"true\"></span>\n}\n<ng-content></ng-content>\n", styles: [":where(:host){--hub-btn-padding-x: .875rem;--hub-btn-padding-y: .4375rem;--hub-btn-border-radius: var(--hub-sys-radius-md, .375rem);--hub-btn-border-width: 1.5px;--hub-btn-font-size: var(--hub-ref-font-size-base, 1rem);--hub-btn-font-weight: 500;--hub-btn-gap: .375rem;--hub-btn-transition: all .15s ease;--hub-btn-spinner-size: .875em;--hub-btn-disabled-opacity: .55}:host{display:inline-flex;align-items:center;justify-content:center;gap:var(--hub-btn-gap);padding:var(--hub-btn-padding-y) var(--hub-btn-padding-x);border-radius:var(--hub-btn-border-radius);border:var(--hub-btn-border-width) solid transparent;font-size:var(--hub-btn-font-size);font-weight:var(--hub-btn-font-weight);cursor:pointer;text-decoration:none;transition:var(--hub-btn-transition);-webkit-user-select:none;user-select:none;white-space:nowrap}:host(.hub-btn-disabled),:host([disabled]){opacity:var(--hub-btn-disabled-opacity);pointer-events:none}:host(.hub-btn-loading){pointer-events:none}:host(.hub-btn-sm){--hub-btn-padding-x: .625rem;--hub-btn-padding-y: .25rem;--hub-btn-font-size: .8125rem;--hub-btn-border-radius: var(--hub-sys-radius-sm, .25rem)}:host(.hub-btn-lg){--hub-btn-padding-x: 1.25rem;--hub-btn-padding-y: .625rem;--hub-btn-font-size: 1rem}:host(.hub-btn-xl){--hub-btn-padding-x: 1.75rem;--hub-btn-padding-y: .8125rem;--hub-btn-font-size: 1.125rem}:host(.hub-btn-icon){--hub-btn-padding-x: var(--hub-btn-padding-y);aspect-ratio:1}.hub-btn__spinner{display:inline-block;width:var(--hub-btn-spinner-size);height:var(--hub-btn-spinner-size);border:2px solid color-mix(in srgb,currentColor 30%,transparent);border-top-color:currentColor;border-radius:50%;animation:hub-btn-spin .7s linear infinite}@keyframes hub-btn-spin{to{transform:rotate(360deg)}}:host(.hub-btn-solid.hub-btn-primary){background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff);border-color:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-btn-solid.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-emphasis);border-color:var(--hub-sys-color-primary-emphasis)}:host(.hub-btn-outline.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-btn-outline.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-subtle)}:host(.hub-btn-soft.hub-btn-primary){background:var(--hub-sys-color-primary-subtle);color:var(--hub-sys-color-primary-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-primary-subtle) 80%,var(--hub-sys-color-primary-default))}:host(.hub-btn-ghost.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-subtle)}:host(.hub-btn-link.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-primary-default)}:host(.hub-btn-solid.hub-btn-secondary){background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff);border-color:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-btn-solid.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-emphasis);border-color:var(--hub-sys-color-secondary-emphasis)}:host(.hub-btn-outline.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-btn-outline.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-subtle)}:host(.hub-btn-soft.hub-btn-secondary){background:var(--hub-sys-color-secondary-subtle);color:var(--hub-sys-color-secondary-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-secondary-subtle) 80%,var(--hub-sys-color-secondary-default))}:host(.hub-btn-ghost.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-subtle)}:host(.hub-btn-link.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-secondary-default)}:host(.hub-btn-solid.hub-btn-success){background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff);border-color:var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-btn-solid.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-emphasis);border-color:var(--hub-sys-color-success-emphasis)}:host(.hub-btn-outline.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-btn-outline.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-subtle)}:host(.hub-btn-soft.hub-btn-success){background:var(--hub-sys-color-success-subtle);color:var(--hub-sys-color-success-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-success-subtle) 80%,var(--hub-sys-color-success-default))}:host(.hub-btn-ghost.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-subtle)}:host(.hub-btn-link.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-success-default)}:host(.hub-btn-solid.hub-btn-danger){background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff);border-color:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-btn-solid.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-emphasis);border-color:var(--hub-sys-color-danger-emphasis)}:host(.hub-btn-outline.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-btn-outline.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-subtle)}:host(.hub-btn-soft.hub-btn-danger){background:var(--hub-sys-color-danger-subtle);color:var(--hub-sys-color-danger-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-danger-subtle) 80%,var(--hub-sys-color-danger-default))}:host(.hub-btn-ghost.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-subtle)}:host(.hub-btn-link.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-danger-default)}:host(.hub-btn-solid.hub-btn-warning){background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff);border-color:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-btn-solid.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-emphasis);border-color:var(--hub-sys-color-warning-emphasis)}:host(.hub-btn-outline.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-btn-outline.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-subtle)}:host(.hub-btn-soft.hub-btn-warning){background:var(--hub-sys-color-warning-subtle);color:var(--hub-sys-color-warning-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-warning-subtle) 80%,var(--hub-sys-color-warning-default))}:host(.hub-btn-ghost.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-subtle)}:host(.hub-btn-link.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-warning-default)}:host(.hub-btn-solid.hub-btn-info){background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff);border-color:var(--hub-sys-color-info-default, var(--hub-sys-color-info))}:host(.hub-btn-solid.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-emphasis);border-color:var(--hub-sys-color-info-emphasis)}:host(.hub-btn-outline.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:var(--hub-sys-color-info-default, var(--hub-sys-color-info))}:host(.hub-btn-outline.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-subtle)}:host(.hub-btn-soft.hub-btn-info){background:var(--hub-sys-color-info-subtle);color:var(--hub-sys-color-info-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-info-subtle) 80%,var(--hub-sys-color-info-default))}:host(.hub-btn-ghost.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-subtle)}:host(.hub-btn-link.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-info-default)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
54
|
+
}
|
|
55
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubBtnComponent, decorators: [{
|
|
56
|
+
type: Component,
|
|
57
|
+
args: [{ selector: 'hub-btn', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-btn' }, template: "@if (loading()) {\n\t<span class=\"hub-btn__spinner\" aria-hidden=\"true\"></span>\n}\n<ng-content></ng-content>\n", styles: [":where(:host){--hub-btn-padding-x: .875rem;--hub-btn-padding-y: .4375rem;--hub-btn-border-radius: var(--hub-sys-radius-md, .375rem);--hub-btn-border-width: 1.5px;--hub-btn-font-size: var(--hub-ref-font-size-base, 1rem);--hub-btn-font-weight: 500;--hub-btn-gap: .375rem;--hub-btn-transition: all .15s ease;--hub-btn-spinner-size: .875em;--hub-btn-disabled-opacity: .55}:host{display:inline-flex;align-items:center;justify-content:center;gap:var(--hub-btn-gap);padding:var(--hub-btn-padding-y) var(--hub-btn-padding-x);border-radius:var(--hub-btn-border-radius);border:var(--hub-btn-border-width) solid transparent;font-size:var(--hub-btn-font-size);font-weight:var(--hub-btn-font-weight);cursor:pointer;text-decoration:none;transition:var(--hub-btn-transition);-webkit-user-select:none;user-select:none;white-space:nowrap}:host(.hub-btn-disabled),:host([disabled]){opacity:var(--hub-btn-disabled-opacity);pointer-events:none}:host(.hub-btn-loading){pointer-events:none}:host(.hub-btn-sm){--hub-btn-padding-x: .625rem;--hub-btn-padding-y: .25rem;--hub-btn-font-size: .8125rem;--hub-btn-border-radius: var(--hub-sys-radius-sm, .25rem)}:host(.hub-btn-lg){--hub-btn-padding-x: 1.25rem;--hub-btn-padding-y: .625rem;--hub-btn-font-size: 1rem}:host(.hub-btn-xl){--hub-btn-padding-x: 1.75rem;--hub-btn-padding-y: .8125rem;--hub-btn-font-size: 1.125rem}:host(.hub-btn-icon){--hub-btn-padding-x: var(--hub-btn-padding-y);aspect-ratio:1}.hub-btn__spinner{display:inline-block;width:var(--hub-btn-spinner-size);height:var(--hub-btn-spinner-size);border:2px solid color-mix(in srgb,currentColor 30%,transparent);border-top-color:currentColor;border-radius:50%;animation:hub-btn-spin .7s linear infinite}@keyframes hub-btn-spin{to{transform:rotate(360deg)}}:host(.hub-btn-solid.hub-btn-primary){background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff);border-color:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-btn-solid.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-emphasis);border-color:var(--hub-sys-color-primary-emphasis)}:host(.hub-btn-outline.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-btn-outline.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-subtle)}:host(.hub-btn-soft.hub-btn-primary){background:var(--hub-sys-color-primary-subtle);color:var(--hub-sys-color-primary-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-primary-subtle) 80%,var(--hub-sys-color-primary-default))}:host(.hub-btn-ghost.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-primary-subtle)}:host(.hub-btn-link.hub-btn-primary){background:transparent;color:var(--hub-sys-color-primary-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-primary):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-primary-default)}:host(.hub-btn-solid.hub-btn-secondary){background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff);border-color:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-btn-solid.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-emphasis);border-color:var(--hub-sys-color-secondary-emphasis)}:host(.hub-btn-outline.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-btn-outline.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-subtle)}:host(.hub-btn-soft.hub-btn-secondary){background:var(--hub-sys-color-secondary-subtle);color:var(--hub-sys-color-secondary-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-secondary-subtle) 80%,var(--hub-sys-color-secondary-default))}:host(.hub-btn-ghost.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-secondary-subtle)}:host(.hub-btn-link.hub-btn-secondary){background:transparent;color:var(--hub-sys-color-secondary-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-secondary):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-secondary-default)}:host(.hub-btn-solid.hub-btn-success){background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff);border-color:var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-btn-solid.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-emphasis);border-color:var(--hub-sys-color-success-emphasis)}:host(.hub-btn-outline.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-btn-outline.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-subtle)}:host(.hub-btn-soft.hub-btn-success){background:var(--hub-sys-color-success-subtle);color:var(--hub-sys-color-success-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-success-subtle) 80%,var(--hub-sys-color-success-default))}:host(.hub-btn-ghost.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-success-subtle)}:host(.hub-btn-link.hub-btn-success){background:transparent;color:var(--hub-sys-color-success-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-success):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-success-default)}:host(.hub-btn-solid.hub-btn-danger){background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff);border-color:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-btn-solid.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-emphasis);border-color:var(--hub-sys-color-danger-emphasis)}:host(.hub-btn-outline.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-btn-outline.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-subtle)}:host(.hub-btn-soft.hub-btn-danger){background:var(--hub-sys-color-danger-subtle);color:var(--hub-sys-color-danger-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-danger-subtle) 80%,var(--hub-sys-color-danger-default))}:host(.hub-btn-ghost.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-danger-subtle)}:host(.hub-btn-link.hub-btn-danger){background:transparent;color:var(--hub-sys-color-danger-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-danger):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-danger-default)}:host(.hub-btn-solid.hub-btn-warning){background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff);border-color:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-btn-solid.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-emphasis);border-color:var(--hub-sys-color-warning-emphasis)}:host(.hub-btn-outline.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-btn-outline.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-subtle)}:host(.hub-btn-soft.hub-btn-warning){background:var(--hub-sys-color-warning-subtle);color:var(--hub-sys-color-warning-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-warning-subtle) 80%,var(--hub-sys-color-warning-default))}:host(.hub-btn-ghost.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-warning-subtle)}:host(.hub-btn-link.hub-btn-warning){background:transparent;color:var(--hub-sys-color-warning-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-warning):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-warning-default)}:host(.hub-btn-solid.hub-btn-info){background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff);border-color:var(--hub-sys-color-info-default, var(--hub-sys-color-info))}:host(.hub-btn-solid.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-emphasis);border-color:var(--hub-sys-color-info-emphasis)}:host(.hub-btn-outline.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:var(--hub-sys-color-info-default, var(--hub-sys-color-info))}:host(.hub-btn-outline.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-subtle)}:host(.hub-btn-soft.hub-btn-info){background:var(--hub-sys-color-info-subtle);color:var(--hub-sys-color-info-emphasis);border-color:transparent}:host(.hub-btn-soft.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:color-mix(in srgb,var(--hub-sys-color-info-subtle) 80%,var(--hub-sys-color-info-default))}:host(.hub-btn-ghost.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:transparent}:host(.hub-btn-ghost.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){background:var(--hub-sys-color-info-subtle)}:host(.hub-btn-link.hub-btn-info){background:transparent;color:var(--hub-sys-color-info-emphasis);border-color:transparent;text-decoration:underline;padding-inline:.125rem}:host(.hub-btn-link.hub-btn-info):hover:not([disabled]):not(.hub-btn-disabled){color:var(--hub-sys-color-info-default)}\n"] }]
|
|
58
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], _hostClass: [{
|
|
59
|
+
type: HostBinding,
|
|
60
|
+
args: ['class']
|
|
61
|
+
}], _disabledAttr: [{
|
|
62
|
+
type: HostBinding,
|
|
63
|
+
args: ['attr.disabled']
|
|
64
|
+
}] } });
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Floating Action Button component. Renders fixed in the viewport at the given position.
|
|
68
|
+
* Supports circular and extended (pill with label) variants.
|
|
69
|
+
* When collapseOnScroll is true, an extended FAB collapses to icon-only after 50px scroll.
|
|
70
|
+
* Uses inset-inline-* / inset-block-* CSS logical properties for RTL support.
|
|
71
|
+
*/
|
|
72
|
+
class HubFabComponent {
|
|
73
|
+
color = input('primary', /* @ts-ignore */
|
|
74
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
75
|
+
size = input('standard', /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
77
|
+
extended = input(false, /* @ts-ignore */
|
|
78
|
+
...(ngDevMode ? [{ debugName: "extended" }] : /* istanbul ignore next */ []));
|
|
79
|
+
/** Fixed viewport position. 9-slot grid including center. */
|
|
80
|
+
position = input('bottom-end', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
82
|
+
/** When true, collapses an extended FAB to icon-only on page scroll. */
|
|
83
|
+
collapseOnScroll = input(false, /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "collapseOnScroll" }] : /* istanbul ignore next */ []));
|
|
85
|
+
disabled = input(false, /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
87
|
+
fabClick = output();
|
|
88
|
+
/** Collapse state driven by scroll — only active when extended + collapseOnScroll. */
|
|
89
|
+
_collapsed = signal(false, /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "_collapsed" }] : /* istanbul ignore next */ []));
|
|
91
|
+
_destroyRef = inject(DestroyRef);
|
|
92
|
+
get _hostClass() {
|
|
93
|
+
return [
|
|
94
|
+
`hub-fab-${this.color()}`,
|
|
95
|
+
`hub-fab-${this.size()}`,
|
|
96
|
+
`hub-fab-${this.position()}`,
|
|
97
|
+
this.extended() && !this._collapsed() ? 'hub-fab-extended' : '',
|
|
98
|
+
this.disabled() ? 'hub-fab-disabled' : ''
|
|
99
|
+
]
|
|
100
|
+
.filter(Boolean)
|
|
101
|
+
.join(' ');
|
|
102
|
+
}
|
|
103
|
+
ngOnInit() {
|
|
104
|
+
if (!this.collapseOnScroll())
|
|
105
|
+
return;
|
|
106
|
+
fromEvent(window, 'scroll', { passive: true })
|
|
107
|
+
.pipe(debounceTime(50), takeUntilDestroyed(this._destroyRef))
|
|
108
|
+
.subscribe(() => {
|
|
109
|
+
this._collapsed.set(window.scrollY > 50);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubFabComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
113
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: HubFabComponent, isStandalone: true, selector: "hub-fab", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, extended: { classPropertyName: "extended", publicName: "extended", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, collapseOnScroll: { classPropertyName: "collapseOnScroll", publicName: "collapseOnScroll", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fabClick: "fabClick" }, host: { properties: { "class": "this._hostClass" }, classAttribute: "hub-fab" }, ngImport: i0, template: "<ng-content select=\"[slot=icon]\"></ng-content>\n\n@if (extended() && !_collapsed()) {\n\t<span class=\"hub-fab__label\">\n\t\t<ng-content select=\"[slot=label]\"></ng-content>\n\t</span>\n} @else if (!extended()) {\n\t<ng-content></ng-content>\n}\n", styles: [":where(.hub-fab){--hub-fab-size-mini: 2.5rem;--hub-fab-size-standard: 3.5rem;--hub-fab-size-large: 4.5rem;--hub-fab-border-radius: 50%;--hub-fab-shadow: var(--hub-sys-shadow-md, 0 4px 12px rgba(0, 0, 0, .15));--hub-fab-shadow-hover: var(--hub-sys-shadow-lg, 0 8px 24px rgba(0, 0, 0, .18));--hub-fab-offset: 1rem;--hub-fab-extended-height: 3.5rem;--hub-fab-extended-radius: 1.75rem;--hub-fab-extended-padding-x: 1.25rem;--hub-fab-transition: box-shadow .2s ease, transform .15s ease;--hub-fab-z-index: 1030}.hub-fab{position:fixed;display:inline-flex;align-items:center;justify-content:center;width:var(--hub-fab-size-standard);height:var(--hub-fab-size-standard);border-radius:var(--hub-fab-border-radius);border:none;cursor:pointer;box-shadow:var(--hub-fab-shadow);z-index:var(--hub-fab-z-index);transition:var(--hub-fab-transition);color:#fff;font-size:1.4rem}.hub-fab:hover{box-shadow:var(--hub-fab-shadow-hover);transform:translateY(-1px)}.hub-fab.hub-fab-disabled{opacity:.45;pointer-events:none}.hub-fab.hub-fab-extended{width:auto;height:var(--hub-fab-extended-height);border-radius:var(--hub-fab-extended-radius);padding-inline:var(--hub-fab-extended-padding-x);gap:.5rem;font-size:.95rem;font-weight:600}.hub-fab-mini{width:var(--hub-fab-size-mini);height:var(--hub-fab-size-mini);font-size:1rem}.hub-fab-large{width:var(--hub-fab-size-large);height:var(--hub-fab-size-large);font-size:1.75rem}.hub-fab-primary{background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff)}.hub-fab-secondary{background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff)}.hub-fab-success{background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff)}.hub-fab-danger{background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff)}.hub-fab-warning{background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff)}.hub-fab-info{background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff)}.hub-speed-dial .hub-fab{position:static}.hub-fab-top-start{inset-block-start:var(--hub-fab-offset);inset-inline-start:var(--hub-fab-offset)}.hub-fab-top-center{inset-block-start:var(--hub-fab-offset);inset-inline-start:50%;transform:translate(-50%)}.hub-fab-top-end{inset-block-start:var(--hub-fab-offset);inset-inline-end:var(--hub-fab-offset)}.hub-fab-middle-start{inset-block-start:50%;inset-inline-start:var(--hub-fab-offset);transform:translateY(-50%)}.hub-fab-center{inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.hub-fab-middle-end{inset-block-start:50%;inset-inline-end:var(--hub-fab-offset);transform:translateY(-50%)}.hub-fab-bottom-start{inset-block-end:var(--hub-fab-offset);inset-inline-start:var(--hub-fab-offset)}.hub-fab-bottom-center{inset-block-end:var(--hub-fab-offset);inset-inline-start:50%;transform:translate(-50%)}.hub-fab-bottom-end{inset-block-end:var(--hub-fab-offset);inset-inline-end:var(--hub-fab-offset)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubFabComponent, decorators: [{
|
|
116
|
+
type: Component,
|
|
117
|
+
args: [{ selector: 'hub-fab', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-fab' }, encapsulation: ViewEncapsulation.None, template: "<ng-content select=\"[slot=icon]\"></ng-content>\n\n@if (extended() && !_collapsed()) {\n\t<span class=\"hub-fab__label\">\n\t\t<ng-content select=\"[slot=label]\"></ng-content>\n\t</span>\n} @else if (!extended()) {\n\t<ng-content></ng-content>\n}\n", styles: [":where(.hub-fab){--hub-fab-size-mini: 2.5rem;--hub-fab-size-standard: 3.5rem;--hub-fab-size-large: 4.5rem;--hub-fab-border-radius: 50%;--hub-fab-shadow: var(--hub-sys-shadow-md, 0 4px 12px rgba(0, 0, 0, .15));--hub-fab-shadow-hover: var(--hub-sys-shadow-lg, 0 8px 24px rgba(0, 0, 0, .18));--hub-fab-offset: 1rem;--hub-fab-extended-height: 3.5rem;--hub-fab-extended-radius: 1.75rem;--hub-fab-extended-padding-x: 1.25rem;--hub-fab-transition: box-shadow .2s ease, transform .15s ease;--hub-fab-z-index: 1030}.hub-fab{position:fixed;display:inline-flex;align-items:center;justify-content:center;width:var(--hub-fab-size-standard);height:var(--hub-fab-size-standard);border-radius:var(--hub-fab-border-radius);border:none;cursor:pointer;box-shadow:var(--hub-fab-shadow);z-index:var(--hub-fab-z-index);transition:var(--hub-fab-transition);color:#fff;font-size:1.4rem}.hub-fab:hover{box-shadow:var(--hub-fab-shadow-hover);transform:translateY(-1px)}.hub-fab.hub-fab-disabled{opacity:.45;pointer-events:none}.hub-fab.hub-fab-extended{width:auto;height:var(--hub-fab-extended-height);border-radius:var(--hub-fab-extended-radius);padding-inline:var(--hub-fab-extended-padding-x);gap:.5rem;font-size:.95rem;font-weight:600}.hub-fab-mini{width:var(--hub-fab-size-mini);height:var(--hub-fab-size-mini);font-size:1rem}.hub-fab-large{width:var(--hub-fab-size-large);height:var(--hub-fab-size-large);font-size:1.75rem}.hub-fab-primary{background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff)}.hub-fab-secondary{background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff)}.hub-fab-success{background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff)}.hub-fab-danger{background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff)}.hub-fab-warning{background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff)}.hub-fab-info{background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff)}.hub-speed-dial .hub-fab{position:static}.hub-fab-top-start{inset-block-start:var(--hub-fab-offset);inset-inline-start:var(--hub-fab-offset)}.hub-fab-top-center{inset-block-start:var(--hub-fab-offset);inset-inline-start:50%;transform:translate(-50%)}.hub-fab-top-end{inset-block-start:var(--hub-fab-offset);inset-inline-end:var(--hub-fab-offset)}.hub-fab-middle-start{inset-block-start:50%;inset-inline-start:var(--hub-fab-offset);transform:translateY(-50%)}.hub-fab-center{inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}.hub-fab-middle-end{inset-block-start:50%;inset-inline-end:var(--hub-fab-offset);transform:translateY(-50%)}.hub-fab-bottom-start{inset-block-end:var(--hub-fab-offset);inset-inline-start:var(--hub-fab-offset)}.hub-fab-bottom-center{inset-block-end:var(--hub-fab-offset);inset-inline-start:50%;transform:translate(-50%)}.hub-fab-bottom-end{inset-block-end:var(--hub-fab-offset);inset-inline-end:var(--hub-fab-offset)}\n"] }]
|
|
118
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], extended: [{ type: i0.Input, args: [{ isSignal: true, alias: "extended", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], collapseOnScroll: [{ type: i0.Input, args: [{ isSignal: true, alias: "collapseOnScroll", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], fabClick: [{ type: i0.Output, args: ["fabClick"] }], _hostClass: [{
|
|
119
|
+
type: HostBinding,
|
|
120
|
+
args: ['class']
|
|
121
|
+
}] } });
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* FAB that expands a stack of HubSpeedDialItemComponent children on click or hover.
|
|
125
|
+
* Supports 4 expansion directions and all 9 FAB viewport positions.
|
|
126
|
+
* Closes automatically on Escape key press.
|
|
127
|
+
*/
|
|
128
|
+
class HubSpeedDialComponent {
|
|
129
|
+
color = input('primary', /* @ts-ignore */
|
|
130
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
131
|
+
size = input('standard', /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
133
|
+
position = input('bottom-end', /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "position" }] : /* istanbul ignore next */ []));
|
|
135
|
+
direction = input('up', /* @ts-ignore */
|
|
136
|
+
...(ngDevMode ? [{ debugName: "direction" }] : /* istanbul ignore next */ []));
|
|
137
|
+
trigger = input('click', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
139
|
+
isOpen = model(false, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
141
|
+
opened = output();
|
|
142
|
+
closed = output();
|
|
143
|
+
_destroyRef = inject(DestroyRef);
|
|
144
|
+
get _hostClass() {
|
|
145
|
+
return [
|
|
146
|
+
`hub-speed-dial-${this.color()}`,
|
|
147
|
+
`hub-speed-dial-${this.position()}`,
|
|
148
|
+
`hub-speed-dial-${this.direction()}`,
|
|
149
|
+
this.isOpen() ? 'hub-speed-dial-open' : ''
|
|
150
|
+
]
|
|
151
|
+
.filter(Boolean)
|
|
152
|
+
.join(' ');
|
|
153
|
+
}
|
|
154
|
+
constructor() {
|
|
155
|
+
fromEvent(document, 'keydown')
|
|
156
|
+
.pipe(filter((e) => e.key === 'Escape' && this.isOpen()), takeUntilDestroyed(this._destroyRef))
|
|
157
|
+
.subscribe(() => this.close());
|
|
158
|
+
}
|
|
159
|
+
/** Toggle the speed dial open/closed. */
|
|
160
|
+
toggle() {
|
|
161
|
+
this.isOpen() ? this.close() : this.open();
|
|
162
|
+
}
|
|
163
|
+
/** Open the speed dial and emit the opened event. */
|
|
164
|
+
open() {
|
|
165
|
+
this.isOpen.set(true);
|
|
166
|
+
this.opened.emit();
|
|
167
|
+
}
|
|
168
|
+
/** Close the speed dial and emit the closed event. */
|
|
169
|
+
close() {
|
|
170
|
+
this.isOpen.set(false);
|
|
171
|
+
this.closed.emit();
|
|
172
|
+
}
|
|
173
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubSpeedDialComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: HubSpeedDialComponent, isStandalone: true, selector: "hub-speed-dial", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, direction: { classPropertyName: "direction", publicName: "direction", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", opened: "opened", closed: "closed" }, host: { properties: { "class": "this._hostClass" }, classAttribute: "hub-speed-dial" }, ngImport: i0, template: "<button\n\tclass=\"hub-fab\"\n\t[class]=\"'hub-fab-' + color() + ' hub-fab-' + size()\"\n\t(click)=\"trigger() === 'click' && toggle()\"\n\t(mouseenter)=\"trigger() === 'hover' && open()\"\n\t(mouseleave)=\"trigger() === 'hover' && close()\"\n\ttype=\"button\"\n\t[attr.aria-expanded]=\"isOpen()\"\n\taria-haspopup=\"true\">\n\t<ng-content select=\"[hubTrigger]\"></ng-content>\n</button>\n\n@if (isOpen()) {\n\t<div class=\"hub-speed-dial__actions\" [attr.data-direction]=\"direction()\">\n\t\t<ng-content></ng-content>\n\t</div>\n}\n", styles: [":where(:host){--hub-speed-dial-gap: .625rem;--hub-speed-dial-z-index: 1030;--hub-speed-dial-animation: .2s ease}:host{position:fixed;display:flex;flex-direction:column-reverse;align-items:center;gap:var(--hub-speed-dial-gap);z-index:var(--hub-speed-dial-z-index)}.hub-speed-dial__actions{display:flex;flex-direction:column-reverse;align-items:center;gap:var(--hub-speed-dial-gap);animation:hub-sd-fade-in var(--hub-speed-dial-animation) both}:host(.hub-speed-dial-top-start){inset-block-start:1rem;inset-inline-start:1rem;flex-direction:column;align-items:flex-start}:host(.hub-speed-dial-top-end){inset-block-start:1rem;inset-inline-end:1rem;flex-direction:column;align-items:flex-end}:host(.hub-speed-dial-bottom-start){inset-block-end:1rem;inset-inline-start:1rem;align-items:flex-start}:host(.hub-speed-dial-bottom-end){inset-block-end:1rem;inset-inline-end:1rem;align-items:flex-end}:host(.hub-speed-dial-center){inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}:host(.hub-speed-dial-left){flex-direction:row-reverse}:host(.hub-speed-dial-left) .hub-speed-dial__actions{flex-direction:row-reverse}:host(.hub-speed-dial-right){flex-direction:row}:host(.hub-speed-dial-right) .hub-speed-dial__actions{flex-direction:row}@keyframes hub-sd-fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
175
|
+
}
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubSpeedDialComponent, decorators: [{
|
|
177
|
+
type: Component,
|
|
178
|
+
args: [{ selector: 'hub-speed-dial', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-speed-dial' }, template: "<button\n\tclass=\"hub-fab\"\n\t[class]=\"'hub-fab-' + color() + ' hub-fab-' + size()\"\n\t(click)=\"trigger() === 'click' && toggle()\"\n\t(mouseenter)=\"trigger() === 'hover' && open()\"\n\t(mouseleave)=\"trigger() === 'hover' && close()\"\n\ttype=\"button\"\n\t[attr.aria-expanded]=\"isOpen()\"\n\taria-haspopup=\"true\">\n\t<ng-content select=\"[hubTrigger]\"></ng-content>\n</button>\n\n@if (isOpen()) {\n\t<div class=\"hub-speed-dial__actions\" [attr.data-direction]=\"direction()\">\n\t\t<ng-content></ng-content>\n\t</div>\n}\n", styles: [":where(:host){--hub-speed-dial-gap: .625rem;--hub-speed-dial-z-index: 1030;--hub-speed-dial-animation: .2s ease}:host{position:fixed;display:flex;flex-direction:column-reverse;align-items:center;gap:var(--hub-speed-dial-gap);z-index:var(--hub-speed-dial-z-index)}.hub-speed-dial__actions{display:flex;flex-direction:column-reverse;align-items:center;gap:var(--hub-speed-dial-gap);animation:hub-sd-fade-in var(--hub-speed-dial-animation) both}:host(.hub-speed-dial-top-start){inset-block-start:1rem;inset-inline-start:1rem;flex-direction:column;align-items:flex-start}:host(.hub-speed-dial-top-end){inset-block-start:1rem;inset-inline-end:1rem;flex-direction:column;align-items:flex-end}:host(.hub-speed-dial-bottom-start){inset-block-end:1rem;inset-inline-start:1rem;align-items:flex-start}:host(.hub-speed-dial-bottom-end){inset-block-end:1rem;inset-inline-end:1rem;align-items:flex-end}:host(.hub-speed-dial-center){inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%)}:host(.hub-speed-dial-left){flex-direction:row-reverse}:host(.hub-speed-dial-left) .hub-speed-dial__actions{flex-direction:row-reverse}:host(.hub-speed-dial-right){flex-direction:row}:host(.hub-speed-dial-right) .hub-speed-dial__actions{flex-direction:row}@keyframes hub-sd-fade-in{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
179
|
+
}], ctorParameters: () => [], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], direction: [{ type: i0.Input, args: [{ isSignal: true, alias: "direction", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }, { type: i0.Output, args: ["isOpenChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], _hostClass: [{
|
|
180
|
+
type: HostBinding,
|
|
181
|
+
args: ['class']
|
|
182
|
+
}] } });
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Secondary action item rendered inside HubSpeedDialComponent.
|
|
186
|
+
* Emits itemClick when activated. Supports an optional label tooltip.
|
|
187
|
+
*/
|
|
188
|
+
class HubSpeedDialItemComponent {
|
|
189
|
+
/** Icon character or ligature string displayed in the action button. */
|
|
190
|
+
icon = input.required(/* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
192
|
+
/** Tooltip label shown next to the action button. */
|
|
193
|
+
label = input('', /* @ts-ignore */
|
|
194
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
195
|
+
color = input('default', /* @ts-ignore */
|
|
196
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
197
|
+
disabled = input(false, /* @ts-ignore */
|
|
198
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
199
|
+
itemClick = output();
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubSpeedDialItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: HubSpeedDialItemComponent, isStandalone: true, selector: "hub-speed-dial-item", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, ngImport: i0, template: "@if (label()) {\n\t<span class=\"hub-speed-dial-item__label\">{{ label() }}</span>\n}\n<button\n\tclass=\"hub-speed-dial-item__btn\"\n\t[class]=\"'hub-speed-dial-item__btn--' + color()\"\n\t[disabled]=\"disabled() || null\"\n\t(click)=\"itemClick.emit()\"\n\ttype=\"button\"\n\t[attr.aria-label]=\"label() || icon()\">\n\t<i [class]=\"icon()\" aria-hidden=\"true\"></i>\n</button>\n", styles: [":host{display:flex;align-items:center;gap:.625rem}.hub-speed-dial-item__label{font-size:.8rem;font-weight:500;background:var(--hub-sys-color-surface-default, #1e293b);color:var(--hub-sys-text-primary, #fff);padding:.1875rem .5rem;border-radius:.3125rem;white-space:nowrap;box-shadow:var(--hub-sys-shadow-sm, 0 2px 6px rgba(0, 0, 0, .12))}.hub-speed-dial-item__btn{width:2.625rem;height:2.625rem;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:1.1rem;background:var(--hub-sys-color-surface-default, #fff);box-shadow:var(--hub-sys-shadow-md, 0 4px 12px rgba(0, 0, 0, .15));transition:transform .15s ease}.hub-speed-dial-item__btn:hover{transform:scale(1.1)}.hub-speed-dial-item__btn:disabled{opacity:.45;pointer-events:none}.hub-speed-dial-item__btn--primary{background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff)}.hub-speed-dial-item__btn--secondary{background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff)}.hub-speed-dial-item__btn--success{background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff)}.hub-speed-dial-item__btn--danger{background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff)}.hub-speed-dial-item__btn--warning{background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff)}.hub-speed-dial-item__btn--info{background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
202
|
+
}
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubSpeedDialItemComponent, decorators: [{
|
|
204
|
+
type: Component,
|
|
205
|
+
args: [{ selector: 'hub-speed-dial-item', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, template: "@if (label()) {\n\t<span class=\"hub-speed-dial-item__label\">{{ label() }}</span>\n}\n<button\n\tclass=\"hub-speed-dial-item__btn\"\n\t[class]=\"'hub-speed-dial-item__btn--' + color()\"\n\t[disabled]=\"disabled() || null\"\n\t(click)=\"itemClick.emit()\"\n\ttype=\"button\"\n\t[attr.aria-label]=\"label() || icon()\">\n\t<i [class]=\"icon()\" aria-hidden=\"true\"></i>\n</button>\n", styles: [":host{display:flex;align-items:center;gap:.625rem}.hub-speed-dial-item__label{font-size:.8rem;font-weight:500;background:var(--hub-sys-color-surface-default, #1e293b);color:var(--hub-sys-text-primary, #fff);padding:.1875rem .5rem;border-radius:.3125rem;white-space:nowrap;box-shadow:var(--hub-sys-shadow-sm, 0 2px 6px rgba(0, 0, 0, .12))}.hub-speed-dial-item__btn{width:2.625rem;height:2.625rem;border-radius:50%;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:1.1rem;background:var(--hub-sys-color-surface-default, #fff);box-shadow:var(--hub-sys-shadow-md, 0 4px 12px rgba(0, 0, 0, .15));transition:transform .15s ease}.hub-speed-dial-item__btn:hover{transform:scale(1.1)}.hub-speed-dial-item__btn:disabled{opacity:.45;pointer-events:none}.hub-speed-dial-item__btn--primary{background:var(--hub-sys-color-primary-default, var(--hub-sys-color-primary));color:var(--hub-sys-color-primary-on-default, #fff)}.hub-speed-dial-item__btn--secondary{background:var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary));color:var(--hub-sys-color-secondary-on-default, #fff)}.hub-speed-dial-item__btn--success{background:var(--hub-sys-color-success-default, var(--hub-sys-color-success));color:var(--hub-sys-color-success-on-default, #fff)}.hub-speed-dial-item__btn--danger{background:var(--hub-sys-color-danger-default, var(--hub-sys-color-danger));color:var(--hub-sys-color-danger-on-default, #fff)}.hub-speed-dial-item__btn--warning{background:var(--hub-sys-color-warning-default, var(--hub-sys-color-warning));color:var(--hub-sys-color-warning-on-default, #fff)}.hub-speed-dial-item__btn--info{background:var(--hub-sys-color-info-default, var(--hub-sys-color-info));color:var(--hub-sys-color-info-on-default, #fff)}\n"] }]
|
|
206
|
+
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }] } });
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Styled container for dropdown content.
|
|
210
|
+
* Renders a shadowed panel with an optional semantic color top-border accent.
|
|
211
|
+
* Place hub-dropdown-item, hub-dropdown-divider, and hub-dropdown-header children inside.
|
|
212
|
+
*/
|
|
213
|
+
class HubDropdownPanelComponent {
|
|
214
|
+
/** Adds a semantic color accent to the panel top border. */
|
|
215
|
+
color = input('default', /* @ts-ignore */
|
|
216
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
217
|
+
get _hostClass() {
|
|
218
|
+
return this.color() !== 'default' ? `hub-dropdown-panel-${this.color()}` : '';
|
|
219
|
+
}
|
|
220
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
221
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.1", type: HubDropdownPanelComponent, isStandalone: true, selector: "hub-dropdown-panel", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this._hostClass" }, classAttribute: "hub-dropdown-panel" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":where(:host){--hub-dropdown-panel-min-width: 11.25rem;--hub-dropdown-panel-max-height: 20rem;--hub-dropdown-panel-padding-y: .25rem;--hub-dropdown-panel-bg: var(--hub-sys-color-surface-default, #fff);--hub-dropdown-panel-border-color: var(--hub-sys-color-border-subtle, #e2e8f0);--hub-dropdown-panel-border-radius: var(--hub-sys-radius-md, .5rem);--hub-dropdown-panel-shadow: var(--hub-sys-shadow-lg, 0 8px 24px rgba(0, 0, 0, .12));--hub-dropdown-panel-z-index: 1000}:host{display:block;min-width:var(--hub-dropdown-panel-min-width);max-height:var(--hub-dropdown-panel-max-height);overflow-y:auto;padding-block:var(--hub-dropdown-panel-padding-y);background:var(--hub-dropdown-panel-bg);border:1px solid var(--hub-dropdown-panel-border-color);border-radius:var(--hub-dropdown-panel-border-radius);box-shadow:var(--hub-dropdown-panel-shadow);z-index:var(--hub-dropdown-panel-z-index)}:host(.hub-dropdown-panel-primary){border-top:3px solid var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-dropdown-panel-secondary){border-top:3px solid var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-dropdown-panel-success){border-top:3px solid var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-dropdown-panel-danger){border-top:3px solid var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-dropdown-panel-warning){border-top:3px solid var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-dropdown-panel-info){border-top:3px solid var(--hub-sys-color-info-default, var(--hub-sys-color-info))}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
222
|
+
}
|
|
223
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownPanelComponent, decorators: [{
|
|
224
|
+
type: Component,
|
|
225
|
+
args: [{ selector: 'hub-dropdown-panel', standalone: true, template: `<ng-content></ng-content>`, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-dropdown-panel' }, styles: [":where(:host){--hub-dropdown-panel-min-width: 11.25rem;--hub-dropdown-panel-max-height: 20rem;--hub-dropdown-panel-padding-y: .25rem;--hub-dropdown-panel-bg: var(--hub-sys-color-surface-default, #fff);--hub-dropdown-panel-border-color: var(--hub-sys-color-border-subtle, #e2e8f0);--hub-dropdown-panel-border-radius: var(--hub-sys-radius-md, .5rem);--hub-dropdown-panel-shadow: var(--hub-sys-shadow-lg, 0 8px 24px rgba(0, 0, 0, .12));--hub-dropdown-panel-z-index: 1000}:host{display:block;min-width:var(--hub-dropdown-panel-min-width);max-height:var(--hub-dropdown-panel-max-height);overflow-y:auto;padding-block:var(--hub-dropdown-panel-padding-y);background:var(--hub-dropdown-panel-bg);border:1px solid var(--hub-dropdown-panel-border-color);border-radius:var(--hub-dropdown-panel-border-radius);box-shadow:var(--hub-dropdown-panel-shadow);z-index:var(--hub-dropdown-panel-z-index)}:host(.hub-dropdown-panel-primary){border-top:3px solid var(--hub-sys-color-primary-default, var(--hub-sys-color-primary))}:host(.hub-dropdown-panel-secondary){border-top:3px solid var(--hub-sys-color-secondary-default, var(--hub-sys-color-secondary))}:host(.hub-dropdown-panel-success){border-top:3px solid var(--hub-sys-color-success-default, var(--hub-sys-color-success))}:host(.hub-dropdown-panel-danger){border-top:3px solid var(--hub-sys-color-danger-default, var(--hub-sys-color-danger))}:host(.hub-dropdown-panel-warning){border-top:3px solid var(--hub-sys-color-warning-default, var(--hub-sys-color-warning))}:host(.hub-dropdown-panel-info){border-top:3px solid var(--hub-sys-color-info-default, var(--hub-sys-color-info))}\n"] }]
|
|
226
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], _hostClass: [{
|
|
227
|
+
type: HostBinding,
|
|
228
|
+
args: ['class']
|
|
229
|
+
}] } });
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Menu item for use inside HubDropdownPanelComponent.
|
|
233
|
+
* Emits itemClick when activated. Supports an optional icon, selected state and semantic color.
|
|
234
|
+
*/
|
|
235
|
+
class HubDropdownItemComponent {
|
|
236
|
+
color = input('default', /* @ts-ignore */
|
|
237
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
238
|
+
/** Optional icon character or ligature displayed before the label. */
|
|
239
|
+
icon = input(/* @ts-ignore */
|
|
240
|
+
...(ngDevMode ? [undefined, { debugName: "icon" }] : /* istanbul ignore next */ []));
|
|
241
|
+
disabled = input(false, /* @ts-ignore */
|
|
242
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
243
|
+
/** Shows a checkmark indicator when selected. */
|
|
244
|
+
selected = input(false, /* @ts-ignore */
|
|
245
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
246
|
+
itemClick = output();
|
|
247
|
+
get _hostClass() {
|
|
248
|
+
return [
|
|
249
|
+
this.color() !== 'default' ? `hub-dropdown-item-${this.color()}` : '',
|
|
250
|
+
this.disabled() ? 'hub-dropdown-item-disabled' : '',
|
|
251
|
+
this.selected() ? 'hub-dropdown-item-selected' : ''
|
|
252
|
+
]
|
|
253
|
+
.filter(Boolean)
|
|
254
|
+
.join(' ');
|
|
255
|
+
}
|
|
256
|
+
_handleClick() {
|
|
257
|
+
if (this.disabled())
|
|
258
|
+
return;
|
|
259
|
+
this.itemClick.emit();
|
|
260
|
+
}
|
|
261
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
262
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.1", type: HubDropdownItemComponent, isStandalone: true, selector: "hub-dropdown-item", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, host: { properties: { "class": "this._hostClass" }, classAttribute: "hub-dropdown-item" }, ngImport: i0, template: "<button\n\tclass=\"hub-dropdown-item__inner\"\n\ttype=\"button\"\n\t[disabled]=\"disabled() || null\"\n\t(click)=\"_handleClick()\">\n\t@if (icon()) {\n\t\t<i [class]=\"icon()\" aria-hidden=\"true\"></i>\n\t}\n\t<span class=\"hub-dropdown-item__label\"><ng-content></ng-content></span>\n\t@if (selected()) {\n\t\t<span class=\"hub-dropdown-item__check\" aria-hidden=\"true\">\u2713</span>\n\t}\n</button>\n", styles: [":where(:host){--hub-dropdown-item-padding-y: .4375rem;--hub-dropdown-item-padding-x: .875rem;--hub-dropdown-item-hover-bg: var(--hub-sys-color-surface-subtle, #f8fafc);--hub-dropdown-item-border-radius: var(--hub-sys-radius-sm, .25rem);--hub-dropdown-item-disabled-opacity: .45}:host{display:block}.hub-dropdown-item__inner{display:flex;align-items:center;gap:.5rem;width:100%;padding:var(--hub-dropdown-item-padding-y) var(--hub-dropdown-item-padding-x);border:none;background:transparent;font-size:.875rem;color:inherit;cursor:pointer;text-align:start;border-radius:var(--hub-dropdown-item-border-radius);transition:background .1s ease}.hub-dropdown-item__inner:hover{background:var(--hub-dropdown-item-hover-bg)}.hub-dropdown-item__inner:disabled{opacity:var(--hub-dropdown-item-disabled-opacity);pointer-events:none}.hub-dropdown-item__label{flex:1}.hub-dropdown-item__check{margin-inline-start:auto}:host(.hub-dropdown-item-disabled) .hub-dropdown-item__inner{opacity:var(--hub-dropdown-item-disabled-opacity);pointer-events:none}:host(.hub-dropdown-item-primary) .hub-dropdown-item__inner{color:var(--hub-sys-color-primary-emphasis)}:host(.hub-dropdown-item-primary) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-primary-subtle)}:host(.hub-dropdown-item-secondary) .hub-dropdown-item__inner{color:var(--hub-sys-color-secondary-emphasis)}:host(.hub-dropdown-item-secondary) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-secondary-subtle)}:host(.hub-dropdown-item-success) .hub-dropdown-item__inner{color:var(--hub-sys-color-success-emphasis)}:host(.hub-dropdown-item-success) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-success-subtle)}:host(.hub-dropdown-item-danger) .hub-dropdown-item__inner{color:var(--hub-sys-color-danger-emphasis)}:host(.hub-dropdown-item-danger) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-danger-subtle)}:host(.hub-dropdown-item-warning) .hub-dropdown-item__inner{color:var(--hub-sys-color-warning-emphasis)}:host(.hub-dropdown-item-warning) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-warning-subtle)}:host(.hub-dropdown-item-info) .hub-dropdown-item__inner{color:var(--hub-sys-color-info-emphasis)}:host(.hub-dropdown-item-info) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-info-subtle)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
263
|
+
}
|
|
264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownItemComponent, decorators: [{
|
|
265
|
+
type: Component,
|
|
266
|
+
args: [{ selector: 'hub-dropdown-item', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-dropdown-item' }, template: "<button\n\tclass=\"hub-dropdown-item__inner\"\n\ttype=\"button\"\n\t[disabled]=\"disabled() || null\"\n\t(click)=\"_handleClick()\">\n\t@if (icon()) {\n\t\t<i [class]=\"icon()\" aria-hidden=\"true\"></i>\n\t}\n\t<span class=\"hub-dropdown-item__label\"><ng-content></ng-content></span>\n\t@if (selected()) {\n\t\t<span class=\"hub-dropdown-item__check\" aria-hidden=\"true\">\u2713</span>\n\t}\n</button>\n", styles: [":where(:host){--hub-dropdown-item-padding-y: .4375rem;--hub-dropdown-item-padding-x: .875rem;--hub-dropdown-item-hover-bg: var(--hub-sys-color-surface-subtle, #f8fafc);--hub-dropdown-item-border-radius: var(--hub-sys-radius-sm, .25rem);--hub-dropdown-item-disabled-opacity: .45}:host{display:block}.hub-dropdown-item__inner{display:flex;align-items:center;gap:.5rem;width:100%;padding:var(--hub-dropdown-item-padding-y) var(--hub-dropdown-item-padding-x);border:none;background:transparent;font-size:.875rem;color:inherit;cursor:pointer;text-align:start;border-radius:var(--hub-dropdown-item-border-radius);transition:background .1s ease}.hub-dropdown-item__inner:hover{background:var(--hub-dropdown-item-hover-bg)}.hub-dropdown-item__inner:disabled{opacity:var(--hub-dropdown-item-disabled-opacity);pointer-events:none}.hub-dropdown-item__label{flex:1}.hub-dropdown-item__check{margin-inline-start:auto}:host(.hub-dropdown-item-disabled) .hub-dropdown-item__inner{opacity:var(--hub-dropdown-item-disabled-opacity);pointer-events:none}:host(.hub-dropdown-item-primary) .hub-dropdown-item__inner{color:var(--hub-sys-color-primary-emphasis)}:host(.hub-dropdown-item-primary) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-primary-subtle)}:host(.hub-dropdown-item-secondary) .hub-dropdown-item__inner{color:var(--hub-sys-color-secondary-emphasis)}:host(.hub-dropdown-item-secondary) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-secondary-subtle)}:host(.hub-dropdown-item-success) .hub-dropdown-item__inner{color:var(--hub-sys-color-success-emphasis)}:host(.hub-dropdown-item-success) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-success-subtle)}:host(.hub-dropdown-item-danger) .hub-dropdown-item__inner{color:var(--hub-sys-color-danger-emphasis)}:host(.hub-dropdown-item-danger) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-danger-subtle)}:host(.hub-dropdown-item-warning) .hub-dropdown-item__inner{color:var(--hub-sys-color-warning-emphasis)}:host(.hub-dropdown-item-warning) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-warning-subtle)}:host(.hub-dropdown-item-info) .hub-dropdown-item__inner{color:var(--hub-sys-color-info-emphasis)}:host(.hub-dropdown-item-info) .hub-dropdown-item__inner:hover{background:var(--hub-sys-color-info-subtle)}\n"] }]
|
|
267
|
+
}], propDecorators: { color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }], itemClick: [{ type: i0.Output, args: ["itemClick"] }], _hostClass: [{
|
|
268
|
+
type: HostBinding,
|
|
269
|
+
args: ['class']
|
|
270
|
+
}] } });
|
|
271
|
+
|
|
272
|
+
/** Horizontal separator for grouping items inside HubDropdownPanelComponent. */
|
|
273
|
+
class HubDropdownDividerComponent {
|
|
274
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownDividerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
275
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.1", type: HubDropdownDividerComponent, isStandalone: true, selector: "hub-dropdown-divider", host: { attributes: { "role": "separator", "aria-hidden": "true" }, classAttribute: "hub-dropdown-divider" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:block;height:1px;background:var(--hub-dropdown-divider-color, var(--hub-sys-color-border-subtle, #e2e8f0));margin:.25rem 0}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
276
|
+
}
|
|
277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownDividerComponent, decorators: [{
|
|
278
|
+
type: Component,
|
|
279
|
+
args: [{ selector: 'hub-dropdown-divider', standalone: true, template: '', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
280
|
+
class: 'hub-dropdown-divider',
|
|
281
|
+
role: 'separator',
|
|
282
|
+
'aria-hidden': 'true'
|
|
283
|
+
}, styles: [":host{display:block;height:1px;background:var(--hub-dropdown-divider-color, var(--hub-sys-color-border-subtle, #e2e8f0));margin:.25rem 0}\n"] }]
|
|
284
|
+
}] });
|
|
285
|
+
|
|
286
|
+
/** Group label for organizing items inside HubDropdownPanelComponent. */
|
|
287
|
+
class HubDropdownHeaderComponent {
|
|
288
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
289
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.0.1", type: HubDropdownHeaderComponent, isStandalone: true, selector: "hub-dropdown-header", host: { classAttribute: "hub-dropdown-header" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true, styles: [":host{display:block;padding:.375rem var(--hub-dropdown-header-padding-x, .875rem) .1875rem;font-size:var(--hub-dropdown-header-font-size, .6875rem);font-weight:700;color:var(--hub-dropdown-header-color, var(--hub-sys-color-text-subtle, #94a3b8));text-transform:uppercase;letter-spacing:.06em}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
290
|
+
}
|
|
291
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownHeaderComponent, decorators: [{
|
|
292
|
+
type: Component,
|
|
293
|
+
args: [{ selector: 'hub-dropdown-header', standalone: true, template: `<ng-content></ng-content>`, changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'hub-dropdown-header' }, styles: [":host{display:block;padding:.375rem var(--hub-dropdown-header-padding-x, .875rem) .1875rem;font-size:var(--hub-dropdown-header-font-size, .6875rem);font-weight:700;color:var(--hub-dropdown-header-color, var(--hub-sys-color-text-subtle, #94a3b8));text-transform:uppercase;letter-spacing:.06em}\n"] }]
|
|
294
|
+
}] });
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Applies hub-btn styles to any host element (button, a, div, etc.).
|
|
298
|
+
* Use this when the element type must stay native and cannot be replaced by <hub-btn>.
|
|
299
|
+
* Exposes the same inputs as HubBtnComponent.
|
|
300
|
+
*/
|
|
301
|
+
class HubBtnDirective {
|
|
302
|
+
variant = input('solid', /* @ts-ignore */
|
|
303
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
304
|
+
color = input('primary', /* @ts-ignore */
|
|
305
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
306
|
+
size = input('md', /* @ts-ignore */
|
|
307
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
308
|
+
iconOnly = input(false, /* @ts-ignore */
|
|
309
|
+
...(ngDevMode ? [{ debugName: "iconOnly" }] : /* istanbul ignore next */ []));
|
|
310
|
+
loading = input(false, /* @ts-ignore */
|
|
311
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
312
|
+
disabled = input(false, /* @ts-ignore */
|
|
313
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
314
|
+
get _hostClass() {
|
|
315
|
+
return [
|
|
316
|
+
`hub-btn-${this.variant()}`,
|
|
317
|
+
`hub-btn-${this.color()}`,
|
|
318
|
+
`hub-btn-${this.size()}`,
|
|
319
|
+
this.iconOnly() ? 'hub-btn-icon' : '',
|
|
320
|
+
this.loading() ? 'hub-btn-loading' : '',
|
|
321
|
+
this.disabled() ? 'hub-btn-disabled' : ''
|
|
322
|
+
]
|
|
323
|
+
.filter(Boolean)
|
|
324
|
+
.join(' ');
|
|
325
|
+
}
|
|
326
|
+
get _disabledAttr() {
|
|
327
|
+
return this.disabled() ? true : null;
|
|
328
|
+
}
|
|
329
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubBtnDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
330
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.1", type: HubBtnDirective, isStandalone: true, selector: "[hubBtn]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, iconOnly: { classPropertyName: "iconOnly", publicName: "iconOnly", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "this._hostClass", "attr.disabled": "this._disabledAttr" }, classAttribute: "hub-btn" }, ngImport: i0 });
|
|
331
|
+
}
|
|
332
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubBtnDirective, decorators: [{
|
|
333
|
+
type: Directive,
|
|
334
|
+
args: [{
|
|
335
|
+
selector: '[hubBtn]',
|
|
336
|
+
standalone: true,
|
|
337
|
+
host: { class: 'hub-btn' }
|
|
338
|
+
}]
|
|
339
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], iconOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconOnly", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], _hostClass: [{
|
|
340
|
+
type: HostBinding,
|
|
341
|
+
args: ['class']
|
|
342
|
+
}], _disabledAttr: [{
|
|
343
|
+
type: HostBinding,
|
|
344
|
+
args: ['attr.disabled']
|
|
345
|
+
}] } });
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Turns any host element into a dropdown trigger.
|
|
349
|
+
* Renders an ng-template in a body-level overlay managed by OverlayService (no CDK).
|
|
350
|
+
* When closeOnSelect is true, any click inside the panel closes the overlay automatically.
|
|
351
|
+
*/
|
|
352
|
+
class HubDropdownDirective {
|
|
353
|
+
/** The ng-template to render inside the overlay panel. */
|
|
354
|
+
tpl = input.required({ ...(ngDevMode ? { debugName: "tpl" } : /* istanbul ignore next */ {}), alias: 'hubDropdown' });
|
|
355
|
+
placement = input('bottom-start', /* @ts-ignore */
|
|
356
|
+
...(ngDevMode ? [{ debugName: "placement" }] : /* istanbul ignore next */ []));
|
|
357
|
+
trigger = input('click', /* @ts-ignore */
|
|
358
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
359
|
+
/** When true, any click inside the panel content closes the dropdown. */
|
|
360
|
+
closeOnSelect = input(true, /* @ts-ignore */
|
|
361
|
+
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
362
|
+
disabled = input(false, /* @ts-ignore */
|
|
363
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
364
|
+
/** Vertical offset in pixels between the trigger and the panel. */
|
|
365
|
+
offsetY = input(4, /* @ts-ignore */
|
|
366
|
+
...(ngDevMode ? [{ debugName: "offsetY" }] : /* istanbul ignore next */ []));
|
|
367
|
+
panelClass = input('', /* @ts-ignore */
|
|
368
|
+
...(ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []));
|
|
369
|
+
isOpen = model(false, /* @ts-ignore */
|
|
370
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
371
|
+
opened = output();
|
|
372
|
+
closed = output();
|
|
373
|
+
_overlayRef = null;
|
|
374
|
+
_el = inject((ElementRef));
|
|
375
|
+
_vcr = inject(ViewContainerRef);
|
|
376
|
+
_overlay = inject(OverlayService);
|
|
377
|
+
_destroyRef = inject(DestroyRef);
|
|
378
|
+
constructor() {
|
|
379
|
+
fromEvent(document, 'keydown')
|
|
380
|
+
.pipe(filter((e) => e.key === 'Escape' && this.isOpen()), takeUntilDestroyed(this._destroyRef))
|
|
381
|
+
.subscribe(() => this.close());
|
|
382
|
+
}
|
|
383
|
+
/** Open the dropdown and mount the overlay. */
|
|
384
|
+
open() {
|
|
385
|
+
if (this.disabled() || this.isOpen())
|
|
386
|
+
return;
|
|
387
|
+
const positionStrategy = this._overlay.position().flexibleConnectedTo(this._el).withPositions(this._buildPositions());
|
|
388
|
+
const panelClasses = ['hub-dropdown-overlay'];
|
|
389
|
+
if (this.panelClass())
|
|
390
|
+
panelClasses.push(this.panelClass());
|
|
391
|
+
this._overlayRef = this._overlay.create({ positionStrategy, panelClass: panelClasses });
|
|
392
|
+
const panelEl = this._overlayRef.attach(this.tpl(), this._vcr);
|
|
393
|
+
// Close on click-outside via backdrop
|
|
394
|
+
this._overlayRef.onBackdropClick(() => this.close());
|
|
395
|
+
// Close on click-inside when closeOnSelect is true
|
|
396
|
+
if (this.closeOnSelect() && panelEl) {
|
|
397
|
+
fromEvent(panelEl, 'click')
|
|
398
|
+
.pipe(take(1), takeUntilDestroyed(this._destroyRef))
|
|
399
|
+
.subscribe(() => this.close());
|
|
400
|
+
}
|
|
401
|
+
this.isOpen.set(true);
|
|
402
|
+
this.opened.emit();
|
|
403
|
+
// Close on scroll so the panel stays aligned with the trigger
|
|
404
|
+
fromEvent(document, 'scroll', { passive: true, capture: true })
|
|
405
|
+
.pipe(take(1), takeUntilDestroyed(this._destroyRef))
|
|
406
|
+
.subscribe(() => this.close());
|
|
407
|
+
// Click-outside detection (document-level)
|
|
408
|
+
fromEvent(document, 'click')
|
|
409
|
+
.pipe(filter((e) => !this._el.nativeElement.contains(e.target) && !!this._overlayRef?.hasAttached()), take(1), takeUntilDestroyed(this._destroyRef))
|
|
410
|
+
.subscribe(() => this.close());
|
|
411
|
+
}
|
|
412
|
+
/** Close the dropdown and destroy the overlay. */
|
|
413
|
+
close() {
|
|
414
|
+
if (!this.isOpen())
|
|
415
|
+
return;
|
|
416
|
+
this._overlayRef?.detach();
|
|
417
|
+
this._overlayRef?.dispose();
|
|
418
|
+
this._overlayRef = null;
|
|
419
|
+
this.isOpen.set(false);
|
|
420
|
+
this.closed.emit();
|
|
421
|
+
}
|
|
422
|
+
/** Toggle between open and closed. */
|
|
423
|
+
toggle() {
|
|
424
|
+
this.isOpen() ? this.close() : this.open();
|
|
425
|
+
}
|
|
426
|
+
_onHostClick() {
|
|
427
|
+
if (this.trigger() === 'click')
|
|
428
|
+
this.toggle();
|
|
429
|
+
}
|
|
430
|
+
_onHostEnter() {
|
|
431
|
+
if (this.trigger() === 'hover')
|
|
432
|
+
this.open();
|
|
433
|
+
}
|
|
434
|
+
_onHostLeave() {
|
|
435
|
+
if (this.trigger() === 'hover')
|
|
436
|
+
this.close();
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Translates HubDropdownPlacement tokens to ConnectionPosition arrays.
|
|
440
|
+
* The OverlayPosition tries each entry in order, using the first that fits.
|
|
441
|
+
*/
|
|
442
|
+
_buildPositions() {
|
|
443
|
+
const o = this.offsetY();
|
|
444
|
+
const map = {
|
|
445
|
+
'bottom-start': [{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: o }],
|
|
446
|
+
bottom: [{ originX: 'center', originY: 'bottom', overlayX: 'center', overlayY: 'top', offsetY: o }],
|
|
447
|
+
'bottom-end': [{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: o }],
|
|
448
|
+
'top-start': [{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -o }],
|
|
449
|
+
top: [{ originX: 'center', originY: 'top', overlayX: 'center', overlayY: 'bottom', offsetY: -o }],
|
|
450
|
+
'top-end': [{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -o }],
|
|
451
|
+
start: [{ originX: 'start', originY: 'center', overlayX: 'end', overlayY: 'center', offsetX: -o }],
|
|
452
|
+
end: [{ originX: 'end', originY: 'center', overlayX: 'start', overlayY: 'center', offsetX: o }]
|
|
453
|
+
};
|
|
454
|
+
return map[this.placement()];
|
|
455
|
+
}
|
|
456
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
457
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.1", type: HubDropdownDirective, isStandalone: true, selector: "[hubDropdown]", inputs: { tpl: { classPropertyName: "tpl", publicName: "hubDropdown", isSignal: true, isRequired: true, transformFunction: null }, placement: { classPropertyName: "placement", publicName: "placement", isSignal: true, isRequired: false, transformFunction: null }, trigger: { classPropertyName: "trigger", publicName: "trigger", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, offsetY: { classPropertyName: "offsetY", publicName: "offsetY", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", opened: "opened", closed: "closed" }, host: { listeners: { "click": "_onHostClick()", "mouseenter": "_onHostEnter()", "mouseleave": "_onHostLeave()" } }, exportAs: ["hubDropdown"], ngImport: i0 });
|
|
458
|
+
}
|
|
459
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.1", ngImport: i0, type: HubDropdownDirective, decorators: [{
|
|
460
|
+
type: Directive,
|
|
461
|
+
args: [{
|
|
462
|
+
selector: '[hubDropdown]',
|
|
463
|
+
standalone: true,
|
|
464
|
+
exportAs: 'hubDropdown',
|
|
465
|
+
host: {
|
|
466
|
+
'(click)': '_onHostClick()',
|
|
467
|
+
'(mouseenter)': '_onHostEnter()',
|
|
468
|
+
'(mouseleave)': '_onHostLeave()'
|
|
469
|
+
}
|
|
470
|
+
}]
|
|
471
|
+
}], ctorParameters: () => [], propDecorators: { tpl: [{ type: i0.Input, args: [{ isSignal: true, alias: "hubDropdown", required: true }] }], placement: [{ type: i0.Input, args: [{ isSignal: true, alias: "placement", required: false }] }], trigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "trigger", required: false }] }], closeOnSelect: [{ type: i0.Input, args: [{ isSignal: true, alias: "closeOnSelect", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], offsetY: [{ type: i0.Input, args: [{ isSignal: true, alias: "offsetY", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], isOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "isOpen", required: false }] }, { type: i0.Output, args: ["isOpenChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
472
|
+
|
|
473
|
+
/*
|
|
474
|
+
* Public API Surface of ng-hub-ui-buttons
|
|
475
|
+
*/
|
|
476
|
+
// Types
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Generated bundle index. Do not edit.
|
|
480
|
+
*/
|
|
481
|
+
|
|
482
|
+
export { DROPDOWN_CONTEXT, HubBtnComponent, HubBtnDirective, HubDropdownDirective, HubDropdownDividerComponent, HubDropdownHeaderComponent, HubDropdownItemComponent, HubDropdownPanelComponent, HubFabComponent, HubSpeedDialComponent, HubSpeedDialItemComponent };
|
|
483
|
+
//# sourceMappingURL=ng-hub-ui-buttons.mjs.map
|