@skyux/forms 15.0.0-alpha.14 → 15.0.0-alpha.16

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.
@@ -1,7 +1,7 @@
1
1
  import * as i1 from '@angular/common';
2
- import { CommonModule, formatNumber } from '@angular/common';
2
+ import { CommonModule, formatNumber, NgTemplateOutlet } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { NgModule, Pipe, inject, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, Directive, InjectionToken, HostBinding, booleanAttribute, numberAttribute, EventEmitter, ElementRef, ViewChild, Output, Injectable, DOCUMENT, input, computed, linkedSignal, RendererFactory2, Renderer2, ContentChild, ViewEncapsulation, KeyValueDiffers, forwardRef, ContentChildren, HostListener, NgZone } from '@angular/core';
4
+ import { NgModule, Pipe, inject, ChangeDetectorRef, Input, ChangeDetectionStrategy, Component, Directive, InjectionToken, HostBinding, booleanAttribute, numberAttribute, EventEmitter, ElementRef, ViewChild, Output, Injectable, DOCUMENT, input, computed, linkedSignal, RendererFactory2, Renderer2, ContentChild, ViewEncapsulation, KeyValueDiffers, forwardRef, ContentChildren, HostListener, NgZone, output } from '@angular/core';
5
5
  import * as i2$1 from '@angular/forms';
6
6
  import { NG_VALIDATORS, FormsModule, ReactiveFormsModule, Validators, NG_VALUE_ACCESSOR, NgControl, FormControlDirective, FormControlName, NgModel } from '@angular/forms';
7
7
  import * as i6 from '@skyux/i18n';
@@ -19,6 +19,8 @@ import { SkyStatusIndicatorModule } from '@skyux/indicators';
19
19
  import { Subject, BehaviorSubject, ReplaySubject, takeUntil as takeUntil$1 } from 'rxjs';
20
20
  import { takeUntil, take } from 'rxjs/operators';
21
21
  import { coerceNumberProperty, coerceBooleanProperty } from '@angular/cdk/coercion';
22
+ import * as i2$2 from '@skyux/router';
23
+ import { SkyAppLinkModule, SkyHrefModule } from '@skyux/router';
22
24
 
23
25
  /* istanbul ignore file */
