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,178 +0,0 @@
1
- .lib-select-field__field {
2
- display: block;
3
- }
4
-
5
- :host ::ng-deep .lib-select-field__field .mat-mdc-select-arrow,
6
- :host ::ng-deep .lib-select-field__field .mat-mdc-select-arrow-wrapper {
7
- display: none !important;
8
- }
9
-
10
- :host ::ng-deep .mat-mdc-select-trigger {
11
- padding-right: 0 !important;
12
- }
13
-
14
- .lib-select-field__field .mat-mdc-select-arrow-wrapper {
15
- display: none !important;
16
- }
17
-
18
- .lib-select-field__filter-option {
19
- pointer-events: auto;
20
- height: auto;
21
- padding: 0;
22
- line-height: 0;
23
- }
24
-
25
- .lib-select-field__filter-option .mat-pseudo-checkbox {
26
- display: none;
27
- }
28
-
29
- .lib-select-field__filter-option .lib-select-field__filter-input {
30
- width: 100%;
31
- padding: 8px 16px;
32
- border: none;
33
- outline: none;
34
- background: transparent;
35
- font-size: 14px;
36
- box-sizing: border-box;
37
- }
38
-
39
-
40
- .lib-select-field__multi-trigger-input {
41
- width: 100%;
42
- border: none;
43
- outline: none;
44
- background: transparent;
45
- font: inherit;
46
- font-size: 14px;
47
- color: inherit;
48
- box-sizing: border-box;
49
- cursor: pointer;
50
- }
51
-
52
- .lib-select-field__multi-trigger-input::placeholder {
53
- color: rgba(0, 0, 0, 0.42);
54
- }
55
-
56
- .lib-select-field__option-row {
57
- display: inline-flex;
58
- align-items: center;
59
- gap: 12px;
60
- }
61
-
62
- .lib-select-field__virtual-row {
63
- height: 48px;
64
- }
65
-
66
- .lib-select-field__select-all-option {
67
- display: flex;
68
- align-items: center;
69
- height: 100%;
70
- padding: 0 16px;
71
- box-sizing: border-box;
72
- cursor: pointer;
73
- }
74
-
75
-
76
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel,
77
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel {
78
- overflow: hidden !important;
79
- }
80
-
81
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport,
82
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport {
83
- width: 100%;
84
- overflow-x: hidden;
85
- overflow-y: auto;
86
- scrollbar-width: thin;
87
- scrollbar-color: var(--Gris-500, #6a7282) var(--Gris-100, #f3f4f6);
88
- }
89
-
90
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar,
91
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar {
92
- width: 10px;
93
- }
94
-
95
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button,
96
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button,
97
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button,
98
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button,
99
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical,
100
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical,
101
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal,
102
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal,
103
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:start:decrement,
104
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:start:decrement,
105
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:end:increment,
106
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:end:increment,
107
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:start:decrement,
108
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:start:decrement,
109
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:end:increment,
110
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:end:increment,
111
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:start:decrement,
112
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:start:decrement,
113
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:end:increment,
114
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:end:increment,
115
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:start:decrement,
116
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:start:decrement,
117
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:end:increment,
118
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:end:increment,
119
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:decrement,
120
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:decrement,
121
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:increment,
122
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:vertical:increment,
123
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:decrement,
124
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:decrement,
125
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:increment,
126
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:single-button:horizontal:increment,
127
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:decrement,
128
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:decrement,
129
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:increment,
130
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:increment,
131
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:decrement,
132
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:decrement,
133
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:increment,
134
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:increment,
135
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:start,
136
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:start,
137
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:end,
138
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:vertical:end,
139
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:start,
140
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:start,
141
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:end,
142
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-button:horizontal:end {
143
- display: none !important;
144
- width: 0 !important;
145
- height: 0 !important;
146
- -webkit-appearance: none !important;
147
- appearance: none !important;
148
- }
149
-
150
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-track,
151
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-track {
152
- background: var(--Gris-100, #f3f4f6);
153
- border-radius: var(--Corner-Radius-Full, 6.25rem);
154
- }
155
-
156
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb,
157
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb {
158
- background: var(--Gris-500, #6a7282);
159
- border-radius: var(--Corner-Radius-Small, 0.5rem);
160
- min-height: 3rem;
161
- }
162
-
163
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb:hover,
164
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb:hover {
165
- background: color-mix(in srgb, var(--Gris-500, #6a7282) 80%, black);
166
- }
167
-
168
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb:active,
169
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport::-webkit-scrollbar-thumb:active {
170
- background: color-mix(in srgb, var(--Gris-500, #6a7282) 65%, black);
171
- }
172
-
173
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport .mat-pseudo-checkbox,
174
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport .mat-pseudo-checkbox,
175
- :host ::ng-deep .cdk-overlay-container .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport .mat-mdc-option .mdc-list-item__start,
176
- :host ::ng-deep .mat-mdc-select-panel.lib-select-field-panel .lib-select-field__viewport .mat-mdc-option .mdc-list-item__start {
177
- display: none !important;
178
- }
@@ -1,94 +0,0 @@
1
- <mat-form-field
2
- class="lib-select-field__field"
3
- [appearance]="matAppearance()"
4
- [style.width]="widthStyle() ?? null"
5
- >
6
- @if (label()) {
7
- <mat-label>{{ label() }}</mat-label>
8
- }
9
- <mat-select
10
- [value]="displayValue"
11
- [multiple]="isMultiple()"
12
- [disabled]="disabled() || disabledByControl()"
13
- [required]="required()"
14
- [placeholder]="placeholder()"
15
- panelClass="lib-select-field-panel"
16
- (openedChange)="onPanelOpenChange($event)"
17
- (selectionChange)="onSelectionChange($event)"
18
- >
19
- @if (isMultiple()) {
20
- <mat-select-trigger
21
- >{{ multiTriggerLabel() || placeholder() }}</mat-select-trigger
22
- >
23
- } @if (filterable()) {
24
- <div
25
- class="lib-select-field__filter-option"
26
- (mousedown)="$event.stopPropagation()"
27
- >
28
- <input
29
- #filterInput
30
- class="lib-select-field__filter-input"
31
- type="text"
32
- [placeholder]="filterPlaceholder()"
33
- [value]="filterTerm()"
34
- (mousedown)="$event.stopPropagation()"
35
- (click)="$event.stopPropagation()"
36
- (input)="onFilterInput($event)"
37
- (keydown)="onFilterKeydown($event)"
38
- />
39
- </div>
40
- }
41
- <cdk-virtual-scroll-viewport
42
- class="lib-select-field__viewport app-scrollbar-figma"
43
- [itemSize]="48"
44
- minBufferPx="240"
45
- maxBufferPx="240"
46
- [style.height.px]="virtualViewportHeight()"
47
- >
48
- <div
49
- *cdkVirtualFor="let row of virtualRows(); trackBy: trackByVirtualRow"
50
- class="lib-select-field__virtual-row"
51
- >
52
- @if (row.kind === 'selectAll') {
53
- <div
54
- class="lib-select-field__select-all-option"
55
- role="button"
56
- tabindex="0"
57
- (mousedown)="$event.stopPropagation()"
58
- (click)="toggledAllSelection(); $event.stopPropagation()"
59
- (keydown.enter)="toggledAllSelection(); $event.preventDefault(); $event.stopPropagation()"
60
- (keydown.space)="toggledAllSelection(); $event.preventDefault(); $event.stopPropagation()"
61
- >
62
- <span class="lib-select-field__option-row">
63
- <lib-checkbox
64
- [checked]="allSelected()"
65
- [indeterminate]="selectAllIndeterminate()"
66
- (click)="$event.stopPropagation()"
67
- (checkedChange)="onSelectAllCheckedChange($event)"
68
- />
69
- <span>{{ selectAllLabel() }}</span>
70
- </span>
71
- </div>
72
- } @else {
73
- <mat-option [value]="row.option.value">
74
- @if (isMultiple()) {
75
- <span class="lib-select-field__option-row">
76
- <lib-checkbox
77
- [checked]="isSelected(row.option.value)"
78
- (click)="$event.stopPropagation()"
79
- (checkedChange)="onOptionCheckedChange(row.option.value, $event)"
80
- />
81
- <span>{{ row.option.label }}</span>
82
- </span>
83
- } @else {
84
- {{ row.option.label }}
85
- }
86
- </mat-option>
87
- }
88
- </div>
89
- </cdk-virtual-scroll-viewport>
90
- </mat-select>
91
- <mat-icon class="lib-select-field__arrow" matSuffix>
92
- {{ panelOpen() ? 'keyboard_arrow_up' : 'keyboard_arrow_down' }}
93
- </mat-icon>
94
- </mat-form-field>
@@ -1,324 +0,0 @@
1
- import {
2
- ChangeDetectionStrategy,
3
- ChangeDetectorRef,
4
- Component,
5
- computed,
6
- DestroyRef,
7
- forwardRef,
8
- inject,
9
- Injector,
10
- input,
11
- OnInit,
12
- output,
13
- signal,
14
- } from '@angular/core';
15
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
16
- import { ControlValueAccessor, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
17
- import { MatFormFieldAppearance, MatFormFieldModule } from '@angular/material/form-field';
18
- import { MatIconModule } from '@angular/material/icon';
19
- import { MatInputModule } from '@angular/material/input';
20
- import { MatSelectModule, MatSelectChange } from '@angular/material/select';
21
- import { coerceBooleanProperty } from '@angular/cdk/coercion';
22
- import { LibCheckboxComponent } from '../checkbox/checkbox';
23
- import { ScrollingModule } from '@angular/cdk/scrolling';
24
-
25
- export interface LibSelectOption<T = string> {
26
- value: T;
27
- label: string;
28
- }
29
-
30
- type VirtualRow<T> =
31
- | { kind: 'selectAll' }
32
- | { kind: 'option'; option: LibSelectOption<T> };
33
-
34
- export type LibSelectMode = 'single' | 'multiple';
35
-
36
- @Component({
37
- selector: 'lib-select-field',
38
- standalone: true,
39
- imports: [MatFormFieldModule, MatSelectModule, ScrollingModule, MatInputModule, MatIconModule, LibCheckboxComponent],
40
- templateUrl: './select-field.html',
41
- styleUrl: './select-field.css',
42
- providers: [
43
- {
44
- provide: NG_VALUE_ACCESSOR,
45
- useExisting: forwardRef(() => LibSelectFieldComponent),
46
- multi: true,
47
- },
48
- ],
49
- changeDetection: ChangeDetectionStrategy.OnPush,
50
- })
51
- export class LibSelectFieldComponent<T = string> implements ControlValueAccessor, OnInit {
52
- private static readonly PANEL_CONTENT_HEIGHT = 240;
53
- private static readonly FILTER_ROW_HEIGHT = 48;
54
- private static readonly OPTION_ROW_HEIGHT = 48;
55
-
56
- private readonly cdr = inject(ChangeDetectorRef);
57
- private readonly destroyRef = inject(DestroyRef);
58
- private readonly injector = inject(Injector);
59
- private ngControl: NgControl | null = null;
60
-
61
- readonly label = input('');
62
- readonly appearance = input<'outline' | 'filled'>('outline');
63
- readonly placeholder = input('Elegir opción');
64
- readonly options = input<LibSelectOption<T>[]>([]);
65
- readonly mode = input<LibSelectMode>('single');
66
- readonly filterable = input(true, { transform: coerceBooleanProperty });
67
- readonly filterPlaceholder = input('Buscar...');
68
- readonly disabled = input(false, { transform: coerceBooleanProperty });
69
- readonly required = input(false, { transform: coerceBooleanProperty });
70
- readonly width = input<string | number | null>(null);
71
- readonly selectAllLabel = input('Seleccionar todos');
72
- readonly widthStyle = computed(() => {
73
- const v = this.width();
74
- return v == null || v === '' ? null : typeof v === 'number' ? `${v}px` : String(v);
75
- });
76
- readonly matAppearance = computed<MatFormFieldAppearance>(() =>
77
- this.appearance() === 'filled' ? 'fill' : 'outline'
78
- );
79
-
80
- readonly valueChange = output<T | T[]>();
81
-
82
- readonly panelOpen = signal(false);
83
- readonly filterTerm = signal('');
84
- readonly disabledByControl = signal(false);
85
-
86
- readonly isMultiple = computed(() => this.mode() === 'multiple');
87
- readonly virtualViewportMaxHeight = computed(() =>
88
- this.filterable()
89
- ? LibSelectFieldComponent.PANEL_CONTENT_HEIGHT - LibSelectFieldComponent.FILTER_ROW_HEIGHT
90
- : LibSelectFieldComponent.PANEL_CONTENT_HEIGHT
91
- );
92
-
93
- readonly filteredOptions = computed(() => {
94
- const opts = this.options();
95
- const term = this.filterTerm().trim().toLowerCase();
96
- if (!term) return opts;
97
- return opts.filter(
98
- (o) => o.label.toLowerCase().includes(term)
99
- );
100
- });
101
-
102
- readonly virtualRows = computed<VirtualRow<T>[]>(() => {
103
- const rows: VirtualRow<T>[] = this.filteredOptions().map((option) => ({
104
- kind: 'option',
105
- option,
106
- }));
107
-
108
- if (this.isMultiple()) {
109
- rows.unshift({ kind: 'selectAll' });
110
- }
111
-
112
- return rows;
113
- });
114
-
115
- readonly virtualViewportHeight = computed(() => {
116
- const rowsCount = this.virtualRows().length;
117
- const contentHeight = rowsCount * LibSelectFieldComponent.OPTION_ROW_HEIGHT;
118
- const maxHeight = this.virtualViewportMaxHeight();
119
- const minHeight = rowsCount > 0 ? LibSelectFieldComponent.OPTION_ROW_HEIGHT : 0;
120
-
121
- return Math.max(minHeight, Math.min(contentHeight, maxHeight));
122
- });
123
-
124
- readonly allSelected = computed(() => {
125
- if (!this.isMultiple()) {
126
- return false;
127
- }
128
- const opts = this.options();
129
- const current = this.value();
130
- if (!Array.isArray(current) || !opts.length) {
131
- return false;
132
- }
133
- const values = opts.map((o) => o.value);
134
- return values.every((v) => current.includes(v));
135
- });
136
-
137
- readonly selectedLabels = computed(() => {
138
- const current = this.value();
139
- if (!Array.isArray(current) || !current.length) {
140
- return [] as string[];
141
- }
142
- const selectedSet = new Set(current);
143
- return this.options()
144
- .filter((o) => selectedSet.has(o.value))
145
- .map((o) => o.label);
146
- });
147
-
148
- readonly multiTriggerLabel = computed(() => {
149
- const labels = this.selectedLabels();
150
- if (!labels.length) {
151
- return '';
152
- }
153
- if (labels.length === 1) {
154
- return labels[0];
155
- }
156
- return `${labels[0]} (+${labels.length - 1} items)`;
157
- });
158
-
159
- readonly selectAllIndeterminate = computed(() => {
160
- if (!this.isMultiple()) {
161
- return false;
162
- }
163
- const opts = this.options();
164
- const current = this.value();
165
- if (!Array.isArray(current) || !opts.length) {
166
- return false;
167
- }
168
- const selectedCount = opts.filter((o) => current.includes(o.value)).length;
169
- return selectedCount > 0 && selectedCount < opts.length;
170
- });
171
-
172
- private readonly value = signal<T | T[] | null>(null);
173
- private onChange: (v: T | T[] | null) => void = () => {
174
- /* assigned by registerOnChange */
175
- };
176
- private onTouched: () => void = () => {
177
- /* assigned by registerOnTouched */
178
- };
179
-
180
- ngOnInit(): void {
181
- this.ngControl = this.injector.get(NgControl, null);
182
- if (this.ngControl) {
183
- this.ngControl.valueAccessor = this;
184
- }
185
- if (this.ngControl?.valueChanges) {
186
- this.ngControl.valueChanges
187
- .pipe(takeUntilDestroyed(this.destroyRef))
188
- .subscribe(() => this.cdr.markForCheck());
189
- }
190
- }
191
-
192
- onPanelOpenChange(open: boolean): void {
193
- this.panelOpen.set(open);
194
- if (!open) this.filterTerm.set('');
195
- this.cdr.markForCheck();
196
- }
197
-
198
- onFilterInput(event: Event): void {
199
- const el = event.target as HTMLInputElement;
200
- this.filterTerm.set(el?.value ?? '');
201
- }
202
-
203
- onFilterKeydown(event: KeyboardEvent): void {
204
- event.stopPropagation();
205
- }
206
-
207
- onSelectionChange(change: MatSelectChange): void {
208
- if (this.isMultiple()) {
209
- const incoming = Array.isArray(change.value) ? (change.value as T[]) : [];
210
- const options = this.options().map((o) => o.value);
211
- const optionSet = new Set(options);
212
- const hasUnknownValues = incoming.some((v) => !optionSet.has(v));
213
-
214
- // Ignore synthetic values emitted by the auxiliary "select all" option.
215
- if (hasUnknownValues) {
216
- this.cdr.markForCheck();
217
- return;
218
- }
219
-
220
- const incomingSet = new Set(incoming);
221
- const normalized = options.filter((v) => incomingSet.has(v)) as T[];
222
- this.value.set(normalized);
223
- this.onChange(normalized);
224
- this.valueChange.emit(normalized);
225
- this.cdr.markForCheck();
226
- return;
227
- }
228
-
229
- this.value.set(change.value);
230
- this.onChange(change.value);
231
- this.valueChange.emit(change.value);
232
- this.cdr.markForCheck();
233
- }
234
-
235
- onToggleSelectAll(checked: boolean): void {
236
- if (!this.isMultiple()) {
237
- return;
238
- }
239
- const options = this.options();
240
- const currentValue = this.value();
241
- const current = Array.isArray(currentValue) ? [...currentValue] : [];
242
- if (checked) {
243
- const toAdd = options.map((o) => o.value);
244
- const set = new Set(current);
245
- for (const v of toAdd) {
246
- set.add(v);
247
- }
248
- this.value.set(Array.from(set) as T[]);
249
- } else {
250
- const toRemove = new Set(options.map((o) => o.value));
251
- this.value.set(current.filter((v) => !toRemove.has(v as T)) as T[]);
252
- }
253
- const updated = this.value();
254
- this.onChange(updated);
255
- this.valueChange.emit(updated as T | T[]);
256
- this.cdr.markForCheck();
257
- }
258
-
259
- onSelectAllCheckedChange(checked: boolean): void {
260
- this.onToggleSelectAll(checked);
261
- }
262
-
263
- onOptionCheckedChange(value: T, checked: boolean): void {
264
- if (!this.isMultiple()) {
265
- return;
266
- }
267
- const currentValue = this.value();
268
- const current = Array.isArray(currentValue) ? [...currentValue] : [];
269
- const set = new Set(current);
270
- if (checked) {
271
- set.add(value);
272
- } else {
273
- set.delete(value);
274
- }
275
- this.value.set(Array.from(set) as T[]);
276
- const updated = this.value();
277
- this.onChange(updated);
278
- this.valueChange.emit(updated as T | T[]);
279
- this.cdr.markForCheck();
280
- }
281
-
282
- writeValue(value: T | T[] | null): void {
283
- this.value.set(value);
284
- this.cdr.markForCheck();
285
- }
286
-
287
- registerOnChange(fn: (v: T | T[] | null) => void): void {
288
- this.onChange = fn;
289
- }
290
-
291
- registerOnTouched(fn: () => void): void {
292
- this.onTouched = fn;
293
- }
294
-
295
- setDisabledState(isDisabled: boolean): void {
296
- this.disabledByControl.set(isDisabled);
297
- this.cdr.markForCheck();
298
- }
299
-
300
- get displayValue(): T | T[] | null {
301
- return this.value();
302
- }
303
-
304
- toggledAllSelection(){
305
- if (this.allSelected()) {
306
- this.onToggleSelectAll(false);
307
- return;
308
- }
309
- this.onToggleSelectAll(true);
310
- }
311
-
312
-
313
- isSelected(value: T): boolean {
314
- const current = this.value();
315
- if (!Array.isArray(current)) {
316
- return false;
317
- }
318
- return current.includes(value);
319
- }
320
-
321
- trackByVirtualRow(_index: number, row: VirtualRow<T>): string {
322
- return row.kind === 'selectAll' ? '__select-all__' : String(row.option.value);
323
- }
324
- }
@@ -1,41 +0,0 @@
1
- :host {
2
- display: block;
3
- }
4
-
5
- .lib-text-field__field {
6
- width: 100%;
7
- }
8
-
9
- .lib-text-field__prefix-image {
10
- width: 24px;
11
- height: 24px;
12
- font-size: 24px;
13
- overflow: visible;
14
- }
15
-
16
- .lib-text-field__prefix-image svg {
17
- width: 24px;
18
- height: 24px;
19
- }
20
-
21
- :host[data-state='error'] ::ng-deep .mat-mdc-form-field,
22
- :host[data-state='error-hover'] ::ng-deep .mat-mdc-form-field,
23
- :host[data-state='error-focus'] ::ng-deep .mat-mdc-form-field {
24
- --mdc-outlined-text-field-outline-color: var(--text-fields-outlined-error-outline-outlined-text-field-error-outline-color, #ba1a1a);
25
- --mdc-outlined-text-field-hover-outline-color: var(--text-fields-outlined-error-hover-outlined-text-field-error-hover-outline-color, #ba1a1a);
26
- --mdc-outlined-text-field-focus-outline-color: var(--text-fields-outlined-error-focus-outlined-text-field-error-focus-outline-color, #ba1a1a);
27
- --mdc-outlined-text-field-label-text-color: var(--text-fields-outlined-error-outline-outlined-text-field-error-outline-color, #ba1a1a);
28
- --mdc-filled-text-field-active-indicator-color: var(--text-fields-outlined-error-outline-outlined-text-field-error-outline-color, #ba1a1a);
29
- --mdc-filled-text-field-focus-active-indicator-color: var(--text-fields-outlined-error-focus-outlined-text-field-error-focus-outline-color, #ba1a1a);
30
- --mdc-filled-text-field-label-text-color: var(--text-fields-outlined-error-outline-outlined-text-field-error-outline-color, #ba1a1a);
31
- }
32
-
33
- .lib-text-field__field textarea.mat-mdc-input-element {
34
- resize: none;
35
- }
36
-
37
- /* Hide browser-provided password reveal/clear controls to avoid duplicate icons. */
38
- :host ::ng-deep input[type='password']::-ms-reveal,
39
- :host ::ng-deep input[type='password']::-ms-clear {
40
- display: none;
41
- }
@@ -1,38 +0,0 @@
1
- <mat-form-field [appearance]="resolvedAppearance()" [style.width]="widthStyle() ?? null" [hideRequiredMarker]="hideRequiredMarker()">
2
- @if(prefixIconSrc()){
3
- <mat-icon
4
- matPrefix
5
- class="lib-text-field__prefix-image"
6
- [svgIcon]="prefixIconSrc()"
7
- (click)="pressSuffixEvent()"
8
- >
9
- {{ prefixIconSrc() }}
10
- </mat-icon>
11
- } @else if(resolvedPrefixIcon()){
12
- <mat-icon matPrefix>
13
- {{ resolvedPrefixIcon() }}
14
- </mat-icon>
15
- }
16
-
17
- <mat-label>{{ label() }}</mat-label>
18
- <input matInput [type]="type()" [formControl]="control()" [placeholder]="placeholder()" [attr.autocomplete]="autocomplete()" />
19
-
20
- @if(shouldShowError() && error()) {
21
- <mat-error>{{ error() }}</mat-error>
22
- }
23
-
24
- @if(hint()) {
25
- <mat-hint>{{ hint() }}</mat-hint>
26
- }
27
-
28
- @if(shouldShowSuffix()) {
29
- <mat-icon
30
- matSuffix
31
- class="lib-text-field__icon lib-text-field__icon--suffix"
32
- [svgIcon]="suffixIcon()"
33
- (click)="pressSuffixEvent()"
34
- >
35
- {{ suffixTextIcon() }}
36
- </mat-icon>
37
- }
38
- </mat-form-field>