@truenas/ui-components 0.8.17 → 0.8.19

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.
@@ -541,7 +541,7 @@ function createTnOptionsDataSource(config) {
541
541
  }
542
542
  };
543
543
  }
544
- let nextId$6 = 0;
544
+ let nextId$9 = 0;
545
545
  const TN_AUTOCOMPLETE_DEFAULT_LABELS = {
546
546
  placeholder: "Type to search...",
547
547
  loading: "Loading...",
@@ -555,7 +555,7 @@ var TnAutocompleteComponent = class TnAutocompleteComponent {
555
555
  elementRef = inject(ElementRef);
556
556
  overlay = inject(Overlay);
557
557
  viewContainerRef = inject(ViewContainerRef);
558
- uid = `tn-autocomplete-${nextId$6++}`;
558
+ uid = `tn-autocomplete-${nextId$9++}`;
559
559
  options = input([], ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
560
560
  compareWith = input(void 0, ...ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []);
561
561
  placeholder = input(void 0, ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
@@ -5151,7 +5151,7 @@ function tnIconMarker(iconName, library) {
5151
5151
  function libIconMarker(iconName) {
5152
5152
  return iconName;
5153
5153
  }
5154
- let nextId$5 = 0;
5154
+ let nextId$8 = 0;
5155
5155
  var TnInputComponent = class TnInputComponent {
5156
5156
  inputEl = viewChild.required("inputEl", ...ngDevMode ? [{ debugName: "inputEl" }] : /* istanbul ignore next */ []);
5157
5157
  inputType = input(InputType.PlainText, ...ngDevMode ? [{ debugName: "inputType" }] : /* istanbul ignore next */ []);
@@ -5206,7 +5206,7 @@ var TnInputComponent = class TnInputComponent {
5206
5206
  const base = this.testId();
5207
5207
  return ["toggle-password", ...Array.isArray(base) ? base : [base]];
5208
5208
  }, ...ngDevMode ? [{ debugName: "passwordToggleTestId" }] : /* istanbul ignore next */ []);
5209
- id = `tn-input-${nextId$5++}`;
5209
+ id = `tn-input-${nextId$8++}`;
5210
5210
  value = signal("", ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
5211
5211
  formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
5212
5212
  isDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
@@ -6544,11 +6544,11 @@ const TN_CHIP_INPUT_LABELS = new InjectionToken("TN_CHIP_INPUT_LABELS", {
6544
6544
  providedIn: "root",
6545
6545
  factory: () => TN_CHIP_INPUT_DEFAULT_LABELS
6546
6546
  });
6547
- let nextId$4 = 0;
6547
+ let nextId$7 = 0;
6548
6548
  var TnChipInputComponent = class TnChipInputComponent {
6549
6549
  overlay = inject(Overlay);
6550
6550
  viewContainerRef = inject(ViewContainerRef);
6551
- uid = `tn-chip-input-${nextId$4++}`;
6551
+ uid = `tn-chip-input-${nextId$7++}`;
6552
6552
  placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
6553
6553
  disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
6554
6554
  separatorKeys = input(["Enter", ","], ...ngDevMode ? [{ debugName: "separatorKeys" }] : /* istanbul ignore next */ []);
@@ -8352,6 +8352,7 @@ i0.ɵɵngDeclareClassMetadata({
8352
8352
  }]
8353
8353
  }
8354
8354
  });
8355
+ let nextId$6 = 0;
8355
8356
  var TnSlideToggleComponent = class TnSlideToggleComponent {
8356
8357
  toggleEl = viewChild.required("toggleEl", ...ngDevMode ? [{ debugName: "toggleEl" }] : /* istanbul ignore next */ []);
8357
8358
  labelPosition = input("after", ...ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []);
@@ -8367,7 +8368,7 @@ var TnSlideToggleComponent = class TnSlideToggleComponent {
8367
8368
  checked = input(false, ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
8368
8369
  change = output();
8369
8370
  toggleChange = output();
8370
- id = `tn-slide-toggle-${Math.random().toString(36).substr(2, 9)}`;
8371
+ id = `tn-slide-toggle-${nextId$6++}`;
8371
8372
  internalChecked = signal(false, ...ngDevMode ? [{ debugName: "internalChecked" }] : /* istanbul ignore next */ []);
8372
8373
  formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
8373
8374
  isDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
@@ -9645,6 +9646,7 @@ var TnExpansionPanelHarness = class TnExpansionPanelHarness extends ComponentHar
9645
9646
  if (await this.isExpanded()) await this.toggle();
9646
9647
  }
9647
9648
  };
9649
+ let nextId$5 = 0;
9648
9650
  var TnCheckboxLabelDirective = class TnCheckboxLabelDirective {
9649
9651
  static ɵfac = i0.ɵɵngDeclareFactory({
9650
9652
  minVersion: "12.0.0",
@@ -9690,7 +9692,7 @@ var TnCheckboxComponent = class TnCheckboxComponent {
9690
9692
  change = output();
9691
9693
  labelContent = contentChildren(TnCheckboxLabelDirective, ...ngDevMode ? [{ debugName: "labelContent" }] : /* istanbul ignore next */ []);
9692
9694
  hasProjectedLabel = computed(() => this.labelContent().length > 0, ...ngDevMode ? [{ debugName: "hasProjectedLabel" }] : /* istanbul ignore next */ []);
9693
- id = `tn-checkbox-${Math.random().toString(36).substr(2, 9)}`;
9695
+ id = `tn-checkbox-${nextId$5++}`;
9694
9696
  internalChecked = signal(false, ...ngDevMode ? [{ debugName: "internalChecked" }] : /* istanbul ignore next */ []);
9695
9697
  cvaControlled = signal(false, ...ngDevMode ? [{ debugName: "cvaControlled" }] : /* istanbul ignore next */ []);
9696
9698
  formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
@@ -10019,7 +10021,7 @@ var TnCheckboxHarness = class TnCheckboxHarness extends ComponentHarness {
10019
10021
  await (await this._label()).click();
10020
10022
  }
10021
10023
  };
10022
- let nextId$3 = 0;
10024
+ let nextId$4 = 0;
10023
10025
  var TnCheckboxGroupComponent = class TnCheckboxGroupComponent {
10024
10026
  options = input([], ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
10025
10027
  inline = input(false, ...ngDevMode ? [{ debugName: "inline" }] : /* istanbul ignore next */ []);
@@ -10035,7 +10037,7 @@ var TnCheckboxGroupComponent = class TnCheckboxGroupComponent {
10035
10037
  formDisabled = signal(false, ...ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []);
10036
10038
  isDisabled = computed(() => this.disabled() || this.formDisabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
10037
10039
  ariaRequired = computed(() => this.required() || this.fieldAria.required() === true, ...ngDevMode ? [{ debugName: "ariaRequired" }] : /* istanbul ignore next */ []);
10038
- requiredTextId = `tn-checkbox-group-required-${nextId$3++}`;
10040
+ requiredTextId = `tn-checkbox-group-required-${nextId$4++}`;
10039
10041
  resolvedAriaLabel = computed(() => {
10040
10042
  const label = this.ariaLabel();
10041
10043
  if (!label) return null;
@@ -10325,6 +10327,7 @@ var TnCheckboxGroupHarness = class TnCheckboxGroupHarness extends ComponentHarne
10325
10327
  }
10326
10328
  };
10327
10329
  const TN_RADIO_GROUP = new InjectionToken("TN_RADIO_GROUP");
10330
+ let nextId$3 = 0;
10328
10331
  var TnRadioComponent = class TnRadioComponent {
10329
10332
  radioEl = viewChild.required("radioEl", ...ngDevMode ? [{ debugName: "radioEl" }] : /* istanbul ignore next */ []);
10330
10333
  label = input("Radio", ...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
@@ -10336,7 +10339,7 @@ var TnRadioComponent = class TnRadioComponent {
10336
10339
  resolvedTestId = controlTestId(this.testId);
10337
10340
  error = input(null, ...ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []);
10338
10341
  change = output();
10339
- id = `tn-radio-${Math.random().toString(36).substr(2, 9)}`;
10342
+ id = `tn-radio-${nextId$3++}`;
10340
10343
  group = inject(TN_RADIO_GROUP, { optional: true });
10341
10344
  standaloneChecked = signal(false, ...ngDevMode ? [{ debugName: "standaloneChecked" }] : /* istanbul ignore next */ []);
10342
10345
  checked = computed(() => this.group ? this.group.isSelected(this.value()) : this.standaloneChecked(), ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
@@ -11017,6 +11020,7 @@ var TnTabComponent = class TnTabComponent {
11017
11020
  isActive = signal(false, ...ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []);
11018
11021
  tabsComponent;
11019
11022
  elementRef = inject(ElementRef);
11023
+ tabButton = viewChild.required("tabButton", ...ngDevMode ? [{ debugName: "tabButton" }] : /* istanbul ignore next */ []);
11020
11024
  hasIconContent = signal(false, ...ngDevMode ? [{ debugName: "hasIconContent" }] : /* istanbul ignore next */ []);
11021
11025
  ngAfterContentInit() {
11022
11026
  this.hasIconContent.set(!!this.iconContent());
@@ -11027,6 +11031,9 @@ var TnTabComponent = class TnTabComponent {
11027
11031
  onKeydown(event) {
11028
11032
  if (this.tabsComponent) this.tabsComponent.onKeydown(event, this.index());
11029
11033
  }
11034
+ focus() {
11035
+ this.tabButton().nativeElement.focus();
11036
+ }
11030
11037
  classes = computed(() => {
11031
11038
  const classes = ["tn-tab"];
11032
11039
  if (this.isActive()) classes.push("tn-tab--active");
@@ -11100,8 +11107,15 @@ var TnTabComponent = class TnTabComponent {
11100
11107
  descendants: true,
11101
11108
  isSignal: true
11102
11109
  }],
11110
+ viewQueries: [{
11111
+ propertyName: "tabButton",
11112
+ first: true,
11113
+ predicate: ["tabButton"],
11114
+ descendants: true,
11115
+ isSignal: true
11116
+ }],
11103
11117
  ngImport: i0,
11104
- template: "<button\n role=\"tab\"\n type=\"button\"\n tnTestIdType=\"tab\"\n [ngClass]=\"classes()\"\n [tnTestId]=\"testId()\"\n [attr.id]=\"tabId()\"\n [attr.aria-controls]=\"hasPanel() ? panelId() : null\"\n [attr.aria-selected]=\"isActive()\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onClick()\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (hasIcon()) {\n <span class=\"tn-tab__icon\">\n @if (iconContent()) {\n <ng-container *ngTemplateOutlet=\"iconContent()\" />\n } @else if (iconTemplate()) {\n <ng-container *ngTemplateOutlet=\"iconTemplate()\" />\n } @else {\n <span [innerHTML]=\"icon()\"></span>\n }\n </span>\n }\n <span class=\"tn-tab__label\">\n <span [innerHTML]=\"label() | tnLabelMarkup\"></span>\n <ng-content />\n </span>\n</button>",
11118
+ template: "<button\n #tabButton\n role=\"tab\"\n type=\"button\"\n tnTestIdType=\"tab\"\n [ngClass]=\"classes()\"\n [tnTestId]=\"testId()\"\n [attr.id]=\"tabId()\"\n [attr.aria-controls]=\"hasPanel() ? panelId() : null\"\n [attr.aria-selected]=\"isActive()\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onClick()\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (hasIcon()) {\n <span class=\"tn-tab__icon\">\n @if (iconContent()) {\n <ng-container *ngTemplateOutlet=\"iconContent()\" />\n } @else if (iconTemplate()) {\n <ng-container *ngTemplateOutlet=\"iconTemplate()\" />\n } @else {\n <span [innerHTML]=\"icon()\"></span>\n }\n </span>\n }\n <span class=\"tn-tab__label\">\n <span [innerHTML]=\"label() | tnLabelMarkup\"></span>\n <ng-content />\n </span>\n</button>",
11105
11119
  styles: [".tn-tab{--tn-error-text: var(--tn-error, var(--tn-red, #bd2626));--tn-primary-text: var(--tn-fg1, #222222);display:flex;align-items:center;justify-content:flex-start;gap:8px;padding:12px 16px;border:none;border-bottom:none;background:transparent;color:var(--tn-fg2, #666);font-family:var(--tn-font-family-body, \"Inter\", sans-serif);font-size:14px;font-weight:500;line-height:1.5;cursor:pointer;white-space:nowrap;min-width:0;flex-shrink:0}.tn-tab:hover:not(.tn-tab--disabled):not(.tn-tab--active){background-color:var(--tn-alt-bg1, #f5f5f5);color:var(--tn-fg1, #333)}.tn-tab:focus-visible{outline:2px solid var(--tn-primary, #0095d5);outline-offset:-2px;border-radius:4px}.tn-tab--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.tn-tab__icon{display:flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tn-tab__label ::ng-deep code{font-family:var(--tn-font-family-monospace, monospace);font-size:.875em;background:var(--tn-bg2, #f5f5f5);border:1px solid var(--tn-lines, #ccc);border-radius:4px;padding:.125em .45em}.tn-tab__label{display:flex;align-items:center;min-width:0;text-overflow:ellipsis;overflow:hidden}@media(prefers-contrast:high){.tn-tab{border-width:3px}.tn-tab:focus-visible{outline-width:3px}}:host-context(.tn-tabs--vertical){width:100%}:host-context(.tn-tabs--vertical) .tn-tab{width:100%}\n"],
11106
11120
  dependencies: [
11107
11121
  {
@@ -11160,7 +11174,7 @@ i0.ɵɵngDeclareClassMetadata({
11160
11174
  LabelMarkupPipe
11161
11175
  ],
11162
11176
  changeDetection: ChangeDetectionStrategy.Eager,
11163
- template: "<button\n role=\"tab\"\n type=\"button\"\n tnTestIdType=\"tab\"\n [ngClass]=\"classes()\"\n [tnTestId]=\"testId()\"\n [attr.id]=\"tabId()\"\n [attr.aria-controls]=\"hasPanel() ? panelId() : null\"\n [attr.aria-selected]=\"isActive()\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onClick()\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (hasIcon()) {\n <span class=\"tn-tab__icon\">\n @if (iconContent()) {\n <ng-container *ngTemplateOutlet=\"iconContent()\" />\n } @else if (iconTemplate()) {\n <ng-container *ngTemplateOutlet=\"iconTemplate()\" />\n } @else {\n <span [innerHTML]=\"icon()\"></span>\n }\n </span>\n }\n <span class=\"tn-tab__label\">\n <span [innerHTML]=\"label() | tnLabelMarkup\"></span>\n <ng-content />\n </span>\n</button>",
11177
+ template: "<button\n #tabButton\n role=\"tab\"\n type=\"button\"\n tnTestIdType=\"tab\"\n [ngClass]=\"classes()\"\n [tnTestId]=\"testId()\"\n [attr.id]=\"tabId()\"\n [attr.aria-controls]=\"hasPanel() ? panelId() : null\"\n [attr.aria-selected]=\"isActive()\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.tabindex]=\"tabIndex()\"\n [disabled]=\"disabled()\"\n (click)=\"onClick()\"\n (keydown)=\"onKeydown($event)\"\n>\n @if (hasIcon()) {\n <span class=\"tn-tab__icon\">\n @if (iconContent()) {\n <ng-container *ngTemplateOutlet=\"iconContent()\" />\n } @else if (iconTemplate()) {\n <ng-container *ngTemplateOutlet=\"iconTemplate()\" />\n } @else {\n <span [innerHTML]=\"icon()\"></span>\n }\n </span>\n }\n <span class=\"tn-tab__label\">\n <span [innerHTML]=\"label() | tnLabelMarkup\"></span>\n <ng-content />\n </span>\n</button>",
11164
11178
  styles: [".tn-tab{--tn-error-text: var(--tn-error, var(--tn-red, #bd2626));--tn-primary-text: var(--tn-fg1, #222222);display:flex;align-items:center;justify-content:flex-start;gap:8px;padding:12px 16px;border:none;border-bottom:none;background:transparent;color:var(--tn-fg2, #666);font-family:var(--tn-font-family-body, \"Inter\", sans-serif);font-size:14px;font-weight:500;line-height:1.5;cursor:pointer;white-space:nowrap;min-width:0;flex-shrink:0}.tn-tab:hover:not(.tn-tab--disabled):not(.tn-tab--active){background-color:var(--tn-alt-bg1, #f5f5f5);color:var(--tn-fg1, #333)}.tn-tab:focus-visible{outline:2px solid var(--tn-primary, #0095d5);outline-offset:-2px;border-radius:4px}.tn-tab--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.tn-tab__icon{display:flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tn-tab__label ::ng-deep code{font-family:var(--tn-font-family-monospace, monospace);font-size:.875em;background:var(--tn-bg2, #f5f5f5);border:1px solid var(--tn-lines, #ccc);border-radius:4px;padding:.125em .45em}.tn-tab__label{display:flex;align-items:center;min-width:0;text-overflow:ellipsis;overflow:hidden}@media(prefers-contrast:high){.tn-tab{border-width:3px}.tn-tab:focus-visible{outline-width:3px}}:host-context(.tn-tabs--vertical){width:100%}:host-context(.tn-tabs--vertical) .tn-tab{width:100%}\n"]
11165
11179
  }]
11166
11180
  }],
@@ -11212,6 +11226,10 @@ i0.ɵɵngDeclareClassMetadata({
11212
11226
  iconContent: [{
11213
11227
  type: i0.ContentChild,
11214
11228
  args: ["iconContent", { isSignal: true }]
11229
+ }],
11230
+ tabButton: [{
11231
+ type: i0.ViewChild,
11232
+ args: ["tabButton", { isSignal: true }]
11215
11233
  }]
11216
11234
  }
11217
11235
  });
@@ -11563,8 +11581,7 @@ var TnTabsComponent = class TnTabsComponent {
11563
11581
  return tabs.length - 1;
11564
11582
  }
11565
11583
  focusTab(index) {
11566
- const tab = this.tabs()[index];
11567
- if (tab && tab.elementRef) tab.elementRef.nativeElement.focus();
11584
+ this.tabs()[index]?.focus();
11568
11585
  }
11569
11586
  classes = computed(() => {
11570
11587
  const classes = ["tn-tabs"];