@truenas/ui-components 0.3.0 → 0.3.2
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.
|
@@ -4207,6 +4207,164 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
4207
4207
|
args: [{ selector: 'tn-chip', standalone: true, imports: [CommonModule, A11yModule, TnIconComponent, TnTestIdDirective, LabelMarkupPipe, LabelTextPipe], template: "<div\n #chipEl\n role=\"button\"\n tnTestIdType=\"chip\"\n [ngClass]=\"classes()\"\n [tnTestId]=\"testId()\"\n [attr.aria-label]=\"label() | tnLabelText\"\n [attr.aria-disabled]=\"disabled()\"\n [attr.tabindex]=\"disabled() ? -1 : 0\"\n (click)=\"handleClick($event)\"\n (keydown)=\"handleKeyDown($event)\"\n>\n @if (icon()) {\n <tn-icon class=\"tn-chip__icon\" size=\"sm\" [name]=\"icon()!\" />\n }\n <span class=\"tn-chip__label\" [innerHTML]=\"label() | tnLabelMarkup\"></span>\n @if (closable()) {\n <button\n type=\"button\"\n class=\"tn-chip__close\"\n [attr.aria-label]=\"'Remove ' + (label() | tnLabelText)\"\n [disabled]=\"disabled()\"\n (click)=\"handleClose($event)\"\n >\n <span class=\"tn-chip__close-icon\">\u00D7</span>\n </button>\n }\n</div>", styles: [".tn-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:16px;font-family:var(--tn-font-family-body);font-size:14px;font-weight:500;line-height:1.2;cursor:pointer;transition:all .2s ease-in-out;border:1px solid transparent;outline:none;-webkit-user-select:none;user-select:none}.tn-chip:focus-visible{outline:2px solid var(--tn-primary);outline-offset:2px}.tn-chip:hover:not(.tn-chip--disabled){transform:translateY(-1px);box-shadow:0 2px 4px #0000001a}.tn-chip--primary{background-color:var(--tn-primary);color:var(--tn-primary-txt);border-color:var(--tn-primary)}.tn-chip--primary:hover:not(.tn-chip--disabled){background-color:var(--tn-blue);border-color:var(--tn-blue)}.tn-chip--secondary{background-color:var(--tn-alt-bg1);color:var(--tn-alt-fg2);border-color:var(--tn-alt-bg2)}.tn-chip--secondary:hover:not(.tn-chip--disabled){background-color:var(--tn-alt-bg2);border-color:var(--tn-accent)}.tn-chip--accent{background-color:var(--tn-accent);color:var(--tn-fg1);border-color:var(--tn-accent)}.tn-chip--accent:hover:not(.tn-chip--disabled){background-color:var(--tn-alt-bg2);border-color:var(--tn-alt-bg2)}.tn-chip--disabled{opacity:.5;cursor:not-allowed;pointer-events:none}.tn-chip--closable{padding-right:8px}.tn-chip__icon{display:flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:12px}.tn-chip__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-chip__label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px}.tn-chip__close{display:flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;margin:0;border:none;border-radius:50%;background-color:#fff3;color:inherit;cursor:pointer;transition:background-color .2s ease-in-out;outline:none}.tn-chip__close:hover:not(:disabled){background-color:#ffffff4d}.tn-chip__close:focus-visible{outline:1px solid currentColor;outline-offset:1px}.tn-chip__close:disabled{cursor:not-allowed;opacity:.5}.tn-chip__close-icon{font-size:14px;font-weight:700;line-height:1}.tn-dark .tn-chip--secondary .tn-chip__close{background-color:#0003}.tn-dark .tn-chip--secondary .tn-chip__close:hover:not(:disabled){background-color:#0000004d}.high-contrast .tn-chip{border-width:2px}.high-contrast .tn-chip:focus-visible{outline-width:3px}\n"] }]
|
|
4208
4208
|
}], propDecorators: { chipEl: [{ type: i0.ViewChild, args: ['chipEl', { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], closable: [{ type: i0.Input, args: [{ isSignal: true, alias: "closable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], testId: [{ type: i0.Input, args: [{ isSignal: true, alias: "testId", required: false }] }], onClose: [{ type: i0.Output, args: ["onClose"] }], onClick: [{ type: i0.Output, args: ["onClick"] }] } });
|
|
4209
4209
|
|
|
4210
|
+
/**
|
|
4211
|
+
* Harness for interacting with tn-chip in tests.
|
|
4212
|
+
* Provides methods for reading chip state and simulating user interactions
|
|
4213
|
+
* (selecting the chip and dismissing a closable chip).
|
|
4214
|
+
*
|
|
4215
|
+
* @example
|
|
4216
|
+
* ```typescript
|
|
4217
|
+
* // Find a chip by label and click it
|
|
4218
|
+
* const chip = await loader.getHarness(TnChipHarness.with({ label: 'Active' }));
|
|
4219
|
+
* await chip.click();
|
|
4220
|
+
*
|
|
4221
|
+
* // Dismiss a closable chip
|
|
4222
|
+
* const filter = await loader.getHarness(TnChipHarness.with({ label: 'Has SSH Access' }));
|
|
4223
|
+
* if (await filter.isClosable()) {
|
|
4224
|
+
* await filter.close();
|
|
4225
|
+
* }
|
|
4226
|
+
* ```
|
|
4227
|
+
*/
|
|
4228
|
+
class TnChipHarness extends ComponentHarness {
|
|
4229
|
+
/**
|
|
4230
|
+
* The selector for the host element of a `TnChipComponent` instance.
|
|
4231
|
+
*/
|
|
4232
|
+
static hostSelector = 'tn-chip';
|
|
4233
|
+
_chip = this.locatorFor('.tn-chip');
|
|
4234
|
+
_label = this.locatorFor('.tn-chip__label');
|
|
4235
|
+
_icon = this.locatorForOptional('.tn-chip__icon');
|
|
4236
|
+
_closeButton = this.locatorForOptional('.tn-chip__close');
|
|
4237
|
+
/**
|
|
4238
|
+
* Gets a `HarnessPredicate` that can be used to search for a chip
|
|
4239
|
+
* with specific attributes.
|
|
4240
|
+
*
|
|
4241
|
+
* @param options Options for filtering which chip instances are considered a match.
|
|
4242
|
+
* @returns A `HarnessPredicate` configured with the given options.
|
|
4243
|
+
*
|
|
4244
|
+
* @example
|
|
4245
|
+
* ```typescript
|
|
4246
|
+
* // Find chip by exact label
|
|
4247
|
+
* const chip = await loader.getHarness(TnChipHarness.with({ label: 'Production' }));
|
|
4248
|
+
*
|
|
4249
|
+
* // Find chip with regex pattern
|
|
4250
|
+
* const chip = await loader.getHarness(TnChipHarness.with({ label: /access/i }));
|
|
4251
|
+
* ```
|
|
4252
|
+
*/
|
|
4253
|
+
static with(options = {}) {
|
|
4254
|
+
return new HarnessPredicate(TnChipHarness, options)
|
|
4255
|
+
.addOption('label', options.label, (harness, label) => HarnessPredicate.stringMatches(harness.getLabel(), label));
|
|
4256
|
+
}
|
|
4257
|
+
/**
|
|
4258
|
+
* Gets the chip's label text.
|
|
4259
|
+
*
|
|
4260
|
+
* @returns Promise resolving to the chip's text content.
|
|
4261
|
+
*
|
|
4262
|
+
* @example
|
|
4263
|
+
* ```typescript
|
|
4264
|
+
* const chip = await loader.getHarness(TnChipHarness);
|
|
4265
|
+
* expect(await chip.getLabel()).toBe('Active');
|
|
4266
|
+
* ```
|
|
4267
|
+
*/
|
|
4268
|
+
async getLabel() {
|
|
4269
|
+
const label = await this._label();
|
|
4270
|
+
return (await label.text()).trim();
|
|
4271
|
+
}
|
|
4272
|
+
/**
|
|
4273
|
+
* Gets the chip's color variant (`primary`, `secondary`, or `accent`).
|
|
4274
|
+
*
|
|
4275
|
+
* @returns Promise resolving to the chip's color.
|
|
4276
|
+
*
|
|
4277
|
+
* @example
|
|
4278
|
+
* ```typescript
|
|
4279
|
+
* const chip = await loader.getHarness(TnChipHarness);
|
|
4280
|
+
* expect(await chip.getColor()).toBe('primary');
|
|
4281
|
+
* ```
|
|
4282
|
+
*/
|
|
4283
|
+
async getColor() {
|
|
4284
|
+
const chip = await this._chip();
|
|
4285
|
+
const classAttr = (await chip.getAttribute('class')) ?? '';
|
|
4286
|
+
const match = classAttr.match(/tn-chip--(primary|secondary|accent)/);
|
|
4287
|
+
return match?.[1] ?? 'primary';
|
|
4288
|
+
}
|
|
4289
|
+
/**
|
|
4290
|
+
* Checks whether the chip is disabled.
|
|
4291
|
+
*
|
|
4292
|
+
* @returns Promise resolving to true if the chip is disabled.
|
|
4293
|
+
*
|
|
4294
|
+
* @example
|
|
4295
|
+
* ```typescript
|
|
4296
|
+
* const chip = await loader.getHarness(TnChipHarness);
|
|
4297
|
+
* expect(await chip.isDisabled()).toBe(false);
|
|
4298
|
+
* ```
|
|
4299
|
+
*/
|
|
4300
|
+
async isDisabled() {
|
|
4301
|
+
const chip = await this._chip();
|
|
4302
|
+
return (await chip.getAttribute('aria-disabled')) === 'true';
|
|
4303
|
+
}
|
|
4304
|
+
/**
|
|
4305
|
+
* Checks whether the chip renders a close (dismiss) button.
|
|
4306
|
+
*
|
|
4307
|
+
* @returns Promise resolving to true if the chip is closable.
|
|
4308
|
+
*
|
|
4309
|
+
* @example
|
|
4310
|
+
* ```typescript
|
|
4311
|
+
* const chip = await loader.getHarness(TnChipHarness);
|
|
4312
|
+
* expect(await chip.isClosable()).toBe(true);
|
|
4313
|
+
* ```
|
|
4314
|
+
*/
|
|
4315
|
+
async isClosable() {
|
|
4316
|
+
return (await this._closeButton()) !== null;
|
|
4317
|
+
}
|
|
4318
|
+
/**
|
|
4319
|
+
* Checks whether the chip renders a leading icon.
|
|
4320
|
+
*
|
|
4321
|
+
* @returns Promise resolving to true if the chip has an icon.
|
|
4322
|
+
*
|
|
4323
|
+
* @example
|
|
4324
|
+
* ```typescript
|
|
4325
|
+
* const chip = await loader.getHarness(TnChipHarness);
|
|
4326
|
+
* expect(await chip.hasIcon()).toBe(true);
|
|
4327
|
+
* ```
|
|
4328
|
+
*/
|
|
4329
|
+
async hasIcon() {
|
|
4330
|
+
return (await this._icon()) !== null;
|
|
4331
|
+
}
|
|
4332
|
+
/**
|
|
4333
|
+
* Clicks the chip body, triggering its `onClick` output.
|
|
4334
|
+
*
|
|
4335
|
+
* @returns Promise that resolves when the click action is complete.
|
|
4336
|
+
*
|
|
4337
|
+
* @example
|
|
4338
|
+
* ```typescript
|
|
4339
|
+
* const chip = await loader.getHarness(TnChipHarness.with({ label: 'Active' }));
|
|
4340
|
+
* await chip.click();
|
|
4341
|
+
* ```
|
|
4342
|
+
*/
|
|
4343
|
+
async click() {
|
|
4344
|
+
const chip = await this._chip();
|
|
4345
|
+
return chip.click();
|
|
4346
|
+
}
|
|
4347
|
+
/**
|
|
4348
|
+
* Clicks the chip's close button, triggering its `onClose` output.
|
|
4349
|
+
* Throws if the chip is not closable.
|
|
4350
|
+
*
|
|
4351
|
+
* @returns Promise that resolves when the close action is complete.
|
|
4352
|
+
*
|
|
4353
|
+
* @example
|
|
4354
|
+
* ```typescript
|
|
4355
|
+
* const chip = await loader.getHarness(TnChipHarness.with({ label: 'Has SSH Access' }));
|
|
4356
|
+
* await chip.close();
|
|
4357
|
+
* ```
|
|
4358
|
+
*/
|
|
4359
|
+
async close() {
|
|
4360
|
+
const closeButton = await this._closeButton();
|
|
4361
|
+
if (!closeButton) {
|
|
4362
|
+
throw new Error('Cannot close a chip that is not closable (no close button rendered).');
|
|
4363
|
+
}
|
|
4364
|
+
return closeButton.click();
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
|
|
4210
4368
|
class TnCardHeaderDirective {
|
|
4211
4369
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TnCardHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4212
4370
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: TnCardHeaderDirective, isStandalone: true, selector: "[tnCardHeader]", ngImport: i0 });
|
|
@@ -7407,6 +7565,90 @@ class TnFormFieldHarness extends ComponentHarness {
|
|
|
7407
7565
|
}
|
|
7408
7566
|
}
|
|
7409
7567
|
|
|
7568
|
+
/** Per-instance counter for generating unique heading ids. */
|
|
7569
|
+
let nextUniqueId$1 = 0;
|
|
7570
|
+
/**
|
|
7571
|
+
* Semantic grouping for a related set of form fields. Renders a native
|
|
7572
|
+
* `<fieldset>` with an optional `<legend>` heading and help tooltip, and
|
|
7573
|
+
* projects its content unchanged — it adds structure and a11y semantics, not
|
|
7574
|
+
* layout for the fields themselves (compose `tn-form-field` inside it for that).
|
|
7575
|
+
*/
|
|
7576
|
+
class TnFormSectionComponent {
|
|
7577
|
+
/**
|
|
7578
|
+
* Heading rendered in the `<legend>`. Supports lightweight label markup
|
|
7579
|
+
* (**bold**, *italic*, `code`); leave empty to omit the legend entirely.
|
|
7580
|
+
*/
|
|
7581
|
+
heading = input('', ...(ngDevMode ? [{ debugName: "heading" }] : []));
|
|
7582
|
+
/** Optional help tooltip shown via an icon next to the heading. */
|
|
7583
|
+
tooltip = input('', ...(ngDevMode ? [{ debugName: "tooltip" }] : []));
|
|
7584
|
+
/** Placement of the tooltip relative to its help icon. */
|
|
7585
|
+
tooltipPosition = input('above', ...(ngDevMode ? [{ debugName: "tooltipPosition" }] : []));
|
|
7586
|
+
/** Test id applied to the host for harness/e2e selection. */
|
|
7587
|
+
testId = input(undefined, ...(ngDevMode ? [{ debugName: "testId" }] : []));
|
|
7588
|
+
/**
|
|
7589
|
+
* Stable id linking the fieldset to its heading via `aria-labelledby`. This
|
|
7590
|
+
* names the group from the heading text alone — without it the legend's
|
|
7591
|
+
* accessible name would also absorb the tooltip button's `aria-label`,
|
|
7592
|
+
* announcing the whole tooltip sentence on every control in the group.
|
|
7593
|
+
*/
|
|
7594
|
+
headingId = `tn-form-section-${nextUniqueId$1++}`;
|
|
7595
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TnFormSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
7596
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.0", type: TnFormSectionComponent, isStandalone: true, selector: "tn-form-section", inputs: { heading: { classPropertyName: "heading", publicName: "heading", isSignal: true, isRequired: false, transformFunction: null }, tooltip: { classPropertyName: "tooltip", publicName: "tooltip", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, testId: { classPropertyName: "testId", publicName: "testId", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<fieldset\n class=\"tn-form-section\"\n tnTestIdType=\"form-section\"\n [tnTestId]=\"testId()\"\n [attr.aria-labelledby]=\"heading() ? headingId : null\">\n @if (heading()) {\n <!--\n The <legend> must be a *direct* child of the <fieldset> to act as the\n group's caption, so the heading text and tooltip live inside it (laid out\n as a flex row) rather than in a wrapper div. The fieldset's accessible\n name is pinned to the heading span via aria-labelledby so the tooltip\n button's aria-label does not leak into the group name.\n -->\n <legend class=\"tn-form-section__header\">\n <span\n class=\"tn-form-section__legend\"\n [id]=\"headingId\"\n [innerHTML]=\"heading() | tnLabelMarkup\"\n ></span>\n\n @if (tooltip()) {\n <button\n type=\"button\"\n class=\"tn-form-section__tooltip\"\n [attr.aria-label]=\"tooltip()\"\n [tnTooltip]=\"tooltip()\"\n [tnTooltipPosition]=\"tooltipPosition()\">\n <tn-icon name=\"help-circle\" library=\"mdi\" size=\"sm\" />\n </button>\n }\n </legend>\n }\n\n <div class=\"tn-form-section__body\">\n <ng-content />\n </div>\n</fieldset>\n", styles: [".tn-form-section{border:none;margin:0;padding:0;min-width:0}.tn-form-section__header{display:flex;align-items:center;gap:.5rem;width:100%;padding:0;margin:0 0 1.25rem}.tn-form-section__body{display:flex;flex-direction:column;gap:1.25rem;min-width:0}.tn-form-section__legend{color:var(--tn-fg1, #333);font-family:var(--tn-font-family-body, \"Inter\"),sans-serif;font-size:.9375rem;font-weight:600;line-height:1.4}.tn-form-section__legend ::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-form-section__tooltip{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var(--tn-fg2, #6c757d);cursor:help;line-height:0}.tn-form-section__tooltip:hover,.tn-form-section__tooltip:focus-visible{color:var(--tn-primary, #007bff)}.tn-form-section__tooltip:focus-visible{outline:2px solid var(--tn-primary, #007bff);outline-offset:2px;border-radius:50%}\n"], dependencies: [{ kind: "component", type: TnIconComponent, selector: "tn-icon", inputs: ["name", "size", "color", "tooltip", "ariaLabel", "library", "testId", "fullSize", "customSize"] }, { kind: "directive", type: TnTooltipDirective, selector: "[tnTooltip]", inputs: ["tnTooltip", "tnTooltipPosition", "tnTooltipDisabled", "tnTooltipShowDelay", "tnTooltipHideDelay", "tnTooltipClass"] }, { kind: "directive", type: TnTestIdDirective, selector: "[tnTestId]", inputs: ["tnTestId", "tnTestIdType"] }, { kind: "pipe", type: LabelMarkupPipe, name: "tnLabelMarkup" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7597
|
+
}
|
|
7598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: TnFormSectionComponent, decorators: [{
|
|
7599
|
+
type: Component,
|
|
7600
|
+
args: [{ selector: 'tn-form-section', standalone: true, imports: [TnIconComponent, TnTooltipDirective, TnTestIdDirective, LabelMarkupPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset\n class=\"tn-form-section\"\n tnTestIdType=\"form-section\"\n [tnTestId]=\"testId()\"\n [attr.aria-labelledby]=\"heading() ? headingId : null\">\n @if (heading()) {\n <!--\n The <legend> must be a *direct* child of the <fieldset> to act as the\n group's caption, so the heading text and tooltip live inside it (laid out\n as a flex row) rather than in a wrapper div. The fieldset's accessible\n name is pinned to the heading span via aria-labelledby so the tooltip\n button's aria-label does not leak into the group name.\n -->\n <legend class=\"tn-form-section__header\">\n <span\n class=\"tn-form-section__legend\"\n [id]=\"headingId\"\n [innerHTML]=\"heading() | tnLabelMarkup\"\n ></span>\n\n @if (tooltip()) {\n <button\n type=\"button\"\n class=\"tn-form-section__tooltip\"\n [attr.aria-label]=\"tooltip()\"\n [tnTooltip]=\"tooltip()\"\n [tnTooltipPosition]=\"tooltipPosition()\">\n <tn-icon name=\"help-circle\" library=\"mdi\" size=\"sm\" />\n </button>\n }\n </legend>\n }\n\n <div class=\"tn-form-section__body\">\n <ng-content />\n </div>\n</fieldset>\n", styles: [".tn-form-section{border:none;margin:0;padding:0;min-width:0}.tn-form-section__header{display:flex;align-items:center;gap:.5rem;width:100%;padding:0;margin:0 0 1.25rem}.tn-form-section__body{display:flex;flex-direction:column;gap:1.25rem;min-width:0}.tn-form-section__legend{color:var(--tn-fg1, #333);font-family:var(--tn-font-family-body, \"Inter\"),sans-serif;font-size:.9375rem;font-weight:600;line-height:1.4}.tn-form-section__legend ::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-form-section__tooltip{display:inline-flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;color:var(--tn-fg2, #6c757d);cursor:help;line-height:0}.tn-form-section__tooltip:hover,.tn-form-section__tooltip:focus-visible{color:var(--tn-primary, #007bff)}.tn-form-section__tooltip:focus-visible{outline:2px solid var(--tn-primary, #007bff);outline-offset:2px;border-radius:50%}\n"] }]
|
|
7601
|
+
}], propDecorators: { heading: [{ type: i0.Input, args: [{ isSignal: true, alias: "heading", required: false }] }], tooltip: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltip", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], testId: [{ type: i0.Input, args: [{ isSignal: true, alias: "testId", required: false }] }] } });
|
|
7602
|
+
|
|
7603
|
+
/**
|
|
7604
|
+
* Harness for interacting with `tn-form-section` in tests.
|
|
7605
|
+
*
|
|
7606
|
+
* Scope note: this covers the section's own surface (heading text, tooltip
|
|
7607
|
+
* presence, projected text) only. Filling and reading the projected form
|
|
7608
|
+
* controls is the consuming app's concern — drive those through their own
|
|
7609
|
+
* control harnesses rather than this one.
|
|
7610
|
+
*
|
|
7611
|
+
* @example
|
|
7612
|
+
* ```typescript
|
|
7613
|
+
* const section = await loader.getHarness(
|
|
7614
|
+
* TnFormSectionHarness.with({ heading: 'Network Settings' })
|
|
7615
|
+
* );
|
|
7616
|
+
* expect(await section.hasTooltip()).toBe(true);
|
|
7617
|
+
* ```
|
|
7618
|
+
*/
|
|
7619
|
+
class TnFormSectionHarness extends ComponentHarness {
|
|
7620
|
+
/** The selector for the host element of a `TnFormSectionComponent` instance. */
|
|
7621
|
+
static hostSelector = 'tn-form-section';
|
|
7622
|
+
/**
|
|
7623
|
+
* Gets a `HarnessPredicate` to search for a form section by heading text.
|
|
7624
|
+
*
|
|
7625
|
+
* @param options Criteria for filtering which section instances match.
|
|
7626
|
+
* @returns A `HarnessPredicate` configured with the given options.
|
|
7627
|
+
*/
|
|
7628
|
+
static with(options = {}) {
|
|
7629
|
+
return new HarnessPredicate(TnFormSectionHarness, options)
|
|
7630
|
+
.addOption('heading', options.heading, (harness, heading) => HarnessPredicate.stringMatches(harness.getHeadingText(), heading));
|
|
7631
|
+
}
|
|
7632
|
+
legend = this.locatorForOptional('.tn-form-section__legend');
|
|
7633
|
+
tooltipButton = this.locatorForOptional('.tn-form-section__tooltip');
|
|
7634
|
+
/**
|
|
7635
|
+
* Heading text rendered in the legend (label markup rendered to plain text),
|
|
7636
|
+
* or '' when no heading is set.
|
|
7637
|
+
*/
|
|
7638
|
+
async getHeadingText() {
|
|
7639
|
+
const legend = await this.legend();
|
|
7640
|
+
return legend ? (await legend.text()).trim() : '';
|
|
7641
|
+
}
|
|
7642
|
+
/** Whether the help tooltip icon is rendered. */
|
|
7643
|
+
async hasTooltip() {
|
|
7644
|
+
return (await this.tooltipButton()) !== null;
|
|
7645
|
+
}
|
|
7646
|
+
/** Full text content of the section (heading + projected content), trimmed. */
|
|
7647
|
+
async getText() {
|
|
7648
|
+
return (await (await this.host()).text()).trim();
|
|
7649
|
+
}
|
|
7650
|
+
}
|
|
7651
|
+
|
|
7410
7652
|
class TnSelectComponent {
|
|
7411
7653
|
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
|
|
7412
7654
|
optionGroups = input([], ...(ngDevMode ? [{ debugName: "optionGroups" }] : []));
|
|
@@ -16197,5 +16439,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
16197
16439
|
* Generated bundle index. Do not edit.
|
|
16198
16440
|
*/
|
|
16199
16441
|
|
|
16200
|
-
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
|
|
16442
|
+
export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LIGHT_THEME, LabelMarkupPipe, LabelTextPipe, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_FORM_FIELD_ERRORS, TN_TABLE_PAGER_DEFAULT_LABELS, TN_TABLE_PAGER_LABELS, TN_TEST_ATTR, TN_THEME_DEFINITIONS, TnAutocompleteComponent, TnAutocompleteHarness, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnButtonToggleGroupHarness, TnButtonToggleHarness, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCardHeaderDirective, TnCellDefDirective, TnCheckboxComponent, TnCheckboxHarness, TnCheckboxLabelDirective, TnChipComponent, TnChipHarness, TnConfirmDialogComponent, TnDateInputComponent, TnDateInputHarness, TnDateRangeInputComponent, TnDateRangeInputHarness, TnDetailRowDefDirective, TnDialog, TnDialogHarness, TnDialogShellComponent, TnDialogTesting, TnDividerComponent, TnDividerDirective, TnDrawerComponent, TnDrawerContainerComponent, TnDrawerContainerHarness, TnDrawerContentComponent, TnDrawerHarness, TnEmptyComponent, TnEmptyHarness, TnExpansionPanelComponent, TnExpansionPanelHarness, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnFormFieldHarness, TnFormSectionComponent, TnFormSectionHarness, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconButtonHarness, TnIconComponent, TnIconHarness, TnIconRegistryService, TnIconTesting, TnInputComponent, TnInputDirective, TnInputHarness, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuActivateHoverDirective, TnMenuComponent, TnMenuHarness, TnMenuItemComponent, TnMenuTesting, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnRadioHarness, TnSelectComponent, TnSelectHarness, TnSelectionListComponent, TnSidePanelActionDirective, TnSidePanelComponent, TnSidePanelHarness, TnSidePanelHeaderActionDirective, TnSlideToggleComponent, TnSlideToggleHarness, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabHarness, TnTabPanelComponent, TnTabPanelHarness, TnTableColumnDirective, TnTableComponent, TnTableHarness, TnTablePagerComponent, TnTablePagerHarness, TnTabsComponent, TnTabsHarness, TnTestIdDirective, TnTheme, TnThemeService, TnTimeInputComponent, TnToastComponent, TnToastMock, TnToastPosition, TnToastRef, TnToastService, TnToastTesting, TnToastType, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, composeTestId, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, formatSize, kebabTestSegment, labelMarkupToHtml, labelMarkupToText, libIconMarker, parseLabelMarkup, parseSize, registerLucideIcons, scopeTestId, setupLucideIntegration, tnIconMarker, writeTestId };
|
|
16201
16443
|
//# sourceMappingURL=truenas-ui-components.mjs.map
|