@vsn-ux/ngx-gaia 0.11.3 → 0.11.4

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/DOCS.md CHANGED
@@ -422,6 +422,10 @@ Data select component that automatically generates options from an items array.
422
422
  - `closed()` - Emitted when dropdown closes
423
423
  - `optionsEndReached()` - Emitted when user scrolls to bottom of options
424
424
 
425
+ #### Methods:
426
+
427
+ - `focus(): void` - Focus the select trigger
428
+
425
429
  ### `IGaSelectOption<T>`
426
430
 
427
431
  Type for option items with special properties:
@@ -1211,6 +1215,10 @@ Select component.
1211
1215
  - `multiple: boolean` - Multiple selection
1212
1216
  - `clearable: boolean` - Show clear button
1213
1217
 
1218
+ #### Methods:
1219
+
1220
+ - `focus(): void` - Focus the select trigger
1221
+
1214
1222
  ### `<ga-select-dropdown>`
1215
1223
 
1216
1224
  Dropdown container component.
@@ -1325,9 +1333,9 @@ Switch component for boolean toggle controls.
1325
1333
 
1326
1334
  #### Inputs:
1327
1335
 
1328
- - `label: string` - Switch label (default: '')
1329
1336
  - `checked: boolean` - Checked state (default: false)
1330
1337
  - `disabled: boolean` - Disabled state (default: false)
1338
+ - `label: string` - **@deprecated** Use content projection instead (default: '')
1331
1339
 
1332
1340
  #### Outputs:
1333
1341
 
@@ -1335,11 +1343,11 @@ Switch component for boolean toggle controls.
1335
1343
 
1336
1344
  ### Examples:
1337
1345
 
1338
- Switch with label
1346
+ Switch with visible label
1339
1347
 
1340
1348
  ```html
1341
- <ga-switch label="Enable notifications" [(checked)]="enabled" />
1342
- <ga-switch [(ngModel)]="value" label="Dark mode" />
1349
+ <ga-switch [(checked)]="enabled">Enable notifications</ga-switch>
1350
+ <ga-switch [(ngModel)]="value">Dark mode</ga-switch>
1343
1351
  ```
1344
1352
 
1345
1353
  ## Tabs
@@ -1278,13 +1278,14 @@ class GaInputDirective {
1278
1278
  this.elementRef.nativeElement.focus();
1279
1279
  }
1280
1280
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaInputDirective, deps: [{ token: 'placeholder', attribute: true }], target: i0.ɵɵFactoryTarget.Component });
1281
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.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 });
1281
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.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" } }, exportAs: ["gaInput"], ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1282
1282
  }