24
26
  /**
@@ -4865,9 +4867,85 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
4865
4867
  }]
4866
4868
  }] });
4867
4869
 
4870
+ /**
4871
+ * Buttons provide interactive elements for users to trigger actions in the system.
4872
+ */
4873
+ class SkyButton {
4874
+ constructor() {
4875
+ /**
4876
+ * Whether the button is displayed as a block element that fills the horizontal space of its container.
4877
+ * @default false
4878
+ */
4879
+ this.block = input(false, { ...(ngDevMode ? { debugName: "block" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
4880
+ /**
4881
+ * The display style of the button.
4882
+ * @default "default"
4883
+ */
4884
+ this.buttonStyle = input('default', /* @ts-ignore */
4885
+ ...(ngDevMode ? [{ debugName: "buttonStyle" }] : /* istanbul ignore next */ []));
4886
+ /**
4887
+ * The type of the underlying HTML button element.
4888
+ * @default "button"
4889
+ */
4890
+ this.buttonType = input('button', /* @ts-ignore */
4891
+ ...(ngDevMode ? [{ debugName: "buttonType" }] : /* istanbul ignore next */ []));
4892
+ /**
4893
+ * Whether the button is disabled.
4894
+ * @default false
4895
+ */
4896
+ this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
4897
+ /**
4898
+ * The name of the icon to display.
4899
+ */
4900
+ this.iconName = input('', /* @ts-ignore */
4901
+ ...(ngDevMode ? [{ debugName: "iconName" }] : /* istanbul ignore next */ []));
4902
+ /**
4903
+ * Whether to hide the button's label. When the label is hidden, `labelText` is used as the button's ARIA label.
4904
+ * @default false
4905
+ */
4906
+ this.labelHidden = input(false, { ...(ngDevMode ? { debugName: "labelHidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
4907
+ /**
4908
+ * The text to display as the button's label.
4909
+ * @required
4910
+ */
4911
+ this.labelText = input.required(/* @ts-ignore */
4912
+ ...(ngDevMode ? [{ debugName: "labelText" }] : /* istanbul ignore next */ []));
4913
+ /**
4914
+ * Whether the icon is a logo icon.
4915
+ * @default false
4916
+ */
4917
+ this.logo = input(false, { ...(ngDevMode ? { debugName: "logo" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
4918
+ /**
4919
+ * The link for the button.
4920
+ */
4921
+ this.permalink = input(/* @ts-ignore */
4922
+ ...(ngDevMode ? [undefined, { debugName: "permalink" }] : /* istanbul ignore next */ []));
4923
+ /**
4924
+ * Fires when the button is clicked.
4925
+ */
4926
+ this.buttonClick = output();
4927
+ this.ariaLabel = computed(() => this.labelHidden() ? this.labelText() : null, /* @ts-ignore */
4928
+ ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
4929
+ this.buttonClass = computed(() => {
4930
+ let buttonClass = `sky-btn sky-btn-${this.buttonStyle()}`;
4931
+ if (this.block()) {
4932
+ buttonClass += ' sky-btn-block';
4933
+ }
4934
+ return buttonClass;
4935
+ }, /* @ts-ignore */
4936
+ ...(ngDevMode ? [{ debugName: "buttonClass" }] : /* istanbul ignore next */ []));
4937
+ }
4938
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: SkyButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4939
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: SkyButton, isStandalone: true, selector: "sky-button", inputs: { block: { classPropertyName: "block", publicName: "block", isSignal: true, isRequired: false, transformFunction: null }, buttonStyle: { classPropertyName: "buttonStyle", publicName: "buttonStyle", isSignal: true, isRequired: false, transformFunction: null }, buttonType: { classPropertyName: "buttonType", publicName: "buttonType", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, iconName: { classPropertyName: "iconName", publicName: "iconName", isSignal: true, isRequired: false, transformFunction: null }, labelHidden: { classPropertyName: "labelHidden", publicName: "labelHidden", isSignal: true, isRequired: false, transformFunction: null }, labelText: { classPropertyName: "labelText", publicName: "labelText", isSignal: true, isRequired: true, transformFunction: null }, logo: { classPropertyName: "logo", publicName: "logo", isSignal: true, isRequired: false, transformFunction: null }, permalink: { classPropertyName: "permalink", publicName: "permalink", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { buttonClick: "buttonClick" }, ngImport: i0, template: "@if (!disabled() && permalink(); as permalink) {\n @if (permalink.route?.commands) {\n <a\n href=\"\"\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [skyAppLink]=\"permalink.route.commands\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </a>\n } @else if (permalink.url) {\n <a\n href=\"\"\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [skyHref]=\"permalink.url\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </a>\n }\n} @else {\n <button\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [disabled]=\"disabled()\"\n [type]=\"buttonType()\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </button>\n}\n\n<ng-template #buttonContent>\n @if (iconName(); as iconName) {\n <sky-icon [class.sky-btn-block-logo]=\"logo()\" [iconName]=\"iconName\" />\n }\n\n @if (!labelHidden()) {\n <!-- Wrapping text in a span prevents extra space from rendering between the icon and text -->\n <span>{{ labelText() }}</span>\n }\n</ng-template>\n", styles: [":host{display:inline}:host:has(>.sky-btn-block){display:block}sky-icon:has(+span){margin-right:var(--sky-space-gap-icon-s)}.sky-btn:has(sky-icon:only-child){padding:var(--sky-comp-button-icon-space-inset-top) var(--sky-comp-button-icon-space-inset-right) var(--sky-comp-button-icon-space-inset-bottom) var(--sky-comp-button-icon-space-inset-left)}\n"], dependencies: [{ kind: "ngmodule", type: SkyIconModule }, { kind: "component", type: i4.λ1, selector: "sky-icon", inputs: ["iconName", "variant", "iconSize"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: SkyAppLinkModule }, { kind: "directive", type: i2$2.λ3, selector: "[skyAppLink]", inputs: ["skyAppLink"] }, { kind: "ngmodule", type: SkyHrefModule }, { kind: "directive", type: i2$2.λ1, selector: "[skyHref]", inputs: ["skyHref", "queryParams", "skyHrefElse"], outputs: ["skyHrefChange"] }] }); }
4940
+ }
4941
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: SkyButton, decorators: [{
4942
+ type: Component,
4943
+ args: [{ selector: 'sky-button', imports: [SkyIconModule, NgTemplateOutlet, SkyAppLinkModule, SkyHrefModule], template: "@if (!disabled() && permalink(); as permalink) {\n @if (permalink.route?.commands) {\n <a\n href=\"\"\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [fragment]=\"permalink.route.extras?.fragment\"\n [queryParams]=\"permalink.route.extras?.queryParams\"\n [queryParamsHandling]=\"permalink.route.extras?.queryParamsHandling\"\n [skyAppLink]=\"permalink.route.commands\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </a>\n } @else if (permalink.url) {\n <a\n href=\"\"\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [skyHref]=\"permalink.url\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </a>\n }\n} @else {\n <button\n [aria-label]=\"ariaLabel()\"\n [class]=\"buttonClass()\"\n [disabled]=\"disabled()\"\n [type]=\"buttonType()\"\n (click)=\"buttonClick.emit($event)\"\n >\n <ng-container *ngTemplateOutlet=\"buttonContent\" />\n </button>\n}\n\n<ng-template #buttonContent>\n @if (iconName(); as iconName) {\n <sky-icon [class.sky-btn-block-logo]=\"logo()\" [iconName]=\"iconName\" />\n }\n\n @if (!labelHidden()) {\n <!-- Wrapping text in a span prevents extra space from rendering between the icon and text -->\n <span>{{ labelText() }}</span>\n }\n</ng-template>\n", styles: [":host{display:inline}:host:has(>.sky-btn-block){display:block}sky-icon:has(+span){margin-right:var(--sky-space-gap-icon-s)}.sky-btn:has(sky-icon:only-child){padding:var(--sky-comp-button-icon-space-inset-top) var(--sky-comp-button-icon-space-inset-right) var(--sky-comp-button-icon-space-inset-bottom) var(--sky-comp-button-icon-space-inset-left)}\n"] }]
4944
+ }], propDecorators: { block: [{ type: i0.Input, args: [{ isSignal: true, alias: "block", required: false }] }], buttonStyle: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonStyle", required: false }] }], buttonType: [{ type: i0.Input, args: [{ isSignal: true, alias: "buttonType", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], iconName: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconName", required: false }] }], labelHidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelHidden", required: false }] }], labelText: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelText", required: true }] }], logo: [{ type: i0.Input, args: [{ isSignal: true, alias: "logo", required: false }] }], permalink: [{ type: i0.Input, args: [{ isSignal: true, alias: "permalink", required: false }] }], buttonClick: [{ type: i0.Output, args: ["buttonClick"] }] } });
4945
+
4868
4946
  /**
4869
4947
  * Generated bundle index. Do not edit.
4870
4948
  */
4871
4949
 
4872
- export { SKY_FORM_ERRORS_ENABLED, SkyCharacterCounterModule, SkyCheckboxModule, SkyFieldGroupModule, SkyFileAttachmentModule, SkyFileAttachmentsModule, SkyFileDropModule, SkyFileSizePipe, SkyFormErrorModule, SkyFormErrorsModule, SkyInputBoxHostService, SkyInputBoxModule, SkyRadioModule, SkyRequiredStateDirective, SkySelectionBoxModule, SkyToggleSwitchModule, SkyCharacterCounterIndicatorComponent as λ1, SkyInputBoxComponent as λ10, SkyRadioGroupComponent as λ11, SkyRadioLabelComponent as λ12, SkyRadioComponent as λ13, SkySelectionBoxDescriptionComponent as λ14, SkySelectionBoxGridComponent as λ15, SkySelectionBoxHeaderComponent as λ16, SkySelectionBoxComponent as λ17, SkyToggleSwitchComponent as λ19, SkyCharacterCounterInputDirective as λ2, SkyInputBoxControlDirective as λ20, SkyFormErrorsComponent as λ21, SkyFormErrorComponent as λ22, SkyCharacterCounterScreenReaderPipe as λ23, SkyCheckboxGroupComponent as λ24, SkyFieldGroupComponent as λ25, SkyInputBoxHintTextPipe as λ26, SkyCheckboxComponent as λ3, SkyCheckboxLabelComponent as λ4, SkyFileAttachmentComponent as λ7, SkyFileDropComponent as λ8, SkyFileItemComponent as λ9 };
4950
+ export { SKY_FORM_ERRORS_ENABLED, SkyButton, SkyCharacterCounterModule, SkyCheckboxModule, SkyFieldGroupModule, SkyFileAttachmentModule, SkyFileAttachmentsModule, SkyFileDropModule, SkyFileSizePipe, SkyFormErrorModule, SkyFormErrorsModule, SkyInputBoxHostService, SkyInputBoxModule, SkyRadioModule, SkyRequiredStateDirective, SkySelectionBoxModule, SkyToggleSwitchModule, SkyCharacterCounterIndicatorComponent as λ1, SkyInputBoxComponent as λ10, SkyRadioGroupComponent as λ11, SkyRadioLabelComponent as λ12, SkyRadioComponent as λ13, SkySelectionBoxDescriptionComponent as λ14, SkySelectionBoxGridComponent as λ15, SkySelectionBoxHeaderComponent as λ16, SkySelectionBoxComponent as λ17, SkyToggleSwitchComponent as λ19, SkyCharacterCounterInputDirective as λ2, SkyInputBoxControlDirective as λ20, SkyFormErrorsComponent as λ21, SkyFormErrorComponent as λ22, SkyCharacterCounterScreenReaderPipe as λ23, SkyCheckboxGroupComponent as λ24, SkyFieldGroupComponent as λ25, SkyInputBoxHintTextPipe as λ26, SkyCheckboxComponent as λ3, SkyCheckboxLabelComponent as λ4, SkyFileAttachmentComponent as λ7, SkyFileDropComponent as λ8, SkyFileItemComponent as λ9 };
4873
4951
  //# sourceMappingURL=skyux-forms.mjs.map