tailjng 0.1.6 → 0.1.7

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 (176) hide show
  1. package/README.md +12 -4
  2. package/cli/execute/init-app.js +5 -2
  3. package/cli/execute/sync-app.js +14 -2
  4. package/cli/settings/colors-config-utils.js +43 -8
  5. package/cli/settings/icons-config-utils.js +62 -0
  6. package/cli/settings/path-utils.js +32 -2
  7. package/cli/settings/project-utils.js +7 -1
  8. package/cli/templates/app.generator.js +2 -2
  9. package/fesm2022/tailjng.mjs +247 -80
  10. package/fesm2022/tailjng.mjs.map +1 -1
  11. package/lib/services/static/theme.service.d.ts +39 -1
  12. package/lib/utils/theme/theme-variables.util.d.ts +31 -0
  13. package/package.json +1 -1
  14. package/public-api.d.ts +2 -1
  15. package/registry/components.json +41 -18
  16. package/src/colors.safelist.css +2 -2
  17. package/src/lib/components/.config/README.md +11 -0
  18. package/src/lib/components/.config/colors/README.md +38 -0
  19. package/src/lib/components/{colors-config → .config/colors}/colors.config.ts +5 -5
  20. package/src/lib/components/{colors-config → .config/colors}/colors.safelist.css +2 -2
  21. package/src/lib/components/.config/icons/README.md +26 -0
  22. package/src/lib/components/.config/icons/icons.lucide.ts +134 -0
  23. package/src/lib/components/.config/input/README.md +24 -0
  24. package/src/lib/components/.config/input/input.classes.ts +119 -0
  25. package/src/lib/components/alert/alert-dialog/dialog-alert.component.css +244 -2
  26. package/src/lib/components/alert/alert-dialog/dialog-alert.component.html +25 -38
  27. package/src/lib/components/alert/alert-dialog/dialog-alert.component.ts +66 -56
  28. package/src/lib/components/alert/alert-dialog/dialog-alert.types.ts +19 -0
  29. package/src/lib/components/alert/alert-toast/toast-alert.component.css +630 -12
  30. package/src/lib/components/alert/alert-toast/toast-alert.component.html +103 -102
  31. package/src/lib/components/alert/alert-toast/toast-alert.component.ts +485 -128
  32. package/src/lib/components/alert/alert-toast/toast-alert.types.ts +25 -0
  33. package/src/lib/components/badge/badge.component.html +34 -21
  34. package/src/lib/components/badge/badge.component.ts +140 -31
  35. package/src/lib/components/button/button.component.html +16 -10
  36. package/src/lib/components/button/button.component.ts +162 -22
  37. package/src/lib/components/card/card-complete/complete-card.component.html +2 -2
  38. package/src/lib/components/card/card-complete/complete-card.component.ts +26 -16
  39. package/src/lib/components/card/card-crud-complete/complete-crud-card.component.html +2 -2
  40. package/src/lib/components/card/card-crud-complete/complete-crud-card.component.ts +26 -16
  41. package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.css +97 -0
  42. package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.html +54 -46
  43. package/src/lib/components/checkbox/checkbox-input/input-checkbox.component.ts +135 -64
  44. package/src/lib/components/checkbox/checkbox-input/input-checkbox.types.ts +3 -0
  45. package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.css +112 -0
  46. package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.html +28 -25
  47. package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.component.ts +67 -15
  48. package/src/lib/components/checkbox/checkbox-switch/switch-checkbox.types.ts +1 -0
  49. package/src/lib/components/coach-mark/coach-mark.component.html +4 -22
  50. package/src/lib/components/coach-mark/coach-mark.component.scss +1 -1
  51. package/src/lib/components/coach-mark/coach-mark.component.ts +51 -18
  52. package/src/lib/components/coach-mark/coach-mark.directive.ts +133 -78
  53. package/src/lib/components/coach-mark/coach-mark.types.ts +12 -0
  54. package/src/lib/components/dialog/dialog.component.css +103 -1
  55. package/src/lib/components/dialog/dialog.component.html +46 -66
  56. package/src/lib/components/dialog/dialog.component.ts +136 -110
  57. package/src/lib/components/dialog/dialog.types.ts +19 -0
  58. package/src/lib/components/filter/filter-complete/complete-filter.component.html +16 -19
  59. package/src/lib/components/filter/filter-complete/complete-filter.component.scss +35 -0
  60. package/src/lib/components/filter/filter-complete/complete-filter.component.ts +58 -34
  61. package/src/lib/components/filter/filter-complete/complete-filter.types.ts +7 -0
  62. package/src/lib/components/filter/filter-complete/complete-filter.util.ts +16 -0
  63. package/src/lib/components/form/form-container/container-form.component.css +4 -0
  64. package/src/lib/components/form/form-container/container-form.component.html +2 -2
  65. package/src/lib/components/form/form-container/container-form.component.ts +72 -16
  66. package/src/lib/components/form/form-container/container-form.types.ts +42 -0
  67. package/src/lib/components/form/form-container/form-col-span.directive.ts +25 -0
  68. package/src/lib/components/form/form-sidebar/sidebar-form.component.css +276 -0
  69. package/src/lib/components/form/form-sidebar/sidebar-form.component.html +117 -125
  70. package/src/lib/components/form/form-sidebar/sidebar-form.component.ts +109 -34
  71. package/src/lib/components/form/form-sidebar/sidebar-form.types.ts +3 -0
  72. package/src/lib/components/{toggle-radio/toggle-radio.component.css → form/form-validation/validation-form.component.css} +0 -1
  73. package/src/lib/components/form/form-validation/validation-form.component.html +10 -6
  74. package/src/lib/components/form/form-validation/validation-form.component.ts +99 -12
  75. package/src/lib/components/form/form-validation/validation-form.types.ts +33 -0
  76. package/src/lib/components/icon/icon.component.html +8 -5
  77. package/src/lib/components/icon/icon.component.ts +111 -9
  78. package/src/lib/components/input/input/input.component.html +19 -16
  79. package/src/lib/components/input/input/input.component.ts +130 -53
  80. package/src/lib/components/input/input/input.types.ts +8 -0
  81. package/src/lib/components/input/input-file/file-input.component.html +65 -56
  82. package/src/lib/components/input/input-file/file-input.component.ts +276 -173
  83. package/src/lib/components/input/input-file/file-input.types.ts +2 -0
  84. package/src/lib/components/input/input-range/range-input.component.css +67 -0
  85. package/src/lib/components/input/input-range/range-input.component.html +50 -58
  86. package/src/lib/components/input/input-range/range-input.component.ts +148 -60
  87. package/src/lib/components/input/input-range/range-input.types.ts +7 -0
  88. package/src/lib/components/input/input-textarea/textarea-input.component.html +16 -7
  89. package/src/lib/components/input/input-textarea/textarea-input.component.ts +140 -50
  90. package/src/lib/components/input/input-textarea/textarea-input.types.ts +2 -0
  91. package/src/lib/components/label/label.component.html +17 -16
  92. package/src/lib/components/label/label.component.ts +70 -16
  93. package/src/lib/components/label/label.types.ts +2 -0
  94. package/src/lib/components/menu/menu-options-table/menu-options-defaults.ts +34 -0
  95. package/src/lib/components/menu/menu-options-table/options-table-menu.component.html +34 -20
  96. package/src/lib/components/menu/menu-options-table/options-table-menu.component.ts +211 -58
  97. package/src/lib/components/menu/menu-options-table/options-table-menu.types.ts +38 -0
  98. package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.html +49 -52
  99. package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.ts +112 -24
  100. package/src/lib/components/menu/options-coach-menu/options-coach-menu.types.ts +9 -0
  101. package/src/lib/components/mode-toggle/mode-toggle.component.html +11 -16
  102. package/src/lib/components/mode-toggle/mode-toggle.component.ts +69 -33
  103. package/src/lib/components/paginator/paginator-complete/complete-paginator.component.html +4 -4
  104. package/src/lib/components/paginator/paginator-complete/complete-paginator.component.ts +31 -7
  105. package/src/lib/components/paginator/paginator-complete/complete-paginator.types.ts +12 -0
  106. package/src/lib/components/paginator/paginator-complete/complete-paginator.util.ts +36 -0
  107. package/src/lib/components/progress-bar/progress-bar.component.css +11 -0
  108. package/src/lib/components/progress-bar/progress-bar.component.html +41 -40
  109. package/src/lib/components/progress-bar/progress-bar.component.ts +95 -11
  110. package/src/lib/components/progress-bar/progress-bar.types.ts +2 -0
  111. package/src/lib/components/select/select-dropdown/dropdown-select.component.css +6 -0
  112. package/src/lib/components/select/select-dropdown/dropdown-select.component.html +54 -44
  113. package/src/lib/components/select/select-dropdown/dropdown-select.component.ts +450 -509
  114. package/src/lib/components/select/select-dropdown/dropdown-select.types.ts +43 -0
  115. package/src/lib/components/select/select-dropdown/dropdown-select.util.ts +179 -0
  116. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.css +6 -0
  117. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.html +131 -42
  118. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.component.ts +491 -475
  119. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.types.ts +22 -0
  120. package/src/lib/components/select/select-multi-dropdown/multi-dropdown-select.util.ts +20 -0
  121. package/src/lib/components/select/select-multi-table/multi-table-select.component.css +10 -0
  122. package/src/lib/components/select/select-multi-table/multi-table-select.component.html +76 -60
  123. package/src/lib/components/select/select-multi-table/multi-table-select.component.ts +250 -313
  124. package/src/lib/components/select/select-multi-table/multi-table-select.types.ts +10 -0
  125. package/src/lib/components/select/select-multi-table/multi-table-select.util.ts +5 -0
  126. package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.css +212 -0
  127. package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.html +62 -53
  128. package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.ts +84 -27
  129. package/src/lib/components/sidebar/sidebar-static/static-sidebar.types.ts +2 -0
  130. package/src/lib/components/table/table-complete/complete-table.component.html +15 -17
  131. package/src/lib/components/table/table-complete/complete-table.component.ts +190 -338
  132. package/src/lib/components/table/table-complete/complete-table.types.ts +28 -0
  133. package/src/lib/components/table/table-complete/complete-table.util.ts +236 -0
  134. package/src/lib/components/table/table-complete/index.ts +2 -0
  135. package/src/lib/components/table/table-crud-complete/complete-crud-table.animations.ts +34 -0
  136. package/src/lib/components/table/table-crud-complete/complete-crud-table.component.html +73 -128
  137. package/src/lib/components/table/table-crud-complete/complete-crud-table.component.ts +542 -829
  138. package/src/lib/components/table/table-crud-complete/complete-crud-table.types.ts +57 -0
  139. package/src/lib/components/table/table-crud-complete/complete-crud-table.util.ts +723 -0
  140. package/src/lib/components/table/table-crud-complete/index.ts +3 -0
  141. package/src/lib/components/theme-generator/theme-generator.component.css +21 -0
  142. package/src/lib/components/theme-generator/theme-generator.component.html +146 -116
  143. package/src/lib/components/theme-generator/theme-generator.component.ts +44 -24
  144. package/src/lib/components/toggle-radio/shared/toggle-options.types.ts +8 -0
  145. package/src/lib/components/toggle-radio/shared/toggle-options.util.ts +44 -0
  146. package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.css +135 -0
  147. package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.html +52 -0
  148. package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.component.ts +198 -0
  149. package/src/lib/components/toggle-radio/toggle-radio/toggle-radio.types.ts +1 -0
  150. package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.css +108 -0
  151. package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.html +37 -0
  152. package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.component.ts +193 -0
  153. package/src/lib/components/toggle-radio/toggle-segment/segment-toggle.types.ts +1 -0
  154. package/src/lib/components/tooltip/tooltip.directive.ts +12 -9
  155. package/src/lib/components/tooltip/tooltip.service.ts +331 -133
  156. package/src/lib/components/tooltip/tooltip.types.ts +9 -0
  157. package/src/lib/components/viewer/viewer-image/image-viewer.component.css +90 -4
  158. package/src/lib/components/viewer/viewer-image/image-viewer.component.html +52 -103
  159. package/src/lib/components/viewer/viewer-image/image-viewer.component.ts +182 -177
  160. package/src/lib/components/viewer/viewer-image/image-viewer.types.ts +3 -0
  161. package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.css +177 -0
  162. package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.html +74 -24
  163. package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.ts +168 -15
  164. package/src/lib/components/viewer/viewer-pdf/pdf-viewer.types.ts +1 -0
  165. package/src/styles.css +2 -2
  166. package/lib/services/static/icons.service.d.ts +0 -65
  167. package/src/lib/components/colors-config/README.md +0 -38
  168. package/src/lib/components/form/form-sidebar/sidebar-form.component.scss +0 -0
  169. package/src/lib/components/form/form-validation/validation-form.component.scss +0 -0
  170. package/src/lib/components/menu/menu-options-table/options-table-menu.component.scss +0 -0
  171. package/src/lib/components/menu/options-coach-menu/options-coach-menu.component.scss +0 -12
  172. package/src/lib/components/sidebar/sidebar-static/static-sidebar.component.scss +0 -0
  173. package/src/lib/components/toggle-radio/toggle-radio.component.html +0 -51
  174. package/src/lib/components/toggle-radio/toggle-radio.component.ts +0 -222
  175. package/src/lib/components/viewer/viewer-pdf/pdf-viewer.component.scss +0 -0
  176. package/tailjng-0.1.6.tgz +0 -0