1283
1283
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaInputDirective, decorators: [{
1284
1284
  type: Component,
1285
1285
  args: [{
1286
1286
  // eslint-disable-next-line @angular-eslint/component-selector
1287
1287
  selector: '[gaInput]',
1288
+ exportAs: 'gaInput',
1288
1289
  template: '',
1289
1290
  changeDetection: ChangeDetectionStrategy.OnPush,
1290
1291
  host: {
@@ -4078,6 +4079,9 @@ class GaSelectComponent {
4078
4079
  focusListbox() {
4079
4080
  this.cdkListbox().focus();
4080
4081
  }
4082
+ focus() {
4083
+ this.elementRef.nativeElement.focus();
4084
+ }
4081
4085
  setPreviousItemActive() {
4082
4086
  this.setItemActive(-1);
4083
4087
  }
@@ -5062,6 +5066,9 @@ class GaDataSelectComponent {
5062
5066
  focusListbox() {
5063
5067
  this.cdkListbox().focus();
5064
5068
  }
5069
+ focus() {
5070
+ this.elementRef.nativeElement.focus();
5071
+ }
5065
5072
  setActiveItemAsSelected() {
5066
5073
  const options = this.gaOptions();
5067
5074
  let activeOption = options.find((option) => option.cdkOption.isActive());
@@ -5326,6 +5333,12 @@ const SWITCH_CONTROL_VALUE_ACCESSOR = {
5326
5333
  let nextUniqueId$2 = 0;
5327
5334
  class GaSwitchComponent {
5328
5335
  icons = { Check };
5336
+ /** Reference to the label element for content projection detection */
5337
+ labelElement = viewChild('labelElement', ...(ngDevMode ? [{ debugName: "labelElement" }] : []));
5338
+ /** Signal to track if content is projected */
5339
+ hasProjectedContent = signal(false, ...(ngDevMode ? [{ debugName: "hasProjectedContent" }] : []));
5340
+ /** @ignore */
5341
+ destroyRef = inject(DestroyRef);
5329
5342
  /** @ignore */
5330
5343
  formFieldConnector = inject(GaFormFieldConnector, {
5331
5344
  optional: true,
@@ -5343,6 +5356,9 @@ class GaSwitchComponent {
5343
5356
  checked = input(false, { ...(ngDevMode ? { debugName: "checked" } : {}), transform: booleanAttribute });
5344
5357
  disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
5345
5358
  ariaInvalid = input(null, { ...(ngDevMode ? { debugName: "ariaInvalid" } : {}), alias: 'aria-invalid' });
5359
+ /**
5360
+ * @deprecated Use content projection instead: `<ga-switch>Label text</ga-switch>`
5361
+ */
5346
5362
  label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
5347
5363
  ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : {}), alias: 'aria-label' });
5348
5364
  ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : {}), alias: 'aria-labelledby' });
@@ -5371,6 +5387,22 @@ class GaSwitchComponent {
5371
5387
  effect(() => formFieldConnector.controlDisabled.set(this.disabledModel()));
5372
5388
  effect(() => formFieldConnector.controlId.set(this.inputId()));
5373
5389
  }
5390
+ afterNextRender(() => {
5391
+ const el = this.labelElement()?.nativeElement;
5392
+ if (!el)
5393
+ return;
5394
+ this.updateHasProjectedContent(el);
5395
+ const observer = new MutationObserver(() => this.updateHasProjectedContent(el));
5396
+ observer.observe(el, {
5397
+ childList: true,
5398
+ characterData: true,
5399
+ subtree: true,
5400
+ });
5401
+ this.destroyRef.onDestroy(() => observer.disconnect());
5402
+ });
5403
+ }
5404
+ updateHasProjectedContent(el) {
5405
+ this.hasProjectedContent.set((el.textContent?.trim().length ?? 0) > 0);
5374
5406
  }
5375
5407
  /** @ignore */
5376
5408
  onInputChange(event) {
@@ -5399,7 +5431,7 @@ class GaSwitchComponent {
5399
5431
  this.disabledModel.set(disabled);
5400
5432
  }
5401
5433
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
5402
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", type: GaSwitchComponent, isStandalone: true, selector: "ga-switch", inputs: { tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaErrormessage: { classPropertyName: "ariaErrormessage", publicName: "aria-errormessage", isSignal: true, isRequired: false, transformFunction: null }, nameInput: { classPropertyName: "nameInput", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class.ga-switch--checked": "checkedModel()", "class.ga-switch--disabled": "disabledModel()", "class.ga-switch--invalid": "invalidComputed()", "attr.id": "null", "attr.tabindex": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null", "attr.aria-errormessage": "null", "attr.aria-invalid": "null" }, classAttribute: "ga-switch" }, providers: [SWITCH_CONTROL_VALUE_ACCESSOR], ngImport: i0, template: "<input\n #input\n type=\"checkbox\"\n class=\"ga-switch__input\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [disabled]=\"disabledModel()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n [attr.aria-invalid]=\"invalidComputed() ? 'true' : null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-switch__marker\">\n <ga-icon\n [icon]=\"icons.Check\"\n class=\"ga-switch__check-icon\"\n [size]=\"16\"\n aria-hidden=\"true\"\n />\n <span class=\"ga-switch__slider\"></span>\n</div>\n@if (label()) {\n <label [attr.for]=\"inputId()\" class=\"ga-switch__label\">{{ label() }}</label>\n}\n", dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5434
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.0.4", type: GaSwitchComponent, isStandalone: true, selector: "ga-switch", inputs: { tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, ariaInvalid: { classPropertyName: "ariaInvalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaErrormessage: { classPropertyName: "ariaErrormessage", publicName: "aria-errormessage", isSignal: true, isRequired: false, transformFunction: null }, nameInput: { classPropertyName: "nameInput", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checkedChange: "checkedChange" }, host: { properties: { "class.ga-switch--checked": "checkedModel()", "class.ga-switch--disabled": "disabledModel()", "class.ga-switch--invalid": "invalidComputed()", "attr.id": "null", "attr.tabindex": "null", "attr.aria-label": "null", "attr.aria-labelledby": "null", "attr.aria-describedby": "null", "attr.aria-errormessage": "null", "attr.aria-invalid": "null" }, classAttribute: "ga-switch" }, providers: [SWITCH_CONTROL_VALUE_ACCESSOR], viewQueries: [{ propertyName: "labelElement", first: true, predicate: ["labelElement"], descendants: true, isSignal: true }], ngImport: i0, template: "<input\n #input\n type=\"checkbox\"\n class=\"ga-switch__input\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [disabled]=\"disabledModel()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n [attr.aria-invalid]=\"invalidComputed() ? 'true' : null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-switch__marker\">\n <ga-icon\n [icon]=\"icons.Check\"\n class=\"ga-switch__check-icon\"\n [size]=\"16\"\n aria-hidden=\"true\"\n />\n <span class=\"ga-switch__slider\"></span>\n</div>\n@if (label()) {\n <label [attr.for]=\"inputId()\" class=\"ga-switch__label\">{{ label() }}</label>\n} @else {\n <label\n #labelElement\n [attr.for]=\"hasProjectedContent() ? inputId() : null\"\n [class.ga-switch__label]=\"hasProjectedContent()\"\n [hidden]=\"!hasProjectedContent()\"\n >\n <ng-content></ng-content>\n </label>\n}\n", dependencies: [{ kind: "ngmodule", type: GaIconModule }, { kind: "component", type: GaIconComponent, selector: "ga-icon", inputs: ["icon", "size", "color", "strokeWidth"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
5403
5435
  }
5404
5436
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaSwitchComponent, decorators: [{
5405
5437
  type: Component,
@@ -5415,8 +5447,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.4", ngImpor
5415
5447
  '[attr.aria-describedby]': 'null',
5416
5448
  '[attr.aria-errormessage]': 'null',
5417
5449
  '[attr.aria-invalid]': 'null',
5418
- }, template: "<input\n #input\n type=\"checkbox\"\n class=\"ga-switch__input\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [disabled]=\"disabledModel()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n [attr.aria-invalid]=\"invalidComputed() ? 'true' : null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-switch__marker\">\n <ga-icon\n [icon]=\"icons.Check\"\n class=\"ga-switch__check-icon\"\n [size]=\"16\"\n aria-hidden=\"true\"\n />\n <span class=\"ga-switch__slider\"></span>\n</div>\n@if (label()) {\n <label [attr.for]=\"inputId()\" class=\"ga-switch__label\">{{ label() }}</label>\n}\n" }]
5419
- }], ctorParameters: () => [], propDecorators: { tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaErrormessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-errormessage", required: false }] }], nameInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
5450
+ }, template: "<input\n #input\n type=\"checkbox\"\n class=\"ga-switch__input\"\n [attr.id]=\"inputId()\"\n [name]=\"name()\"\n [checked]=\"checkedModel()\"\n [disabled]=\"disabledModel()\"\n [attr.tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [attr.aria-describedby]=\"ariaDescribedby()\"\n [attr.aria-errormessage]=\"ariaErrormessage()\"\n [attr.aria-invalid]=\"invalidComputed() ? 'true' : null\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onBlur()\"\n/>\n<div class=\"ga-switch__marker\">\n <ga-icon\n [icon]=\"icons.Check\"\n class=\"ga-switch__check-icon\"\n [size]=\"16\"\n aria-hidden=\"true\"\n />\n <span class=\"ga-switch__slider\"></span>\n</div>\n@if (label()) {\n <label [attr.for]=\"inputId()\" class=\"ga-switch__label\">{{ label() }}</label>\n} @else {\n <label\n #labelElement\n [attr.for]=\"hasProjectedContent() ? inputId() : null\"\n [class.ga-switch__label]=\"hasProjectedContent()\"\n [hidden]=\"!hasProjectedContent()\"\n >\n <ng-content></ng-content>\n </label>\n}\n" }]
5451
+ }], ctorParameters: () => [], propDecorators: { labelElement: [{ type: i0.ViewChild, args: ['labelElement', { isSignal: true }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], ariaInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaErrormessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-errormessage", required: false }] }], nameInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], checkedChange: [{ type: i0.Output, args: ["checkedChange"] }] } });
5420
5452
 
5421
5453
  class GaSwitchModule {
5422
5454
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.4", ngImport: i0, type: GaSwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });