@vsn-ux/ngx-gaia 0.9.11 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Visma Software AS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -18,7 +18,7 @@ import { CdkTrapFocus } from '@angular/cdk/a11y';
18
18
  import * as i1$4 from '@angular/cdk/scrolling';
19
19
  import { CdkScrollable } from '@angular/cdk/scrolling';
20
20
  import * as i1$5 from '@angular/cdk/listbox';
21
- import { CdkOption, CdkListbox } from '@angular/cdk/listbox';
21
+ import { CdkOption, CdkListbox, CdkListboxModule } from '@angular/cdk/listbox';
22
22
 
23
23
  /**
24
24
  * Injection token that provides the base root font size in pixels.
@@ -1301,6 +1301,9 @@ class GaInputDirective {
1301
1301
  this.renderer.setAttribute(this.elementRef.nativeElement, 'placeholder', '');
1302
1302
  }
1303
1303
  }
1304
+ focus() {
1305
+ this.elementRef.nativeElement.focus();
1306
+ }
1304
1307
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaInputDirective, deps: [{ token: 'placeholder', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
1305
1308
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaInputDirective, isStandalone: true, selector: "[gaInput]", inputs: { invalidInput: { classPropertyName: "invalidInput", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, idInput: { classPropertyName: "idInput", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.id": "id()", "class.ga-input": "!hasWrapper", "class.ga-input--invalid": "!hasWrapper && invalid()", "attr.disabled": "disabled() ? \"\" : null" } }, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1306
1309
  }
@@ -1326,7 +1329,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
1326
1329
  class GaInputComponent {
1327
1330
  gaInput = contentChild.required(GaInputDirective);
1328
1331
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1329
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.4", type: GaInputComponent, isStandalone: true, selector: "ga-input", host: { properties: { "class.ga-input--invalid": "gaInput().invalid()" }, classAttribute: "ga-input" }, queries: [{ propertyName: "gaInput", first: true, predicate: GaInputDirective, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.CdkOverlayOrigin }], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1332
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "20.0.4", type: GaInputComponent, isStandalone: true, selector: "ga-input", host: { listeners: { "click": "gaInput().focus()" }, properties: { "class.ga-input--invalid": "gaInput().invalid()" }, classAttribute: "ga-input" }, queries: [{ propertyName: "gaInput", first: true, predicate: GaInputDirective, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1$1.CdkOverlayOrigin }], ngImport: i0, template: `<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1330
1333
  }
1331
1334
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaInputComponent, decorators: [{
1332
1335
  type: Component,
@@ -1338,6 +1341,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
1338
1341
  host: {
1339
1342
  class: 'ga-input',
1340
1343
  '[class.ga-input--invalid]': 'gaInput().invalid()',
1344
+ '(click)': 'gaInput().focus()',
1341
1345
  },
1342
1346
  }]
1343
1347
  }] });
@@ -1725,6 +1729,7 @@ class GaDatepickerInputDirective {
1725
1729
  updateValue(value, { updateView, emitToNgModel, } = {}) {
1726
1730
  this.value.set(value);
1727
1731
  this.lastValueValid.set(true);
1732
+ this.lastDateChangeEmittedValue.set(this.dateStruct());
1728
1733
  if (updateView) {
1729
1734
  this.formatValue();
1730
1735
  }
@@ -1738,7 +1743,6 @@ class GaDatepickerInputDirective {
1738
1743
  // ControlValueAccessor implementation
1739
1744
  writeValue(value) {
1740
1745
  this.updateValue(value, { updateView: true });
1741
- this.lastDateChangeEmittedValue.set(this.dateStruct());
1742
1746
  }
1743
1747
  registerOnChange(fn) {
1744
1748
  this.onNgChangeFn = fn;
@@ -4005,6 +4009,17 @@ class GaSelectComponent {
4005
4009
  this.connectedOverlay()?.overlayRef?.updatePosition();
4006
4010
  });
4007
4011
  });
4012
+ effect(() => {
4013
+ // update the overlayPosition since it may change size when selecting/deselecting options
4014
+ this.value();
4015
+ untracked(() => {
4016
+ if (this.multiple()) {
4017
+ setTimeout(() => {
4018
+ this.connectedOverlay()?.overlayRef?.updatePosition();
4019
+ });
4020
+ }
4021
+ });
4022
+ });
4008
4023
  }
4009
4024
  ngAfterContentInit() {
4010
4025
  effect(() => {
@@ -4106,8 +4121,9 @@ class GaSelectComponent {
4106
4121
  this.inputSearch()?.nativeElement !== document.activeElement) {
4107
4122
  this._onTouched?.();
4108
4123
  }
4109
- this.value.set(null);
4110
- this._onModelChanged?.(null);
4124
+ const value = this.multiple() ? [] : null;
4125
+ this.value.set(value);
4126
+ this._onModelChanged?.(value);
4111
4127
  this.autoClose();
4112
4128
  }
4113
4129
  onInputKeyDown(event) {
@@ -4636,6 +4652,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4636
4652
  }]
4637
4653
  }] });
4638
4654
 
4655
+ class GaChipListboxComponent {
4656
+ cdkListbox = inject(CdkListbox, { self: true });
4657
+ orientation = input('horizontal');
4658
+ variant = input('default');
4659
+ valueChange = output();
4660
+ disabled = computed(() => this.cdkListbox.disabled);
4661
+ constructor() {
4662
+ effect(() => {
4663
+ this.cdkListbox.orientation = this.orientation();
4664
+ });
4665
+ this.cdkListbox.valueChange
4666
+ .pipe(takeUntilDestroyed())
4667
+ .subscribe((event) => {
4668
+ const value = !this.cdkListbox.multiple ? event.value[0] : event.value;
4669
+ this.valueChange.emit(value);
4670
+ });
4671
+ }
4672
+ focus() {
4673
+ this.cdkListbox.focus();
4674
+ }
4675
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipListboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4676
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaChipListboxComponent, isStandalone: true, selector: "ga-chip-listbox", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { classAttribute: "ga-chip-listbox" }, hostDirectives: [{ directive: i1$5.CdkListbox, inputs: ["cdkListboxMultiple", "multiple", "cdkListboxValue", "value", "cdkListboxDisabled", "disabled", "cdkListboxCompareWith", "compareWith"] }], ngImport: i0, template: "<ng-content />\n" });
4677
+ }
4678
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipListboxComponent, decorators: [{
4679
+ type: Component,
4680
+ args: [{ selector: 'ga-chip-listbox', hostDirectives: [
4681
+ {
4682
+ directive: CdkListbox,
4683
+ inputs: [
4684
+ 'cdkListboxMultiple: multiple',
4685
+ 'cdkListboxValue: value',
4686
+ 'cdkListboxDisabled: disabled',
4687
+ 'cdkListboxCompareWith: compareWith',
4688
+ ],
4689
+ },
4690
+ ], host: {
4691
+ class: 'ga-chip-listbox',
4692
+ }, template: "<ng-content />\n" }]
4693
+ }], ctorParameters: () => [] });
4694
+
4695
+ class GaChipComponent {
4696
+ cdkOption = inject(CdkOption, { self: true });
4697
+ listbox = inject(GaChipListboxComponent);
4698
+ _isSelected = signal(null);
4699
+ selected = this._isSelected.asReadonly();
4700
+ value = input.required();
4701
+ disabled = input(false, { transform: booleanAttribute });
4702
+ constructor() {
4703
+ afterEveryRender({
4704
+ read: () => {
4705
+ // NOTE: currently there is no other reliable way to track the selected state,
4706
+ // refactor once cdk will be based on signals or more appropriate events introduced
4707
+ this._isSelected.set(this.cdkOption.isSelected());
4708
+ },
4709
+ });
4710
+ }
4711
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4712
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.0.4", type: GaChipComponent, isStandalone: true, selector: "ga-chip", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.ga-quick-filter-button--transparent": "listbox.variant() === 'transparent'", "class.ga-quick-filter-button--disabled": "disabled() || listbox.disabled()", "class.ga-quick-filter-button--selected": "selected()" }, classAttribute: "ga-quick-filter-button" }, hostDirectives: [{ directive: i1$5.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled"] }], ngImport: i0, template: "<ng-content />\n", dependencies: [{ kind: "ngmodule", type: CdkListboxModule }] });
4713
+ }
4714
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipComponent, decorators: [{
4715
+ type: Component,
4716
+ args: [{ selector: 'ga-chip', imports: [CdkListboxModule], hostDirectives: [
4717
+ {
4718
+ directive: CdkOption,
4719
+ inputs: ['cdkOption: value', 'cdkOptionDisabled: disabled'],
4720
+ },
4721
+ ], host: {
4722
+ class: 'ga-quick-filter-button',
4723
+ '[class.ga-quick-filter-button--transparent]': "listbox.variant() === 'transparent'",
4724
+ '[class.ga-quick-filter-button--disabled]': 'disabled() || listbox.disabled()',
4725
+ '[class.ga-quick-filter-button--selected]': 'selected()',
4726
+ }, template: "<ng-content />\n" }]
4727
+ }], ctorParameters: () => [] });
4728
+
4729
+ class GaChipModule {
4730
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
4731
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.4", ngImport: i0, type: GaChipModule, imports: [GaChipComponent, GaChipListboxComponent], exports: [GaChipComponent, GaChipListboxComponent] });
4732
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipModule, imports: [GaChipComponent] });
4733
+ }
4734
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaChipModule, decorators: [{
4735
+ type: NgModule,
4736
+ args: [{
4737
+ imports: [GaChipComponent, GaChipListboxComponent],
4738
+ exports: [GaChipComponent, GaChipListboxComponent],
4739
+ }]
4740
+ }] });
4741
+
4639
4742
  /*
4640
4743
  * Public API Surface of ngx-gaia
4641
4744
  */
