@truenas/ui-components 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truenas/ui-components",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org",
6
6
  "access": "public"
@@ -437,79 +437,7 @@ textarea.tn-input-directive {
437
437
  }
438
438
 
439
439
  /* ================================
440
- Let's apply these variables to
441
- the preview and story book docs elements
442
- ================================ */
443
-
444
- html, body, #storybook-docs > .sbdocs-wrapper {
445
- font-family: var(--tn-font-family-body);
446
- color: var(--tn-fg2) !important;
447
- background-color: var(--tn-bg1) !important;
448
- }
449
-
450
- h1, h2, h3,h4,
451
- .sbdocs-title h1, .sbdocs-title h2, .sbdocs-title h3,.sbdocs-title h4 {
452
- font-family: var(--tn-font-family-header);
453
- color: var(--tn-fg1) !important;
454
- }
455
-
456
- p, li, td {
457
- color: var(--tn-fg2) !important;
458
- }
459
-
460
- .docs-story,
461
- .sb-bar,
462
- .sbdocs-wrapper td,
463
- .sbdocs-preview {
464
- background-color: var(--tn-bg2) !important;
465
- color: var(--tn-fg2) !important;
466
- }
467
-
468
- thead, th {
469
- background-color: var(--tn-topbar);
470
- color: var(--tn-topbar-txt) !important;
471
- }
472
-
473
- /* Form field styles */
474
- input:not([role="switch"]),
475
- .sbdocs-wrapper select,
476
- .sbdocs-wrapper textarea {
477
- background-color: var(--tn-bg1) !important;
478
- color: var(--tn-fg2) !important;
479
- }
480
-
481
- .docblock-code-toggle {
482
- background-color: var(--tn-btn-default-bg) !important;
483
- color: var(--tn-btn-default-txt) !important;
484
- }
485
-
486
- .docblock-argstable-body span {
487
- color: var(--tn-fg1);
488
- background-color: unset;
489
- border: unset;
490
- }
491
-
492
- .docs-story > div {
493
- background-color: unset;
494
- }
495
-
496
- .docblock-source > div {
497
- background: #000000 !important;
498
- color: #dedede;
499
- border: unset;
500
- }
501
-
502
- .docblock-source button {
503
- background: var(--tn-bg2) !important;
504
- color: var(--tn-fg2);
505
- }
506
-
507
- .docblock-source {
508
- border: solid 1px var(--tn-alt-bg2) !important;
509
- }
510
-
511
- /* ================================
512
- IX Dialog Styles
440
+ TN Dialog Styles
513
441
  ================================ */
514
442
 
515
443
  /* Dialog panel - the main dialog container */
@@ -27,8 +27,27 @@ declare class DiskIconComponent {
27
27
  }
28
28
 
29
29
  type TnBannerType = 'info' | 'warning' | 'error' | 'success';