@@ -0,0 +1,10 @@
1
+ import type { TableColumn } from 'tailjng';
2
+
3
+ /** Payload emitted when one column visibility is toggled. */
4
+ export type MultiTableSelectColumnToggleEvent<T = unknown> = {
5
+ column: TableColumn<T>;
6
+ visible: boolean;
7
+ };
8
+
9
+ /** Extra Tailwind classes applied to the trigger button. */
10
+ export type MultiTableSelectNgClasses = Record<string, boolean>;
@@ -0,0 +1,5 @@
1
+ export {
2
+ DROPDOWN_PANEL_DEFAULTS,
3
+ positionDropdownPanel,
4
+ resetDropdownPanelStyles,
5
+ } from '../select-dropdown/dropdown-select.util';
@@ -0,0 +1,212 @@
1
+ :host {
2
+ display: contents;
3
+ }
4
+
5
+ .j-sidebar-overlay {
6
+ position: fixed;
7
+ inset: 0;
8
+ z-index: 998;
9
+ background-color: rgb(0 0 0 / 0.5);
10
+ backdrop-filter: blur(1px);
11
+ animation: j-sidebar-overlay-in 300ms ease-out;
12
+ }
13
+
14
+ @keyframes j-sidebar-overlay-in {
15
+ from {
16
+ opacity: 0;
17
+ }
18
+
19
+ to {
20
+ opacity: 1;
21
+ }
22
+ }
23
+
24
+ .j-sidebar {
25
+ position: fixed;
26
+ top: 0;
27
+ z-index: 999;
28
+ display: flex;
29
+ flex-direction: column;
30
+ max-width: 100%;
31
+ height: 100%;
32
+ overflow: hidden;
33
+ border: 1px solid var(--color-border);
34
+ background-color: var(--color-background);
35
+ }
36
+
37
+ .j-sidebar--right {
38
+ right: 0;
39
+ border-right: 0;
40
+ border-radius: 0.75rem 0 0 0.75rem;
41
+ box-shadow: -8px 0 32px rgb(0 0 0 / 0.12);
42
+ }
43
+
44
+ .j-sidebar--left {
45
+ left: 0;
46
+ border-left: 0;
47
+ border-radius: 0 0.75rem 0.75rem 0;
48
+ box-shadow: 8px 0 32px rgb(0 0 0 / 0.12);
49
+ }
50
+
51
+ :host-context(.dark) .j-sidebar,
52
+ :host-context(html.dark) .j-sidebar {
53
+ border-color: var(--color-dark-border);
54
+ background-color: var(--color-dark-background);
55
+ }
56
+
57
+ :host-context(.dark) .j-sidebar--right,
58
+ :host-context(html.dark) .j-sidebar--right {
59
+ box-shadow: -8px 0 32px rgb(0 0 0 / 0.35);
60
+ }
61
+
62
+ :host-context(.dark) .j-sidebar--left,
63
+ :host-context(html.dark) .j-sidebar--left {
64
+ box-shadow: 8px 0 32px rgb(0 0 0 / 0.35);
65
+ }
66
+
67
+ .j-sidebar--small {
68
+ width: 22em;
69
+ }
70
+
71
+ .j-sidebar--medium {
72
+ width: 30em;
73
+ }
74
+
75
+ .j-sidebar--large {
76
+ width: 47em;
77
+ }
78
+
79
+ .j-sidebar--xlarge {
80
+ width: 65em;
81
+ }
82
+
83
+ .j-sidebar-header {
84
+ display: flex;
85
+ align-items: center;
86
+ gap: 0.75rem;
87
+ min-height: 3.25rem;
88
+ padding: 0.625rem 0.75rem 0.625rem 1rem;
89
+ border-bottom: 1px solid var(--color-border);
90
+ background: linear-gradient(
91
+ 180deg,
92
+ color-mix(in srgb, var(--color-muted) 28%, var(--color-background)) 0%,
93
+ var(--color-background) 100%
94
+ );
95
+ flex-shrink: 0;
96
+ }
97
+
98
+ :host-context(.dark) .j-sidebar-header,
99
+ :host-context(html.dark) .j-sidebar-header {
100
+ border-bottom-color: var(--color-dark-border);
101
+ background: linear-gradient(
102
+ 180deg,
103
+ color-mix(in srgb, var(--color-dark-muted) 35%, var(--color-dark-background)) 0%,
104
+ var(--color-dark-background) 100%
105
+ );
106
+ }
107
+
108
+ .j-sidebar-title {
109
+ flex: 1;
110
+ min-width: 0;
111
+ margin: 0;
112
+ font-size: 0.9375rem;
113
+ font-weight: 600;
114
+ line-height: 1.3;
115
+ letter-spacing: -0.015em;
116
+ color: var(--color-foreground);
117
+ white-space: nowrap;
118
+ overflow: hidden;
119
+ text-overflow: ellipsis;
120
+ }
121
+
122
+ .j-sidebar-title--placeholder {
123
+ min-height: 1.25rem;
124
+ }
125
+
126
+ :host-context(.dark) .j-sidebar-title,
127
+ :host-context(html.dark) .j-sidebar-title {
128
+ color: var(--color-dark-foreground);
129
+ }
130
+
131
+ .j-sidebar-header-actions {
132
+ display: inline-flex;
133
+ align-items: center;
134
+ gap: 0.5rem;
135
+ flex-shrink: 0;
136
+ }
137
+
138
+ .j-sidebar-close {
139
+ display: inline-flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 2rem;
143
+ height: 2rem;
144
+ flex: 0 0 2rem;
145
+ margin: 0;
146
+ padding: 0;
147
+ border: 0;
148
+ border-radius: 0.375rem;
149
+ background-color: transparent;
150
+ color: var(--color-muted-foreground);
151
+ line-height: 0;
152
+ cursor: pointer;
153
+ transition:
154
+ color 0.15s ease,
155
+ background-color 0.15s ease,
156
+ transform 0.15s ease;
157
+ }
158
+
159
+ .j-sidebar-close:hover {
160
+ color: var(--color-foreground);
161
+ background-color: color-mix(in srgb, var(--color-muted) 55%, transparent);
162
+ }
163
+
164
+ .j-sidebar-close:active {
165
+ transform: scale(0.94);
166
+ }
167
+
168
+ .j-sidebar-close:focus-visible {
169
+ outline: 2px solid var(--color-ring);
170
+ outline-offset: 2px;
171
+ }
172
+
173
+ :host-context(.dark) .j-sidebar-close,
174
+ :host-context(html.dark) .j-sidebar-close {
175
+ color: var(--color-dark-muted-foreground);
176
+ }
177
+
178
+ :host-context(.dark) .j-sidebar-close:hover,
179
+ :host-context(html.dark) .j-sidebar-close:hover {
180
+ color: var(--color-dark-foreground);
181
+ background-color: color-mix(in srgb, var(--color-dark-muted) 50%, transparent);
182
+ }
183
+
184
+ .j-sidebar-body {
185
+ flex: 1 1 auto;
186
+ min-height: 0;
187
+ padding: 1rem;
188
+ overflow-x: hidden;
189
+ overflow-y: auto;
190
+ color: var(--color-foreground);
191
+ }
192
+
193
+ :host-context(.dark) .j-sidebar-body,
194
+ :host-context(html.dark) .j-sidebar-body {
195
+ color: var(--color-dark-foreground);
196
+ }
197
+
198
+ @media (max-width: 767px) {
199
+ .j-sidebar {
200
+ width: 100% !important;
201
+ max-width: 100%;
202
+ border-radius: 0;
203
+ }
204
+
205
+ .j-sidebar--right {
206
+ border-left: 0;
207
+ }
208
+
209
+ .j-sidebar--left {
210
+ border-right: 0;
211
+ }
212
+ }
@@ -1,60 +1,69 @@
1
- <section class="content_form">
1
+ @if (openSidebar) {
2
+ <div
3
+ class="j-sidebar-overlay"
4
+ aria-hidden="true"
5
+ (click)="onOverlayClick()"
6
+ ></div>
7
+ }
2
8
 
