crdx-components 1.0.0 → 2.0.0

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.
Files changed (105) hide show
  1. package/fesm2022/crdx-components.mjs +1960 -0
  2. package/fesm2022/crdx-components.mjs.map +1 -0
  3. package/package.json +28 -23
  4. package/src/lib/styles/index.scss +1 -0
  5. package/src/lib/styles/overrides/_index.scss +2 -4
  6. package/src/lib/styles/overrides/_mat-button-overrides.scss +0 -11
  7. package/src/lib/styles/overrides/_mat-checkbox-overrides.scss +2 -2
  8. package/src/lib/styles/overrides/_mat-radio-overrides.scss +40 -0
  9. package/types/crdx-components.d.ts +811 -0
  10. package/types/crdx-components.d.ts.map +1 -0
  11. package/.github/workflows/publish.yml +0 -38
  12. package/bun.lock +0 -491
  13. package/crdx-components-1.0.0.tgz +0 -0
  14. package/crdx-components-tokenized-components-1.0.1.tgz +0 -0
  15. package/ng-package.json +0 -12
  16. package/npm +0 -0
  17. package/src/index.ts +0 -45
  18. package/src/lib/components/breadcrumb/breadcrumb.component.css +0 -206
  19. package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -15
  20. package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -47
  21. package/src/lib/components/button/button.css +0 -371
  22. package/src/lib/components/button/button.html +0 -187
  23. package/src/lib/components/button/button.ts +0 -103
  24. package/src/lib/components/card/card.css +0 -285
  25. package/src/lib/components/card/card.html +0 -69
  26. package/src/lib/components/card/card.ts +0 -93
  27. package/src/lib/components/checkbox/checkbox-showcase.component.css +0 -42
  28. package/src/lib/components/checkbox/checkbox-showcase.component.html +0 -36
  29. package/src/lib/components/checkbox/checkbox-showcase.component.ts +0 -13
  30. package/src/lib/components/checkbox/checkbox.css +0 -10
  31. package/src/lib/components/checkbox/checkbox.html +0 -13
  32. package/src/lib/components/checkbox/checkbox.ts +0 -64
  33. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.css +0 -89
  34. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.html +0 -23
  35. package/src/lib/components/circular-progress-stepper/circular-progress-stepper.ts +0 -40
  36. package/src/lib/components/dialogs/alert-modal/alert-modal.css +0 -118
  37. package/src/lib/components/dialogs/alert-modal/alert-modal.html +0 -29
  38. package/src/lib/components/dialogs/alert-modal/alert-modal.ts +0 -28
  39. package/src/lib/components/dialogs/confirm-modal/confirm-modal.css +0 -219
  40. package/src/lib/components/dialogs/confirm-modal/confirm-modal.html +0 -60
  41. package/src/lib/components/dialogs/confirm-modal/confirm-modal.store.ts +0 -139
  42. package/src/lib/components/dialogs/confirm-modal/confirm-modal.ts +0 -63
  43. package/src/lib/components/dialogs/container-custom/container-custom.css +0 -11
  44. package/src/lib/components/dialogs/container-custom/container-custom.html +0 -3
  45. package/src/lib/components/dialogs/container-custom/container-custom.ts +0 -37
  46. package/src/lib/components/dialogs/container-custom/custom-modal.state.ts +0 -57
  47. package/src/lib/components/dialogs/error-modal/error-modal.css +0 -53
  48. package/src/lib/components/dialogs/error-modal/error-modal.html +0 -17
  49. package/src/lib/components/dialogs/error-modal/error-modal.ts +0 -20
  50. package/src/lib/components/dialogs/side-modal/side-modal.css +0 -80
  51. package/src/lib/components/dialogs/side-modal/side-modal.html +0 -30
  52. package/src/lib/components/dialogs/side-modal/side-modal.state.ts +0 -78
  53. package/src/lib/components/dialogs/side-modal/side-modal.ts +0 -50
  54. package/src/lib/components/divider/divider.css +0 -24
  55. package/src/lib/components/divider/divider.html +0 -7
  56. package/src/lib/components/divider/divider.ts +0 -13
  57. package/src/lib/components/footer-actions/footer/footer-flow.store.ts +0 -30
  58. package/src/lib/components/footer-actions/footer/footer.html +0 -14
  59. package/src/lib/components/footer-actions/footer/footer.ts +0 -50
  60. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.css +0 -44
  61. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.html +0 -7
  62. package/src/lib/components/footer-actions/modal-footer-actions/modal-footer-actions.ts +0 -12
  63. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.css +0 -31
  64. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.html +0 -7
  65. package/src/lib/components/footer-actions/page-footer-actions/page-footer-actions.ts +0 -12
  66. package/src/lib/components/form-field/select-field.css +0 -178
  67. package/src/lib/components/form-field/select-field.html +0 -94
  68. package/src/lib/components/form-field/select-field.ts +0 -324
  69. package/src/lib/components/form-field/text-field.css +0 -41
  70. package/src/lib/components/form-field/text-field.html +0 -38
  71. package/src/lib/components/form-field/text-field.ts +0 -102
  72. package/src/lib/components/header/header.css +0 -142
  73. package/src/lib/components/header/header.html +0 -36
  74. package/src/lib/components/header/header.ts +0 -101
  75. package/src/lib/components/icon-button/icon-button.css +0 -445
  76. package/src/lib/components/icon-button/icon-button.html +0 -15
  77. package/src/lib/components/icon-button/icon-button.ts +0 -49
  78. package/src/lib/components/list-item/list-item.css +0 -122
  79. package/src/lib/components/list-item/list-item.html +0 -79
  80. package/src/lib/components/list-item/list-item.ts +0 -104
  81. package/src/lib/components/menu/menu.css +0 -39
  82. package/src/lib/components/menu/menu.html +0 -57
  83. package/src/lib/components/menu/menu.ts +0 -159
  84. package/src/lib/components/shared-table/shared-table-cell-template.directive.ts +0 -25
  85. package/src/lib/components/shared-table/shared-table.component.css +0 -223
  86. package/src/lib/components/shared-table/shared-table.component.html +0 -96
  87. package/src/lib/components/shared-table/shared-table.component.ts +0 -172
  88. package/src/lib/components/sidebar/sidebar.css +0 -234
  89. package/src/lib/components/sidebar/sidebar.html +0 -67
  90. package/src/lib/components/sidebar/sidebar.ts +0 -92
  91. package/src/lib/components/slide-toggle/slide-toggle.css +0 -0
  92. package/src/lib/components/slide-toggle/slide-toggle.html +0 -3
  93. package/src/lib/components/slide-toggle/slide-toggle.ts +0 -18
  94. package/src/lib/components/spinner/spinner.css +0 -9
  95. package/src/lib/components/spinner/spinner.html +0 -9
  96. package/src/lib/components/spinner/spinner.ts +0 -17
  97. package/src/lib/components/tooltip/tooltip.css +0 -32
  98. package/src/lib/components/tooltip/tooltip.html +0 -3
  99. package/src/lib/components/tooltip/tooltip.ts +0 -31
  100. package/src/lib/icons/register-icons.ts +0 -101
  101. package/src/lib/lib-ui/lib-ui.html +0 -1
  102. package/src/lib/lib-ui/lib-ui.scss +0 -0
  103. package/src/lib/lib-ui/lib-ui.ts +0 -9
  104. package/tsconfig.json +0 -30
  105. package/tsconfig.lib.json +0 -20