@@ -4644,5 +4747,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
4644
4747
  * Generated bundle index. Do not edit.
4645
4748
  */
4646
4749
 
4647
- export { CHECKBOX_CONTROL_VALUE_ACCESSOR, DEFAULT_MODAL_OPTIONS, GA_ALERT_I18N_FACTORY, GA_BASE_FONT_SIZE, GA_BUTTON_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_DATEPICKER_I18N_FACTORY, GA_DATEPICKER_PARSER_FORMATTER_FACTORY, GA_DATEPICKER_VALUE_ADAPTER_FACTORY, GA_DATE_PARSER_FORMATTER_CONFIG, GA_DEFAULT_DATEPICKER_FORMATS, GA_FORM_CONTROL_ADAPTER, GA_FORM_ERRORS, GA_ICON_DEFAULT_SIZE, GA_MODAL_DATA, GA_MODAL_I18N_FACTORY, GA_SELECT_I18N_FACTORY, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonI18n, GaButtonI18nDefault, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaDatepickerComponent, GaDatepickerI18n, GaDatepickerI18nDefault, GaDatepickerInputDirective, GaDatepickerModule, GaDatepickerNativeUtcIsoValueAdapter, GaDatepickerNativeUtcValueAdapter, GaDatepickerParserFormatter, GaDatepickerParserFormatterDefault, GaDatepickerStructValueAdapter, GaDatepickerToggleComponent, GaDatepickerValueAdapter, GaFieldErrorDirective, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormControlErrorsDirective, GaFormFieldComponent, GaFormFieldConnector, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaLabelledByFormFieldDirective, GaLinkDirective, GaLinkModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaModalActionsComponent, GaModalCloseDirective, GaModalComponent, GaModalContentComponent, GaModalDescriptionComponent, GaModalDescriptionDirective, GaModalHeaderComponent, GaModalI18n, GaModalI18nDefault, GaModalLabelDirective, GaModalModule, GaModalOptions, GaModalRef, GaModalService, GaModalTitleDirective, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlIconButtonComponent, GaSegmentedControlModule, GaSegmentedControlTextButtonComponent, GaSelectComponent, GaSelectDropdownComponent, GaSelectDropdownSpinnerComponent, GaSelectI18n, GaSelectI18nDefault, GaSelectModule, GaSelectRequiredValidator, GaSelectValueComponent, GaSpinnerComponent, GaSpinnerModule, GaSwitchComponent, GaSwitchModule, GaTextAreaDirective, GaTextAreaModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, compareStructs, extendGaDateParserFormatter, injectNgControlState, provideGaAlertI18n, provideGaBaseFontSize, provideGaButtonI18n, provideGaDatepickerI18n, provideGaDatepickerParserFormatter, provideGaDatepickerValueAdapter, provideGaFormErrors, provideGaModalI18n, provideGaModalOptions, provideGaSelectI18n };
4750
+ export { CHECKBOX_CONTROL_VALUE_ACCESSOR, DEFAULT_MODAL_OPTIONS, GA_ALERT_I18N_FACTORY, GA_BASE_FONT_SIZE, GA_BUTTON_I18N_FACTORY, GA_CHECKBOX_REQUIRED_VALIDATOR, GA_DATEPICKER_I18N_FACTORY, GA_DATEPICKER_PARSER_FORMATTER_FACTORY, GA_DATEPICKER_VALUE_ADAPTER_FACTORY, GA_DATE_PARSER_FORMATTER_CONFIG, GA_DEFAULT_DATEPICKER_FORMATS, GA_FORM_CONTROL_ADAPTER, GA_FORM_ERRORS, GA_ICON_DEFAULT_SIZE, GA_MODAL_DATA, GA_MODAL_I18N_FACTORY, GA_SELECT_I18N_FACTORY, GA_SELECT_REQUIRED_VALIDATOR, GA_TOOLTIP_DEFAULT_OFFSET, GaAlertComponent, GaAlertI18n, GaAlertI18nDefault, GaAlertModule, GaAlertTitleActionsComponent, GaAlertTitleComponent, GaBadgeComponent, GaBadgeModule, GaButtonDirective, GaButtonI18n, GaButtonI18nDefault, GaButtonModule, GaCardComponent, GaCardModule, GaCheckboxComponent, GaCheckboxModule, GaCheckboxRequiredValidator, GaChipComponent, GaChipListboxComponent, GaChipModule, GaDatepickerComponent, GaDatepickerI18n, GaDatepickerI18nDefault, GaDatepickerInputDirective, GaDatepickerModule, GaDatepickerNativeUtcIsoValueAdapter, GaDatepickerNativeUtcValueAdapter, GaDatepickerParserFormatter, GaDatepickerParserFormatterDefault, GaDatepickerStructValueAdapter, GaDatepickerToggleComponent, GaDatepickerValueAdapter, GaFieldErrorDirective, GaFieldInfoComponent, GaFieldLabelComponent, GaFormControlDirective, GaFormControlErrorsDirective, GaFormFieldComponent, GaFormFieldConnector, GaFormFieldModule, GaIconButtonDirective, GaIconComponent, GaIconModule, GaInputComponent, GaInputDirective, GaInputModule, GaLabelledByFormFieldDirective, GaLinkDirective, GaLinkModule, GaMenuComponent, GaMenuItemComponent, GaMenuModule, GaMenuSeparatorComponent, GaMenuTitleComponent, GaMenuTriggerDirective, GaMenuTriggerIconComponent, GaModalActionsComponent, GaModalCloseDirective, GaModalComponent, GaModalContentComponent, GaModalDescriptionComponent, GaModalDescriptionDirective, GaModalHeaderComponent, GaModalI18n, GaModalI18nDefault, GaModalLabelDirective, GaModalModule, GaModalOptions, GaModalRef, GaModalService, GaModalTitleDirective, GaOptgroupComponent, GaOptionComponent, GaRadioButtonComponent, GaRadioGroupComponent, GaRadioModule, GaSegmentedControlButtonDirective, GaSegmentedControlComponent, GaSegmentedControlIconButtonComponent, GaSegmentedControlModule, GaSegmentedControlTextButtonComponent, GaSelectComponent, GaSelectDropdownComponent, GaSelectDropdownSpinnerComponent, GaSelectI18n, GaSelectI18nDefault, GaSelectModule, GaSelectRequiredValidator, GaSelectValueComponent, GaSpinnerComponent, GaSpinnerModule, GaSwitchComponent, GaSwitchModule, GaTextAreaDirective, GaTextAreaModule, GaTooltipComponent, GaTooltipDirective, GaTooltipModule, RADIO_CONTROL_VALUE_ACCESSOR, SWITCH_CONTROL_VALUE_ACCESSOR, compareStructs, extendGaDateParserFormatter, injectNgControlState, provideGaAlertI18n, provideGaBaseFontSize, provideGaButtonI18n, provideGaDatepickerI18n, provideGaDatepickerParserFormatter, provideGaDatepickerValueAdapter, provideGaFormErrors, provideGaModalI18n, provideGaModalOptions, provideGaSelectI18n };
4648
4751
  //# sourceMappingURL=vsn-ux-ngx-gaia.mjs.map