3
- <!-- Overlay -->
4
- @if (openSidebar) {
5
- <div onKeyPress class="fixed top-0 left-0 w-full h-full bg-black/50 z-[998] transition duration-300" (click)="canCloseOverlay ? onClose() : null"></div>
9
+ <ng-template #sidebarContent>
10
+ <header class="j-sidebar-header">
11
+ @if (titleForm) {
12
+ <h2 class="j-sidebar-title">{{ titleForm }}</h2>
13
+ } @else {
14
+ <span class="j-sidebar-title j-sidebar-title--placeholder"></span>
6
15
  }
7
16
 
8
- <!-- Sidebar personalizado -->
9
- @if (openSidebar) {
10
- <div @sidebarTransition
11
- class="fixed top-0 right-0 h-full max-w-full border border-border dark:border-dark-border rounded-tl-[15px] rounded-bl-[15px] text-white shadow-lg z-[999] flex flex-col"
12
- [style]="style"
13
- [ngClass]="bgColor"
14
- [class.w-[22em]]="size==='small'"
15
- [class.w-[30em]]="size==='medium'"
16
- [class.w-[47em]]="size==='large'"
17
- [class.w-[65em]]="size==='xlarge'"
18
- >
19
- <!-- Header -->
20
- @if (titleForm) {
21
- <div class="flex p-2 pl-4 pr-4 justify-between items-center bg-primary dark:bg-dark-primary border-b border-border dark:border-dark-border rounded-tl-[15px] font-semibold text-2sm">
22
- <div class="flex items-center gap-2">
23
- <span>
24
- {{ titleForm }}
25
- </span>
26
- </div>
27
-
28
-
29
-
30
- <div class="flex gap-2">
31
- @for (cb of checkboxes; track $index) {
32
- @if (cb.isVisible) {
33
- <JSwitchCheckbox onKeyPress
34
- [title]="cb.title"
35
- [isChecked]="cb.isChecked"
36
- [isLoading]="cb.isLoading"
37
- (click)="cb.onClick(!cb.isChecked, $index)"
38
- />
39
- }
40
- }
41
- </div>
42
-
43
- <button type="button" (click)="onClose()" class="p-2 rounded-full border border-border dark:border-dark-border text-white hover:bg-dark-background focus:outline-none cursor-pointer">
44
- <lucide-icon [name]="iconsService.icons.close" size="16"></lucide-icon>
45
- </button>
46
- </div>
47
- }
48
-
49
-
50
- <!-- Content -->
51
- <div class="p-4 flex-1 overflow-x-hidden overflow-y-auto scroll-element">
52
- @if (sidebarTemplate) {
53
- <ng-container [ngTemplateOutlet]="sidebarTemplate"></ng-container>
54
- }
55
- </div>
17
+ <div class="j-sidebar-header-actions">
18
+ @for (cb of visibleCheckboxes; track $index) {
19
+ <JSwitchCheckbox
20
+ [title]="cb.title"
21
+ [isChecked]="cb.isChecked"
22
+ [isLoading]="cb.isLoading"
23
+ (click)="cb.onClick(!cb.isChecked, $index)"
24
+ />
25
+ }
56
26
 
27
+ <button
28
+ type="button"
29
+ class="j-sidebar-close"
30
+ aria-label="Cerrar"
31
+ (click)="onClose()"
32
+ >
33
+ <JIcon [icon]="Icons.X" [size]="18" [inheritParentColor]="true" [ariaHidden]="true" />
34
+ </button>
57
35
  </div>
36
+ </header>
37
+
38
+ <div class="j-sidebar-body scroll-element">
39
+ @if (sidebarTemplate) {
40
+ <ng-container [ngTemplateOutlet]="sidebarTemplate" />
58
41
  }
42
+ </div>
43
+ </ng-template>
44
+
45
+ @if (openSidebar && position === 'left') {
46
+ <aside
47
+ @sidebarTransitionLeft
48
+ role="dialog"
49
+ [attr.aria-modal]="true"
50
+ [attr.aria-label]="titleForm || 'Panel lateral'"
51
+ [ngClass]="panelClasses"
52
+ [ngStyle]="style"
53
+ >
54
+ <ng-container [ngTemplateOutlet]="sidebarContent" />
55
+ </aside>
56
+ }
59
57
 
60
- </section>
58
+ @if (openSidebar && position === 'right') {
59
+ <aside
60
+ @sidebarTransitionRight
61
+ role="dialog"
62
+ [attr.aria-modal]="true"
63
+ [attr.aria-label]="titleForm || 'Panel lateral'"
64
+ [ngClass]="panelClasses"
65
+ [ngStyle]="style"
66
+ >
67
+ <ng-container [ngTemplateOutlet]="sidebarContent" />
68
+ </aside>
69
+ }
@@ -1,53 +1,110 @@
1
- import { CommonModule } from '@angular/common';
2
- import { Component, CUSTOM_ELEMENTS_SCHEMA, EventEmitter, HostListener, Input, Output, TemplateRef } from '@angular/core';
3
- import { animate, style, transition, trigger } from '@angular/animations';
4
- import { LucideAngularModule } from 'lucide-angular';
5
- import { DynamicCheckbox, JIconsService } from 'tailjng';
1
+ import { NgClass, NgStyle, NgTemplateOutlet } from '@angular/common';
2
+ import {
3
+ Component,
4
+ EventEmitter,
5
+ HostListener,
6
+ Input,
7
+ Output,
8
+ TemplateRef,
9
+ } from '@angular/core';
10
+ import { trigger, transition, style, animate } from '@angular/animations';
11
+ import { DynamicCheckbox } from 'tailjng';
12
+ import { Icons } from '../../.config/icons/icons.lucide';
6
13
  import { JSwitchCheckboxComponent } from '../../checkbox/checkbox-switch/switch-checkbox.component';
14
+ import { JIconComponent } from '../../icon/icon.component';
15
+ import { StaticSidebarPosition, StaticSidebarSize } from './static-sidebar.types';
7
16
 
17
+ export type { StaticSidebarPosition, StaticSidebarSize } from './static-sidebar.types';
18
+
19
+ /**
20
+ * Static side panel with overlay, header actions, and template content.
21
+ *
22
+ * Install: `npx tailjng add sidebar-static`
23
+ */
8
24
  @Component({
9
25
  selector: 'JStaticSidebar',
10
- standalone: true,
11
- imports: [LucideAngularModule, CommonModule, JSwitchCheckboxComponent],
26
+ imports: [NgClass, NgStyle, NgTemplateOutlet, JSwitchCheckboxComponent, JIconComponent],
12
27
  templateUrl: './static-sidebar.component.html',
13
- styleUrl: './static-sidebar.component.scss',
14
- schemas: [CUSTOM_ELEMENTS_SCHEMA],
28
+ styleUrl: './static-sidebar.component.css',
15
29
  animations: [
16
- trigger('sidebarTransition', [
30
+ trigger('sidebarTransitionRight', [
17
31
  transition(':enter', [
18
32
  style({ opacity: 0, transform: 'translateX(100%)' }),
19
- animate('300ms ease-out', style({ opacity: 1, transform: 'translateX(0)' }))
33
+ animate('300ms ease-out', style({ opacity: 1, transform: 'translateX(0)' })),
20
34
  ]),
21
35
  transition(':leave', [
22
- animate('200ms ease-in', style({ opacity: 0, transform: 'translateX(100%)' }))
23
- ])
24
- ])
25
- ]
36
+ animate('200ms ease-in', style({ opacity: 0, transform: 'translateX(100%)' })),
37
+ ]),
38
+ ]),
39
+ trigger('sidebarTransitionLeft', [
40
+ transition(':enter', [
41
+ style({ opacity: 0, transform: 'translateX(-100%)' }),
42
+ animate('300ms ease-out', style({ opacity: 1, transform: 'translateX(0)' })),
43
+ ]),
44
+ transition(':leave', [
45
+ animate('200ms ease-in', style({ opacity: 0, transform: 'translateX(-100%)' })),
46
+ ]),
47
+ ]),
48
+ ],
26
49
  })
