@vsn-ux/ngx-gaia 0.8.5 → 0.8.6

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.
@@ -2369,6 +2369,7 @@ class GaOptionComponent {
2369
2369
  cdkOption = inject(CdkOption, { self: true });
2370
2370
  value = input(null);
2371
2371
  disabled = input(false, { transform: booleanAttribute });
2372
+ hidden = input(false, { transform: booleanAttribute });
2372
2373
  withInput = input(this.selectComponent.multiple(), {
2373
2374
  transform: booleanAttribute,
2374
2375
  });
@@ -2397,6 +2398,9 @@ class GaOptionComponent {
2397
2398
  if (this.value() !== this.cdkOption && this.cdkOption.value === undefined) {
2398
2399
  this.cdkOption.value = this.value();
2399
2400
  }
2401
+ effect(() => {
2402
+ this.cdkOption.disabled = this.disabled() || this.hidden();
2403
+ });
2400
2404
  }
2401
2405
  onClick() {
2402
2406
  if (!this.cdkOption.disabled) {
@@ -2404,7 +2408,7 @@ class GaOptionComponent {
2404
2408
  }
2405
2409
  }
2406
2410
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaOptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2407
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaOptionComponent, isStandalone: true, selector: "ga-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, withInput: { classPropertyName: "withInput", publicName: "withInput", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "class.ga-dropdown__item--selected": "selected()", "class.ga-dropdown__item--disabled": "cdkOption.disabled", "class.ga-dropdown__item--active": "active() && !cdkOption.disabled" }, classAttribute: "ga-dropdown__item" }, hostDirectives: [{ directive: i1$4.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled", "cdkOptionTypeaheadLabel", "typeaheadLabel"] }], ngImport: i0, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<div class=\"ga-dropdown__item-label\"><ng-content /></div>\n", dependencies: [{ kind: "ngmodule", type: GaCheckboxModule }, { kind: "component", type: GaCheckboxComponent, selector: "ga-checkbox", inputs: ["value", "disabled", "checked", "name", "id", "indeterminate", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage", "required"], outputs: ["change", "indeterminateChange"] }, { kind: "ngmodule", type: GaRadioModule }, { kind: "component", type: GaRadioButtonComponent, selector: "ga-radio-button", inputs: ["value", "id", "name", "checked", "disabled", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage"], outputs: ["change"] }] });
2411
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.0.4", type: GaOptionComponent, isStandalone: true, selector: "ga-option", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, withInput: { classPropertyName: "withInput", publicName: "withInput", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick()" }, properties: { "class.ga-dropdown__item--selected": "selected()", "class.ga-dropdown__item--disabled": "cdkOption.disabled", "class.ga-dropdown__item--active": "active() && !cdkOption.disabled", "attr.hidden": "hidden() ? '' : null" }, classAttribute: "ga-dropdown__item" }, hostDirectives: [{ directive: i1$4.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled", "cdkOptionTypeaheadLabel", "typeaheadLabel"] }], ngImport: i0, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<div class=\"ga-dropdown__item-label\"><ng-content /></div>\n", dependencies: [{ kind: "ngmodule", type: GaCheckboxModule }, { kind: "component", type: GaCheckboxComponent, selector: "ga-checkbox", inputs: ["value", "disabled", "checked", "name", "id", "indeterminate", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage", "required"], outputs: ["change", "indeterminateChange"] }, { kind: "ngmodule", type: GaRadioModule }, { kind: "component", type: GaRadioButtonComponent, selector: "ga-radio-button", inputs: ["value", "id", "name", "checked", "disabled", "aria-label", "aria-labelledby", "aria-describedby", "aria-invalid", "aria-errormessage"], outputs: ["change"] }] });
2408
2412
  }
2409
2413
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImport: i0, type: GaOptionComponent, decorators: [{
2410
2414
  type: Component,
@@ -2423,6 +2427,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.4", ngImpor
2423
2427
  '[class.ga-dropdown__item--disabled]': 'cdkOption.disabled',
2424
2428
  '[class.ga-dropdown__item--active]': 'active() && !cdkOption.disabled',
2425
2429
  '(click)': 'onClick()',
2430
+ '[attr.hidden]': `hidden() ? '' : null`,
2426
2431
  }, template: "@if (withInput()) {\n @if (selectComponent.multiple()) {\n <ga-checkbox\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n } @else {\n <ga-radio-button\n [checked]=\"selected()\"\n [disabled]=\"disabled()\"\n aria-hidden=\"true\"\n style=\"pointer-events: none\"\n tabindex=\"-1\"\n />\n }\n}\n<div class=\"ga-dropdown__item-label\"><ng-content /></div>\n" }]
2427
2432
  }], ctorParameters: () => [] });
2428
2433
 
@@ -2498,6 +2503,7 @@ class GaSelectComponent {
2498
2503
  },
2499
2504
  ];
2500
2505
  injector = inject(Injector);
2506
+ elementRef = inject((ElementRef));
2501
2507
  overlayOrigin = inject(CdkOverlayOrigin);
2502
2508
  repositionScrollStrategy = createRepositionScrollStrategy(this.injector);
2503
2509
  implicitInvalid = signal(false);
@@ -2651,6 +2657,10 @@ class GaSelectComponent {
2651
2657
  }
2652
2658
  if (activeOption) {
2653
2659
  const { cdkOption } = activeOption;
2660
+ if (!this.multiple() && cdkOption.isSelected()) {
2661
+ // if single select and the active option is already selected, do nothing
2662
+ return;
2663
+ }
2654
2664
  this.cdkListbox().toggle(cdkOption);
2655
2665
  this.syncValue();
2656
2666
  }
@@ -2694,6 +2704,9 @@ class GaSelectComponent {
2694
2704
  if (this.inputSearch()?.nativeElement !== this.focusedTriggerElement) {
2695
2705
  this.focusedTriggerElement?.focus();
2696
2706
  }
2707
+ else if (this.searchable()) {
2708
+ this.elementRef.nativeElement.focus();
2709
+ }
2697
2710
  this.textValue.set('');
2698
2711
  this._onTouched?.();
2699
2712
  this.closed.emit();