@@ -1,102 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, computed, effect, input, output } from '@angular/core';
2
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
3
- import { FormControl, ReactiveFormsModule } from '@angular/forms';
4
- import { MatFormFieldAppearance, MatFormFieldModule } from '@angular/material/form-field';
5
- import { MatInputModule } from '@angular/material/input';
6
- import { MatIconModule } from '@angular/material/icon';
7
-
8
- type LibTextFieldAppearance = MatFormFieldAppearance | 'outlined' | 'filled';
9
-
10
- @Component({
11
- selector: 'lib-text-field',
12
- standalone: true,
13
- imports: [MatFormFieldModule, MatInputModule, ReactiveFormsModule, MatIconModule],
14
- templateUrl: './text-field.html',
15
- styleUrl: './text-field.css',
16
- changeDetection: ChangeDetectionStrategy.OnPush,
17
- })
18
- export class LibTextFieldComponent {
19
- private disabledAppliedByInput = false;
20
-
21
- readonly label = input.required<string>();
22
- readonly control = input.required<FormControl>();
23
- readonly appearance = input<LibTextFieldAppearance>('outline');
24
- /**
25
- * @deprecated Use `appearance`. Kept for compatibility.
26
- */
27
- readonly apperance = input<LibTextFieldAppearance | null>(null);
28
- readonly suffixIcon = input<string>('');
29
- readonly suffixTextIcon = input<string>('');
30
- readonly prefixIcon = input<string>('');
31
- readonly prefixIconSrc = input<string>('');
32
- /**
33
- * @deprecated Use `prefixIcon`. Kept for compatibility.
34
- */
35
- readonly preffixIcon = input<string | null>(null);
36
- readonly error = input<string | null>(null);
37
- readonly errorState = input<boolean | null>(null);
38
- readonly hint = input<string>('');
39
- readonly suffixEvent = output<void>();
40
- readonly showSuffix = input(false, { transform: coerceBooleanProperty });
41
- readonly suffixIconBand = input(false, { transform: coerceBooleanProperty });
42
- readonly placeholder = input<string>('');
43
- readonly autocomplete = input<string>('off');
44
- readonly fullWidth = input(false, { transform: coerceBooleanProperty });
45
- readonly width = input<string | null, string | number | null>(null, {
46
- transform: (value) => {
47
- if (value == null || value === '') {
48
- return null;
49
- }
50
- return typeof value === 'number' ? `${value}px` : String(value);
51
- },
52
- });
53
- readonly disabled = input(false, { transform: coerceBooleanProperty });
54
- readonly type = input<string>('text');
55
- readonly hideRequiredMarker = input(false, { transform: coerceBooleanProperty });
56
-
57
- readonly resolvedAppearance = computed<MatFormFieldAppearance>(() => {
58
- const raw = this.apperance() ?? this.appearance();
59
- if (raw === 'outlined') return 'outline';
60
- if (raw === 'filled') return 'fill';
61
- return raw;
62
- });
63
- readonly resolvedPrefixIcon = computed(() => this.preffixIcon() ?? this.prefixIcon());
64
- readonly widthStyle = computed(() => (this.fullWidth() ? '100%' : this.width()));
65
- readonly shouldShowSuffix = computed(
66
- () => this.showSuffix() || (this.suffixIconBand() && (!!this.suffixIcon() || !!this.suffixTextIcon()))
67
- );
68
- readonly shouldShowError = computed(() => {
69
- const forcedError = this.errorState();
70
- if (forcedError !== null) {
71
- return forcedError;
72
- }
73
-
74
- const control = this.control();
75
- return control.invalid && (control.dirty || control.touched);
76
- });
77
-
78
- constructor() {
79
- effect(() => {
80
- const control = this.control();
81
- const shouldDisable = this.disabled();
82
-
83
- if (shouldDisable) {
84
- if (control.enabled) {
85
- control.disable({ emitEvent: false });
86
- }
87
- this.disabledAppliedByInput = true;
88
- return;
89
- }
90
-
91
- if (this.disabledAppliedByInput && control.disabled) {
92
- control.enable({ emitEvent: false });
93
- }
94
-
95
- this.disabledAppliedByInput = false;
96
- });
97
- }
98
-
99
- pressSuffixEvent(): void {
100
- this.suffixEvent.emit();
101
- }
102
- }
@@ -1,142 +0,0 @@
1
- :host {
2
- display: block;
3
- width: 100%;
4
- --bars-common-app-bar-brand-width: 47;
5
- --bars-common-app-bar-brand-height: 25;
6
- }
7
-
8
- .app-bar {
9
- display: grid;
10
- grid-template-columns: auto 1fr auto;
11
- align-items: center;
12
- width: 100%;
13
- flex-shrink: 0;
14
- align-self: stretch;
15
- height: calc(var(--bars-size-small-app-bar-small-container-height, 64) * 1px);
16
- padding: 0.5rem calc(var(--bars-common-app-bar-right-padding, 4) * 1px) 0.5rem calc(var(--bars-common-app-bar-left-padding, 4) * 1px);
17
- background-color: var(--bars-common-app-bar-container-color, #ebeef0);
18
- border-radius: calc(var(--bars-common-app-bar-container-shape, 0) * 1px);
19
- box-sizing: border-box;
20
- column-gap: calc(var(--bars-common-app-bar-icon-spacing, 0) * 1px);
21
- }
22
-
23
- .app-bar__leading,
24
- .app-bar__actions {
25
- display: flex;
26
- align-items: center;
27
- }
28
-
29
- .app-bar__leading {
30
- justify-self: start;
31
- width: calc(var(--bars-common-app-bar-icon-touch-target-size, 48) * 1px);
32
- }
33
-
34
- .app-bar__actions {
35
- justify-self: end;
36
- justify-content: flex-end;
37
- gap: calc(var(--bars-common-app-bar-icon-spacing, 0) * 1px);
38
- min-width: calc(var(--bars-common-app-bar-icon-touch-target-size, 48) * 1px);
39
- }
40
-
41
- .app-bar__actions:empty {
42
- min-width: 0;
43
- }
44
-
45
- .app-bar__brand {
46
- justify-self: center;
47
- position: relative;
48
- width: calc(var(--bars-common-app-bar-brand-width, 47) * 1px);
49
- height: calc(var(--bars-common-app-bar-brand-height, 25) * 1px);
50
- aspect-ratio: 47 / 25;
51
- display: flex;
52
- align-items: center;
53
- justify-content: center;
54
- pointer-events: none;
55
- color: var(--bars-common-app-bar-central-icon, #e42313);
56
- }
57
-
58
- .app-bar__brand-icon {
59
- width: 100%;
60
- height: 100%;
61
- aspect-ratio: 47 / 25;
62
- display: block;
63
- object-fit: contain;
64
- }
65
-
66
- .app-bar__brand-icon use {
67
- width: 100% !important;
68
- height: 100% !important;
69
- }
70
-
71
- .app-bar__brand-dot {
72
- position: absolute;
73
- width: 6px;
74
- height: 6px;
75
- border-radius: 50%;
76
- }
77
-
78
- .app-bar__brand-dot--primary {
79
- top: 6px;
80
- left: 6px;
81
- }
82
-
83
- .app-bar__brand-dot--secondary {
84
- top: 3px;
85
- left: 16px;
86
- }
87
-
88
- .app-bar__brand-dot--tertiary {
89
- top: 8px;
90
- left: 26px;
91
- }
92
-
93
- .app-bar__brand-curve {
94
- position: absolute;
95
- bottom: 0;
96
- right: 0;
97
- width: 32px;
98
- height: 18px;
99
- border-bottom: 4px solid var(--bars-common-app-bar-central-icon, #e42313);
100
- border-right: 4px solid var(--bars-common-app-bar-central-icon, #e42313);
101
- border-left: 0;
102
- border-top: 0;
103
- border-radius: 0 0 24px 24px;
104
- }
105
-
106
- .app-bar__icon-button {
107
- display: flex;
108
- align-items: center;
109
- justify-content: center;
110
- width: 48px;
111
- height: 48px;
112
- flex: 0 0 auto;
113
- border: 0;
114
- border-radius: calc(var(--icon-buttons-size-small-icon-button-small-container-shape-round, 1000) * 1px);
115
- background: transparent;
116
- color: var(--bars-common-app-bar-leading-icon, #181c1e);
117
- cursor: pointer;
118
- transition: background-color 150ms ease, color 150ms ease;
119
- }
120
-
121
- .app-bar__icon-button--trailing {
122
- color: var(--bars-common-app-bar-trailing-icon, #434749);
123
- }
124
-
125
- .app-bar__icon-button:hover,
126
- .app-bar__icon-button:focus-visible {
127
- background-color: rgba(0, 0, 0, 0.08);
128
- }
129
-
130
- .app-bar__icon-button:focus-visible {
131
- outline: 2px solid rgba(0, 0, 0, 0.24);
132
- outline-offset: 2px;
133
- }
134
-
135
- .app-bar__icon {
136
- font-size: calc(var(--bars-common-app-bar-icon-size, 24) * 1px);
137
- width: 1em;
138
- height: 1em;
139
- line-height: 1;
140
- display: block;
141
- object-fit: contain;
142
- }
@@ -1,36 +0,0 @@
1
- <header class="app-bar" role="banner">
2
- <div class="app-bar__leading">
3
- @if(showLeading()) {
4
- <button type="button" class="app-bar__icon-button app-bar__icon-button--leading" (click)="onLeadingClick()"
5
- [attr.aria-label]="leadingActionLabel()">
6
- @if (leadingIconUrl(); as leadingIconSrc) {
7
- <img class="app-bar__icon" [src]="leadingIconSrc" alt="" aria-hidden="true" />
8
- }
9
- </button>
10
- }
11
- </div>
12
- <div class="app-bar__brand" role="img" [attr.aria-label]="brandLabel()">
13
- <svg xmlns="http://www.w3.org/2000/svg" width="47" height="25" viewBox="0 0 47 25" fill="none">
14
- <path
15
- d="M34.0017 2.67521e-05C30.6579 -0.00672338 27.4427 1.26417 25.0377 3.54336C22.6327 5.82255 21.2268 8.93092 21.1179 12.2097C21.1179 12.3304 21.0564 12.5274 21.0564 12.6959C21.0564 14.8068 20.2017 16.8311 18.6803 18.3237C17.1589 19.8163 15.0955 20.6548 12.9439 20.6548C10.7923 20.6548 8.72889 19.8163 7.2075 18.3237C5.68612 16.8311 4.83141 14.8068 4.83141 12.6959C4.83073 12.0678 4.57609 11.4656 4.12335 11.0214C3.67061 10.5773 3.05676 10.3274 2.4165 10.3268C2.09598 10.3218 1.77774 10.3805 1.48091 10.4992C1.18407 10.6179 0.914746 10.7943 0.689116 11.0177C0.463486 11.2411 0.286201 11.5069 0.167908 11.7992C0.0496149 12.0915 -0.00724651 12.4042 0.000738184 12.7186C0.114789 15.972 1.49612 19.0588 3.86027 21.3431C6.22441 23.6274 9.39139 24.9353 12.709 24.9977C16.0266 25.06 19.2423 23.8719 21.6939 21.678C24.1454 19.4842 25.6462 16.4516 25.8871 13.2048C25.9417 13.0487 25.9626 12.8831 25.9486 12.7186C25.9486 10.6078 26.8033 8.58341 28.3247 7.09083C29.8461 5.59826 31.9095 4.75974 34.0611 4.75974C36.2127 4.75974 38.2761 5.59826 39.7975 7.09083C41.3189 8.58341 42.1736 10.6078 42.1736 12.7186C42.1562 13.0399 42.2056 13.3613 42.3189 13.6632C42.4322 13.9651 42.607 14.2412 42.8327 14.4747C43.0583 14.7082 43.3301 14.8941 43.6313 15.0212C43.9326 15.1482 44.2571 15.2138 44.5851 15.2138C44.913 15.2138 45.2375 15.1482 45.5388 15.0212C45.8401 14.8941 46.1119 14.7082 46.3375 14.4747C46.5632 14.2412 46.738 13.9651 46.8513 13.6632C46.9646 13.3613 47.014 13.0399 46.9966 12.7186C46.99 9.34216 45.6178 6.10632 43.1814 3.72165C40.7449 1.33699 37.4433 -0.00153433 34.0017 2.67521e-05Z"
16
- fill="#E42313" />
17
- <path
18
- d="M10.5943 6.75042C10.5937 7.32697 10.4188 7.89037 10.0918 8.36943C9.76482 8.84848 9.30041 9.22168 8.75728 9.44185C8.21414 9.66203 7.61667 9.71929 7.04037 9.60641C6.46407 9.49352 5.93482 9.21556 5.51951 8.80765C5.1042 8.39974 4.82148 7.88019 4.70708 7.31468C4.59268 6.74917 4.65174 6.16307 4.87678 5.63048C5.10183 5.09789 5.48277 4.64271 5.97145 4.32247C6.46013 4.00222 7.03461 3.8313 7.62228 3.8313C8.40773 3.84195 9.15792 4.15302 9.71305 4.69826C10.2682 5.24351 10.5844 5.97984 10.5943 6.75042Z"
19
- fill="#E42313" />
20
- <path
21
- d="M19.3841 6.75044C19.3841 7.52375 19.0709 8.26539 18.5136 8.8122C17.9562 9.35901 17.2003 9.66621 16.412 9.66621C15.6238 9.66621 14.8678 9.35901 14.3104 8.8122C13.7531 8.26539 13.44 7.52375 13.44 6.75044C13.4347 6.36594 13.5079 5.9843 13.6554 5.62802C13.8028 5.27174 14.0215 4.94802 14.2985 4.67596C14.5755 4.4039 14.9052 4.18901 15.2682 4.04394C15.6312 3.89888 16.0201 3.82658 16.412 3.83132C17.1975 3.84196 17.9476 4.15303 18.5028 4.69828C19.0579 5.24352 19.3741 5.97985 19.3841 6.75044Z"
22
- fill="#E42313" />
23
- </svg>
24
- </div>
25
-
26
- <div class="app-bar__actions">
27
- @for (action of trailingActions(); track trackByAction($index, action)) {
28
- <button type="button" class="app-bar__icon-button app-bar__icon-button--trailing" (click)="onActionClick(action)"
29
- [attr.aria-label]="action.ariaLabel">
30
- @if (actionIconUrl(action); as actionIconSrc) {
31
- <img class="app-bar__icon" [src]="actionIconSrc" alt="" aria-hidden="true" />
32
- }
33
- </button>
34
- }
35
- </div>
36
- </header>
@@ -1,101 +0,0 @@
1
- import { ChangeDetectionStrategy, Component, EventEmitter, Output, computed, input } from '@angular/core';
2
- import { resolveUiIconResource, UiIconName, UI_ICON_NAMES } from '../../icons/register-icons';
3
-
4
- export interface HeaderAction {
5
- icon: string;
6
- ariaLabel: string;
7
- id?: string;
8
- iconPath?: string;
9
- }
10
-
11
- @Component({
12
- selector: 'lib-header',
13
- standalone: true,
14
- imports: [],
15
- templateUrl: './header.html',
16
- styleUrl: './header.css',
17
- changeDetection: ChangeDetectionStrategy.OnPush,
18
- })
19
- export class HeaderComponent {
20
- readonly showLeading = input(true);
21
- readonly leadingIcon = input('icon-menu');
22
- readonly leadingIconPath = input<string | null>(null);
23
- readonly leadingActionLabel = input('Abrir navegación');
24
- readonly brandLabel = input('Credix');
25
- readonly brandIcon = input('smiley');
26
- readonly brandIconPath = input<string | null>(null);
27
- readonly trailingActions = input<readonly HeaderAction[]>([
28
- { icon: 'search', ariaLabel: 'Abrir buscador' },
29
- ]);
30
- readonly iconBasePath = input('assets/icons');
31
-
32
- @Output() readonly leadingClick = new EventEmitter<void>();
33
- @Output() readonly actionClick = new EventEmitter<HeaderAction>();
34
-
35
- protected readonly iconAssetBasePath = computed(() =>
36
- this.normalizeAssetBasePath(this.iconBasePath())
37
- );
38
-
39
- protected readonly leadingIconUrl = computed(() =>
40
- this.resolveIconUrl(this.leadingIcon(), this.leadingIconPath())
41
- );
42
-
43
- protected readonly brandIconUrl = computed(() =>
44
- this.resolveIconUrl(this.brandIcon(), this.brandIconPath())
45
- );
46
-
47
- protected onLeadingClick(): void {
48
- this.leadingClick.emit();
49
- }
50
-
51
- protected onActionClick(action: HeaderAction): void {
52
- this.actionClick.emit(action);
53
- }
54
-
55
- protected trackByAction(_index: number, action: HeaderAction): string {
56
- return action.id ?? action.icon;
57
- }
58
-
59
- protected actionIconUrl(action: HeaderAction): string | null {
60
- return this.resolveIconUrl(action.icon, action.iconPath ?? null);
61
- }
62
-
63
- private resolveIconUrl(iconName: string | null | undefined, explicitPath: string | null): string | null {
64
- if (explicitPath) {
65
- if (explicitPath.includes('#')) {
66
- const spriteSymbol = explicitPath.split('#')[1];
67
- if (spriteSymbol) {
68
- const fallback = this.resolveIconUrl(spriteSymbol, null);
69
- if (fallback) {
70
- return fallback;
71
- }
72
- }
73
- }
74
- return explicitPath;
75
- }
76
-
77
- if (!iconName) {
78
- return null;
79
- }
80
-
81
- if (KNOWN_UI_ICON_NAMES.has(iconName as UiIconName)) {
82
- return resolveUiIconResource(iconName as UiIconName, {
83
- basePath: this.iconAssetBasePath(),
84
- });
85
- }
86
-
87
- return `${this.iconAssetBasePath()}/${iconName}.svg`;
88
- }
89
-
90
- private normalizeAssetBasePath(basePath: string | null | undefined): string {
91
- const targetPath = basePath ?? 'assets/icons';
92
-
93
- if (/^(https?:)?\/\//.test(targetPath)) {
94
- return targetPath.replace(/\/$/, '');
95
- }
96
-
97
- return targetPath.replace(/\/$/, '');
98
- }
99
- }
100
-
101
- const KNOWN_UI_ICON_NAMES = new Set<UiIconName>(UI_ICON_NAMES);