27
50
  export class JStaticSidebarComponent {
51
+ readonly Icons = Icons;
28
52
 
29
- @Input() openSidebar: boolean = false;
53
+ @Input() openSidebar = false;
30
54
  @Output() closeSidebar = new EventEmitter<void>();
31
55
 
32
- @Input() sidebarTemplate!: TemplateRef<any>;
56
+ @Input() sidebarTemplate!: TemplateRef<unknown>;
33
57
  @Input() titleForm: string | null = null;
34
58
 
35
59
  @Input() checkboxes: DynamicCheckbox[] = [];
36
- @Input() size: 'small' | 'medium' | 'large' | 'xlarge' = 'medium';
37
- @Input() bgColor: string = 'bg-white dark:bg-foreground';
38
- @Input() style: { [key: string]: any } = {};
39
- @Input() isLoading: boolean = false;
40
- @Input() canCloseOverlay: boolean = true;
60
+ @Input() size: StaticSidebarSize = 'medium';
61
+ /** Panel edge to slide in from. Defaults to right for backward compatibility. */
62
+ @Input() position: StaticSidebarPosition = 'right';
63
+ /** @deprecated Prefer theme defaults — extra Tailwind classes on the panel shell. */
64
+ @Input() bgColor = '';
65
+ @Input() style: Record<string, unknown> = {};
66
+ @Input() isLoading = false;
67
+ @Input() canCloseOverlay = true;
68
+ @Input() closeOnEscape = true;
69
+ @Input() ngClasses: Record<string, boolean> = {};
41
70
 
42
- constructor(public readonly iconsService: JIconsService) { }
71
+ /**
72
+ * Checkboxes flagged as visible.
73
+ */
74
+ get visibleCheckboxes(): DynamicCheckbox[] {
75
+ return this.checkboxes.filter((cb) => cb.isVisible);
76
+ }
43
77
 
44
- onClose() {
45
- this.closeSidebar.emit()
78
+ /**
79
+ * Class map for the panel shell.
80
+ */
81
+ get panelClasses(): Record<string, boolean> {
82
+ return {
83
+ 'j-sidebar': true,
84
+ 'j-sidebar--left': this.position === 'left',
85
+ 'j-sidebar--right': this.position === 'right',
86
+ 'j-sidebar--small': this.size === 'small',
87
+ 'j-sidebar--medium': this.size === 'medium',
88
+ 'j-sidebar--large': this.size === 'large',
89
+ 'j-sidebar--xlarge': this.size === 'xlarge',
90
+ [this.bgColor]: !!this.bgColor,
91
+ ...this.ngClasses,
92
+ };
93
+ }
94
+
95
+ onClose(): void {
96
+ this.closeSidebar.emit();
97
+ }
98
+
99
+ onOverlayClick(): void {
100
+ if (this.canCloseOverlay) {
101
+ this.onClose();
102
+ }
46
103
  }
47
104
 
48
105
  @HostListener('document:keydown.escape')
49
- handleEscape() {
50
- if (this.openSidebar) {
106
+ handleEscape(): void {
107
+ if (this.openSidebar && this.closeOnEscape) {
51
108
  this.onClose();
52
109
  }
53
110
  }
@@ -0,0 +1,2 @@
1
+ export type StaticSidebarSize = 'small' | 'medium' | 'large' | 'xlarge';
2
+ export type StaticSidebarPosition = 'left' | 'right';
@@ -3,7 +3,7 @@
3
3
  <div class="sticky top-0 left-0 right-0 grid grid-cols-2 pb-2 justify-between items-center gap-3 pt-2 select-none bg-white dark:bg-dark-background z-2">
4
4
  <div>
5
5
  <JButton
6
- [icon]="iconsService.icons.save"
6
+ [icon]="Icons.Save"
7
7
  [iconSize]="22"
8
8
  (clicked)="saveRecords()"
9
9
  classes="secondary"
@@ -19,24 +19,22 @@
19
19
  <div class="absolute right-3 top-1/2 transform -translate-y-1/2 flex items-center gap-2">
20
20
  <!-- Icono de carga -->
21
21
  @if (isLoadingSearch) {
22
- <lucide-icon [name]="iconsService.icons.loading" size="18" class="text-gray-400 animate-spin">
23
- </lucide-icon>
24
- }
22
+ <JIcon [icon]="Icons.Loader2" size="18" iconClass="text-gray-400 animate-spin" />
23
+ }
25
24
 
26
25
  <!-- Botón X para limpiar -->
27
26
  @if (searchQuery && !isLoadingSearch) {
28
27
  <button (click)="clearSearch()"
29
28
  class="pr-1 mr-1 text-gray-400 hover:text-gray-600 focus:outline-none cursor-pointer"
30
29
  aria-label="Limpiar búsqueda">
31
- <lucide-icon [name]="iconsService.icons.close" size="16"></lucide-icon>
30
+ <JIcon [icon]="Icons.X" size="16" [ariaHidden]="true" />
32
31
  </button>
33
32
  }
34
33
 
35
34
  <!-- Icono de búsqueda -->
36
35
  @if (!isLoadingSearch && !searchQuery) {
37
- <lucide-icon [name]="iconsService.icons.search" size="16" class="text-gray-400">
38
- </lucide-icon>
39
- }
36
+ <JIcon [icon]="Icons.Search" size="16" iconClass="text-gray-400" />
37
+ }
40
38
  </div>
41
39
  </div>
42
40
  </div>
@@ -75,13 +73,13 @@
75
73
  @if (column.sortable) {
76
74
  <div class="ml-1">
77
75
  @if (isLoading('sort') && column.key === sortingColumn) {
78
- <lucide-icon [name]="iconsService.icons.loading" size="16" class="text-white animate-spin"></lucide-icon>
76
+ <JIcon [icon]="Icons.Loader2" size="16" iconClass="text-white animate-spin" [ariaHidden]="true" />
79
77
  } @else if (sortColumn !== column.key || sortDirection === 'none') {
80
- <lucide-icon [name]="iconsService.icons.chevronsUpDown" size="16" class="text-white"></lucide-icon>
78
+ <JIcon [icon]="Icons.ChevronsUpDown" size="16" iconClass="text-white" [ariaHidden]="true" />
81
79
  } @else if (sortDirection === 'asc') {
82
- <lucide-icon [name]="iconsService.icons.chevronUp" size="16" class="text-white"></lucide-icon>
80
+ <JIcon [icon]="Icons.ChevronUp" size="16" iconClass="text-white" [ariaHidden]="true" />
83
81
  } @else {
84
- <lucide-icon [name]="iconsService.icons.chevronDown" size="16" class="text-white"></lucide-icon>
82
+ <JIcon [icon]="Icons.ChevronDown" size="16" iconClass="text-white" [ariaHidden]="true" />
85
83
  }
86
84
  </div>
87
85
  }
@@ -160,11 +158,11 @@
160
158
  @else if (column.isDecoratorDateTime && getValue(item, column)) {
161
159
  <div class="flex items-center gap-3 text-[14px]">
162
160
  <div class="flex items-center gap-1">
163
- <lucide-icon [name]="iconsService.icons.calendar" size="15" class="text-gray-500 dark:text-gray-400"></lucide-icon>
161
+ <JIcon [icon]="Icons.Calendar" size="15" iconClass="text-gray-500 dark:text-gray-400" [ariaHidden]="true" />
164
162
  <span>{{ getValue(item, column).split(',')[0] }}</span>
165
163
  </div>
166
164
  <div class="flex items-center gap-1">
167
- <lucide-icon [name]="iconsService.icons.clock" size="15" class="text-gray-500 dark:text-gray-400"></lucide-icon>
165
+ <JIcon [icon]="Icons.Clock" size="15" iconClass="text-gray-500 dark:text-gray-400" [ariaHidden]="true" />
168
166
  <span>{{ getValue(item, column).split(',')[1]?.trim() }}</span>
169
167
  </div>
170
168
  </div>
@@ -214,14 +212,14 @@
214
212
  >
215
213
  <div class="flex justify-center items-center gap-1">
216
214
  <JButton
217
- [icon]="iconsService.icons.edit"
215
+ [icon]="Icons.Edit"
218
216
  [iconSize]="20"
219
217
  (clicked)="onEdit(item)"
220
218
  [tooltip]="'Editar'"
221
219
  classes="warning_secondary min-w-auto p-[1px]! pl-[5px]! pr-[5px]!"
222
220
  />
223
221
  <JButton
224
- [icon]="iconsService.icons.delete"
222
+ [icon]="Icons.Trash"
225
223
  [iconSize]="20"
226
224
  (clicked)="onDelete($index)"
227
225
  [tooltip]="'Eliminar'"
@@ -240,7 +238,7 @@
240
238
  <td [attr.colspan]="columns.length + 1"
241
239
  class="px-4 py-8 text-center text-sm text-black dark:text-white">
242
240
  <div class="absolute inset-0 flex flex-col gap-3 items-center justify-center py-4 bg-white/80 dark:bg-foreground/80 backdrop-blur-sm z-501 select-none rounded">
243
- <lucide-icon [name]="iconsService.icons.info" size="35" class="text-primary"></lucide-icon>
241
+ <JIcon [icon]="Icons.Info" size="35" iconClass="text-primary" [ariaHidden]="true" />
244
242
  <p class="text-black dark:text-white">No hay datos disponibles</p>
245
243
  </div>
246
244
  </td>