30
+ /**
31
+ * Directive to mark an element as a banner action.
32
+ * Apply this to any element that should appear in the banner's action area.
33
+ *
34
+ * @example
35
+ * ```html
36
+ * <tn-banner heading="Error">
37
+ * <button tnBannerAction>Fix Now</button>
38
+ * </tn-banner>
39
+ * ```
40
+ */
41
+ declare class TnBannerActionDirective {
42
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnBannerActionDirective, never>;
43
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TnBannerActionDirective, "[tnBannerAction]", never, {}, {}, never, never, true, never>;
44
+ }
30
45
  declare class TnBannerComponent {
31
46
  private iconRegistry;
47
+ /** Query for projected action content */
48
+ private actionContent;
49
+ /** Signal indicating whether action content has been projected */
50
+ protected hasAction: _angular_core.Signal<boolean>;
32
51
  heading: _angular_core.InputSignal<string>;
33
52
  message: _angular_core.InputSignal<string | undefined>;
34
53
  type: _angular_core.InputSignal<TnBannerType>;
@@ -53,7 +72,7 @@ declare class TnBannerComponent {
53
72
  */
54
73
  classes: _angular_core.Signal<string[]>;
55
74
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TnBannerComponent, never>;
56
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnBannerComponent, "tn-banner", never, { "heading": { "alias": "heading"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
75
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnBannerComponent, "tn-banner", never, { "heading": { "alias": "heading"; "required": true; "isSignal": true; }; "message": { "alias": "message"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, ["actionContent"], ["[tnBannerAction]"], true, never>;
57
76
  }
58
77
 
59
78
  /**
@@ -138,6 +157,93 @@ declare class TnButtonComponent {
138
157
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<TnButtonComponent, "tn-button", never, { "primary": { "alias": "primary"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "backgroundColor": { "alias": "backgroundColor"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, { "onClick": "onClick"; }, never, never, true, never>;
139
158
  }
140
159
 
160
+ /**
161
+ * Harness for interacting with tn-button in tests.
162
+ * Provides methods for querying button state and simulating user interactions.
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * // Find and click a button
167
+ * const saveBtn = await loader.getHarness(TnButtonHarness.with({ label: 'Save' }));
168
+ * await saveBtn.click();
169
+ *
170
+ * // Check if button is disabled
171
+ * const submitBtn = await loader.getHarness(TnButtonHarness.with({ label: 'Submit' }));
172
+ * expect(await submitBtn.isDisabled()).toBe(false);
173
+ *
174
+ * // Find button by regex
175
+ * const cancelBtn = await loader.getHarness(TnButtonHarness.with({ label: /Cancel/i }));
176
+ * ```
177
+ */
178
+ declare class TnButtonHarness extends ComponentHarness {
179
+ /**
180
+ * The selector for the host element of a `TnButtonComponent` instance.
181
+ */
182
+ static hostSelector: string;
183
+ private _button;
184
+ /**
185
+ * Gets a `HarnessPredicate` that can be used to search for a button
186
+ * with specific attributes.
187
+ *
188
+ * @param options Options for filtering which button instances are considered a match.
189
+ * @returns A `HarnessPredicate` configured with the given options.
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * // Find button by exact label
194
+ * const button = await loader.getHarness(TnButtonHarness.with({ label: 'Save' }));
195
+ *
196
+ * // Find button with regex pattern
197
+ * const button = await loader.getHarness(TnButtonHarness.with({ label: /Delete/i }));
198
+ * ```
199
+ */
200
+ static with(options?: ButtonHarnessFilters): HarnessPredicate<TnButtonHarness>;
201
+ /**
202
+ * Gets the button's label text.
203
+ *
204
+ * @returns Promise resolving to the button's text content.
205
+ *
206
+ * @example
207
+ * ```typescript
208
+ * const button = await loader.getHarness(TnButtonHarness);
209
+ * const label = await button.getLabel();
210
+ * expect(label).toBe('Submit');
211
+ * ```
212
+ */
213
+ getLabel(): Promise<string>;
214
+ /**
215
+ * Checks whether the button is disabled.
216
+ *
217
+ * @returns Promise resolving to true if the button is disabled.
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * const button = await loader.getHarness(TnButtonHarness.with({ label: 'Submit' }));
222
+ * expect(await button.isDisabled()).toBe(false);
223
+ * ```
224
+ */
225
+ isDisabled(): Promise<boolean>;
226
+ /**
227
+ * Clicks the button.
228
+ *
229
+ * @returns Promise that resolves when the click action is complete.
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * const button = await loader.getHarness(TnButtonHarness.with({ label: 'Save' }));
234
+ * await button.click();
235
+ * ```
236
+ */
237
+ click(): Promise<void>;
238
+ }
239
+ /**
240
+ * A set of criteria that can be used to filter a list of `TnButtonHarness` instances.
241
+ */
242
+ interface ButtonHarnessFilters extends BaseHarnessFilters {
243
+ /** Filters by button label text. Supports string or regex matching. */
244
+ label?: string | RegExp;
245
+ }
246
+
141
247
  type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
142
248
  type IconSource = 'svg' | 'css' | 'unicode' | 'text' | 'sprite';
143
249
  type IconLibraryType = 'material' | 'mdi' | 'custom' | 'lucide';
@@ -2683,5 +2789,5 @@ declare const TN_THEME_DEFINITIONS: readonly TnThemeDefinition[];
2683
2789
  */
2684
2790
  declare const THEME_MAP: Map<TnTheme, TnThemeDefinition>;
2685
2791
 
2686
- export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogShellComponent, TnDividerComponent, TnDividerDirective, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconComponent, TnIconHarness, TnIconRegistryService, TnInputComponent, TnInputDirective, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectionListComponent, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabPanelComponent, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
2687
- export type { BannerHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, KeyCombination, LabelType, LucideIconOptions, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, ShortcutHandler, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };
2792
+ export { CommonShortcuts, DEFAULT_THEME, DiskIconComponent, DiskType, FileSizePipe, InputType, LinuxModifierKeys, LinuxShortcuts, ModifierKeys, QuickShortcuts, ShortcutBuilder, StripMntPrefixPipe, THEME_MAP, THEME_STORAGE_KEY, TN_THEME_DEFINITIONS, TnBannerActionDirective, TnBannerComponent, TnBannerHarness, TnBrandedSpinnerComponent, TnButtonComponent, TnButtonHarness, TnButtonToggleComponent, TnButtonToggleGroupComponent, TnCalendarComponent, TnCalendarHeaderComponent, TnCardComponent, TnCellDefDirective, TnCheckboxComponent, TnChipComponent, TnConfirmDialogComponent, TnDateInputComponent, TnDateRangeInputComponent, TnDialog, TnDialogShellComponent, TnDividerComponent, TnDividerDirective, TnExpansionPanelComponent, TnFilePickerComponent, TnFilePickerPopupComponent, TnFormFieldComponent, TnHeaderCellDefDirective, TnIconButtonComponent, TnIconComponent, TnIconHarness, TnIconRegistryService, TnInputComponent, TnInputDirective, TnKeyboardShortcutComponent, TnKeyboardShortcutService, TnListAvatarDirective, TnListComponent, TnListIconDirective, TnListItemComponent, TnListItemLineDirective, TnListItemPrimaryDirective, TnListItemSecondaryDirective, TnListItemTitleDirective, TnListItemTrailingDirective, TnListOptionComponent, TnListSubheaderComponent, TnMenuComponent, TnMenuTriggerDirective, TnMonthViewComponent, TnMultiYearViewComponent, TnNestedTreeNodeComponent, TnParticleProgressBarComponent, TnProgressBarComponent, TnRadioComponent, TnSelectComponent, TnSelectionListComponent, TnSlideToggleComponent, TnSliderComponent, TnSliderThumbDirective, TnSliderWithLabelDirective, TnSpinnerComponent, TnSpriteLoaderService, TnStepComponent, TnStepperComponent, TnTabComponent, TnTabPanelComponent, TnTableColumnDirective, TnTableComponent, TnTabsComponent, TnTheme, TnThemeService, TnTimeInputComponent, TnTooltipComponent, TnTooltipDirective, TnTreeComponent, TnTreeFlatDataSource, TnTreeFlattener, TnTreeNodeComponent, TnTreeNodeOutletDirective, TruncatePathPipe, WindowsModifierKeys, WindowsShortcuts, createLucideLibrary, createShortcut, defaultSpriteBasePath, defaultSpriteConfigPath, libIconMarker, registerLucideIcons, setupLucideIntegration, tnIconMarker };
2793
+ export type { BannerHarnessFilters, ButtonHarnessFilters, CalendarCell, ChipColor, CreateFolderEvent, DateRange, FilePickerCallbacks, FilePickerError, FilePickerMode, FileSystemItem, IconHarnessFilters, IconLibrary, IconLibraryType, IconResult, IconSize, IconSource, KeyCombination, LabelType, LucideIconOptions, PathSegment, PlatformType, ProgressBarMode, ResolvedIcon, ShortcutHandler, SlideToggleColor, SpinnerMode, SpriteConfig, TabChangeEvent, TnBannerType, TnButtonToggleType, TnCardAction, TnCardControl, TnCardFooterLink, TnCardHeaderStatus, TnConfirmDialogData, TnDialogDefaults, TnDialogOpenTarget, TnFlatTreeNode, TnMenuItem, TnSelectOption, TnSelectOptionGroup, TnSelectionChange, TnTableDataSource, TnThemeDefinition, TooltipPosition, YearCell };
@@ -1,150 +0,0 @@
1
- /* TN Dialog Global Styles for CDK Dialog */
2
-
3
- /* CDK Dialog Container Styles */
4
- .cdk-dialog-container {
5
- display: flex;
6
- flex-direction: column;
7
- align-items: center;
8
- justify-content: center;
9
- min-height: 100vh;
10
- padding: 20px;
11
- box-sizing: border-box;
12
- }
13
-
14
- /* Dialog Panel - this is the actual dialog box */
15
- .cdk-dialog-panel,
16
- .tn-dialog-panel {
17
- position: relative;
18
- display: flex;
19
- flex-direction: column;
20
- border-radius: 8px;
21
- box-sizing: border-box;
22
- overflow: hidden;
23
- outline: 0;
24
- width: 100%;
25
- max-width: 80vw;
26
- max-height: 80vh;
27
- background: var(--tn-bg1, #ffffff);
28
- color: var(--tn-fg1, #000000);
29
- box-shadow: 0 11px 15px -7px rgba(0, 0, 0, 0.2),
30
- 0 24px 38px 3px rgba(0, 0, 0, 0.14),
31
- 0 9px 46px 8px rgba(0, 0, 0, 0.12);
32
- }
33
-
34
- /* Dialog backdrop */
35
- .cdk-dialog-backdrop {
36
- background: rgba(0, 0, 0, 0.5);
37
- }
38
-
39
- /* Dialog content structure styling */
40
- .cdk-dialog-panel > * {
41
- display: flex;
42
- flex-direction: column;
43
- height: 100%;
44
- width: 100%;
45
- box-sizing: border-box;
46
- }
47
-
48
- /* Dialog title should be at the very top */
49
- .tn-dialog-title {
50
- box-sizing: border-box;
51
- display: block;
52
- flex-shrink: 0; /* Don't allow shrinking */
53
- width: 100%; /* Full width */
54
- padding: 24px 48px 20px 24px; /* Top, right (for close button), bottom, left */
55
- margin: 0;
56
- font-size: 1.25rem;
57
- font-weight: 600;
58
- line-height: 1.5;
59
- }
60
-
61
- /* Reset margins for any heading elements inside the title */
62
- .tn-dialog-title h1,
63
- .tn-dialog-title h2,
64
- .tn-dialog-title h3,
65
- .tn-dialog-title h4,
66
- .tn-dialog-title h5,
67
- .tn-dialog-title h6 {
68
- margin: 0;
69
- font-size: inherit;
70
- font-weight: inherit;
71
- line-height: inherit;
72
- }
73
-
74
- /* Dialog content should expand to fill available space between title and actions */
75
- .tn-dialog-content {
76
- flex-grow: 1;
77
- overflow: auto;
78
- box-sizing: border-box;
79
- min-height: 0; /* Allow flexbox to shrink */
80
- }
81
-
82
- /* Dialog actions styling */
83
- .tn-dialog-actions {
84
- box-sizing: border-box;
85
- display: flex !important;
86
- flex-shrink: 0; /* Don't allow shrinking - always visible */
87
- align-items: center !important;
88
- justify-content: flex-end !important;
89
- width: 100%; /* Full width */
90
- padding: 8px 24px 24px 24px !important; /* Top, right, bottom, left */
91
- margin: 0 !important;
92
- gap: 12px !important;
93
- border-top: 1px solid var(--tn-lines, #e5e7eb) !important;
94
- }
95
-
96
- /* Close button styling */
97
- .tn-dialog-close-btn {
98
- position: absolute;
99
- top: 16px;
100
- right: 16px;
101
- display: flex;
102
- align-items: center;
103
- justify-content: center;
104
- width: 32px;
105
- height: 32px;
106
- padding: 0;
107
- background: none;
108
- border: none;
109
- border-radius: 4px;
110
- color: var(--tn-fg2, #6c757d);
111
- cursor: pointer;
112
- font-size: 24px;
113
- line-height: 1;
114
- transition: all 0.2s ease-in-out;
115
- z-index: 10;
116
- }
117
-
118
- .tn-dialog-close-btn:hover {
119
- background: var(--tn-alt-bg1, #f8f9fa);
120
- color: var(--tn-fg1, #000000);
121
- }
122
-
123
- .tn-dialog-close-btn:focus {
124
- outline: 2px solid var(--tn-primary, #007bff);
125
- outline-offset: 2px;
126
- }
127
-
128
- .tn-dialog-close-btn:active {
129
- transform: scale(0.95);
130
- }
131
-
132
- .tn-dialog-close-btn span {
133
- font-weight: normal;
134
- }
135
-
136
- /* High contrast mode support */
137
- @media (prefers-contrast: high) {
138
- .cdk-dialog-panel,
139
- .tn-dialog-panel {
140
- border: 1px solid var(--tn-fg1, #000);
141
- }
142
- }
143
-
144
- /* Reduced motion support */
145
- @media (prefers-reduced-motion: reduce) {
146
- .cdk-dialog-panel,
147
- .tn-dialog-panel {
148
- /* Animations will be disabled by the animation trigger */
149
- }
150
- }