@4byte/shared-lib 0.0.1

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 (121) hide show
  1. package/.editorconfig +17 -0
  2. package/.prettierrc +12 -0
  3. package/.vscode/extensions.json +4 -0
  4. package/.vscode/launch.json +20 -0
  5. package/.vscode/mcp.json +9 -0
  6. package/.vscode/tasks.json +42 -0
  7. package/README.md +284 -0
  8. package/angular.json +211 -0
  9. package/ng-package.json +11 -0
  10. package/package.json +44 -0
  11. package/projects/storybook-host/.storybook/main.ts +20 -0
  12. package/projects/storybook-host/.storybook/preview.ts +74 -0
  13. package/projects/storybook-host/.storybook/tsconfig.doc.json +10 -0
  14. package/projects/storybook-host/.storybook/tsconfig.json +22 -0
  15. package/projects/storybook-host/.storybook/tutorial/Installation.mdx +6 -0
  16. package/projects/storybook-host/.storybook/tutorial/Introduction.mdx +18 -0
  17. package/projects/storybook-host/.storybook/tutorial/Theming.mdx +14 -0
  18. package/projects/storybook-host/.storybook/typings.d.ts +4 -0
  19. package/projects/storybook-host/documentation.json +605 -0
  20. package/projects/storybook-host/public/favicon.ico +0 -0
  21. package/projects/storybook-host/src/app/app.config.ts +8 -0
  22. package/projects/storybook-host/src/app/app.css +0 -0
  23. package/projects/storybook-host/src/app/app.html +343 -0
  24. package/projects/storybook-host/src/app/app.ts +11 -0
  25. package/projects/storybook-host/src/index.html +13 -0
  26. package/projects/storybook-host/src/main.ts +6 -0
  27. package/projects/storybook-host/src/stories/assets/accessibility.png +0 -0
  28. package/projects/storybook-host/src/stories/assets/accessibility.svg +1 -0
  29. package/projects/storybook-host/src/stories/assets/addon-library.png +0 -0
  30. package/projects/storybook-host/src/stories/assets/assets.png +0 -0
  31. package/projects/storybook-host/src/stories/assets/avif-test-image.avif +0 -0
  32. package/projects/storybook-host/src/stories/assets/context.png +0 -0
  33. package/projects/storybook-host/src/stories/assets/discord.svg +1 -0
  34. package/projects/storybook-host/src/stories/assets/docs.png +0 -0
  35. package/projects/storybook-host/src/stories/assets/figma-plugin.png +0 -0
  36. package/projects/storybook-host/src/stories/assets/github.svg +1 -0
  37. package/projects/storybook-host/src/stories/assets/share.png +0 -0
  38. package/projects/storybook-host/src/stories/assets/styling.png +0 -0
  39. package/projects/storybook-host/src/stories/assets/testing.png +0 -0
  40. package/projects/storybook-host/src/stories/assets/theming.png +0 -0
  41. package/projects/storybook-host/src/stories/assets/tutorials.svg +1 -0
  42. package/projects/storybook-host/src/stories/assets/youtube.svg +1 -0
  43. package/projects/storybook-host/src/stories/button.component.ts +50 -0
  44. package/projects/storybook-host/src/stories/button.css +30 -0
  45. package/projects/storybook-host/src/stories/button.stories.ts +49 -0
  46. package/projects/storybook-host/src/stories/header.component.ts +78 -0
  47. package/projects/storybook-host/src/stories/header.css +32 -0
  48. package/projects/storybook-host/src/stories/header.stories.ts +33 -0
  49. package/projects/storybook-host/src/stories/page.component.ts +84 -0
  50. package/projects/storybook-host/src/stories/page.css +68 -0
  51. package/projects/storybook-host/src/stories/page.stories.ts +32 -0
  52. package/projects/storybook-host/src/stories/user.ts +3 -0
  53. package/projects/storybook-host/src/styles.css +1 -0
  54. package/projects/storybook-host/tsconfig.app.json +15 -0
  55. package/projects/storybook-host/tsconfig.spec.json +15 -0
  56. package/src/lib/components/byte-button/byte-button-group/byte-button-group.css +27 -0
  57. package/src/lib/components/byte-button/byte-button-group/byte-button-group.html +6 -0
  58. package/src/lib/components/byte-button/byte-button-group/byte-button-group.spec.ts +22 -0
  59. package/src/lib/components/byte-button/byte-button-group/byte-button-group.ts +35 -0
  60. package/src/lib/components/byte-button/byte-button.css +0 -0
  61. package/src/lib/components/byte-button/byte-button.directive.ts +17 -0
  62. package/src/lib/components/byte-button/byte-button.html +29 -0
  63. package/src/lib/components/byte-button/byte-button.module.ts +19 -0
  64. package/src/lib/components/byte-button/byte-button.stories.ts +449 -0
  65. package/src/lib/components/byte-button/byte-button.ts +129 -0
  66. package/src/lib/components/byte-dialog/byte-dialog.css +0 -0
  67. package/src/lib/components/byte-dialog/byte-dialog.directive.ts +21 -0
  68. package/src/lib/components/byte-dialog/byte-dialog.html +47 -0
  69. package/src/lib/components/byte-dialog/byte-dialog.module.ts +21 -0
  70. package/src/lib/components/byte-dialog/byte-dialog.spec.ts +22 -0
  71. package/src/lib/components/byte-dialog/byte-dialog.ts +121 -0
  72. package/src/lib/components/byte-dialog/byte.dialog.stories.ts +215 -0
  73. package/src/lib/components/byte-input/byte-input.css +29 -0
  74. package/src/lib/components/byte-input/byte-input.html +58 -0
  75. package/src/lib/components/byte-input/byte-input.spec.ts +22 -0
  76. package/src/lib/components/byte-input/byte-input.stories.ts +60 -0
  77. package/src/lib/components/byte-input/byte-input.ts +97 -0
  78. package/src/lib/components/byte-select/byte-select.css +16 -0
  79. package/src/lib/components/byte-select/byte-select.directive.ts +61 -0
  80. package/src/lib/components/byte-select/byte-select.html +101 -0
  81. package/src/lib/components/byte-select/byte-select.module.ts +26 -0
  82. package/src/lib/components/byte-select/byte-select.spec.ts +22 -0
  83. package/src/lib/components/byte-select/byte-select.stories.ts +194 -0
  84. package/src/lib/components/byte-select/byte-select.ts +168 -0
  85. package/src/lib/components/byte-select/index.ts +3 -0
  86. package/src/lib/components/byte-sidebar/byte-sidebar.css +0 -0
  87. package/src/lib/components/byte-sidebar/byte-sidebar.directive.ts +11 -0
  88. package/src/lib/components/byte-sidebar/byte-sidebar.html +31 -0
  89. package/src/lib/components/byte-sidebar/byte-sidebar.module.ts +16 -0
  90. package/src/lib/components/byte-sidebar/byte-sidebar.spec.ts +22 -0
  91. package/src/lib/components/byte-sidebar/byte-sidebar.stories.ts +190 -0
  92. package/src/lib/components/byte-sidebar/byte-sidebar.ts +108 -0
  93. package/src/lib/components/byte-table/byte-table.css +0 -0
  94. package/src/lib/components/byte-table/byte-table.directive.ts +49 -0
  95. package/src/lib/components/byte-table/byte-table.html +102 -0
  96. package/src/lib/components/byte-table/byte-table.module.ts +33 -0
  97. package/src/lib/components/byte-table/byte-table.spec.ts +22 -0
  98. package/src/lib/components/byte-table/byte-table.stories.ts +296 -0
  99. package/src/lib/components/byte-table/byte-table.ts +162 -0
  100. package/src/lib/components/calendar/calendar.css +16 -0
  101. package/src/lib/components/calendar/calendar.html +15 -0
  102. package/src/lib/components/calendar/calendar.spec.ts +22 -0
  103. package/src/lib/components/calendar/calendar.stories.ts +153 -0
  104. package/src/lib/components/calendar/calendar.ts +89 -0
  105. package/src/lib/components/select/select.css +16 -0
  106. package/src/lib/components/select/select.html +14 -0
  107. package/src/lib/components/select/select.spec.ts +22 -0
  108. package/src/lib/components/select/select.ts +73 -0
  109. package/src/lib/config/empresa-ui.token.ts +5 -0
  110. package/src/lib/providers/empresa-ui-config.ts +8 -0
  111. package/src/lib/providers/provide-empresa-ui.ts +42 -0
  112. package/src/lib/themes/CRM-Theme.ts +34 -0
  113. package/src/lib/themes/aura.ts +3 -0
  114. package/src/lib/themes/index.ts +2 -0
  115. package/src/lib/themes/registry.ts +9 -0
  116. package/src/lib/utils/inject-prime-icons.ts +12 -0
  117. package/src/public-api.ts +30 -0
  118. package/tsconfig.json +45 -0
  119. package/tsconfig.lib.json +11 -0
  120. package/tsconfig.lib.prod.json +9 -0
  121. package/tsconfig.spec.json +8 -0
@@ -0,0 +1,449 @@
1
+ import {
2
+ applicationConfig,
3
+ moduleMetadata,
4
+ type Meta,
5
+ type StoryObj
6
+ } from '@storybook/angular';
7
+
8
+ import { ByteButton } from './byte-button';
9
+ import { ByteButtonModule } from './byte-button.module';
10
+
11
+ import { provideEmpresaUI } from './../../providers/provide-empresa-ui';
12
+
13
+
14
+ const meta: Meta<ByteButton> = {
15
+
16
+ title: 'Components/ByteButton',
17
+
18
+ component: ByteButton,
19
+
20
+ decorators: [
21
+
22
+ moduleMetadata({
23
+ imports: [
24
+ ByteButtonModule
25
+ ]
26
+ }),
27
+
28
+ (story, context) =>
29
+ applicationConfig({
30
+ providers: [
31
+ provideEmpresaUI({
32
+ theme: context.globals['theme']
33
+ })
34
+ ]
35
+ })(story, context)
36
+
37
+ ],
38
+
39
+ tags: ['autodocs'],
40
+
41
+ parameters: {
42
+ docs: {
43
+ description: {
44
+ component:
45
+ 'Componente de botón reutilizable basado en PrimeNG, con soporte para iconos, variantes, estados y contenido personalizado.'
46
+ }
47
+ }
48
+ }
49
+
50
+ };
51
+
52
+ export default meta;
53
+
54
+ type Story = StoryObj<ByteButton>;
55
+
56
+
57
+ // =====================================================
58
+ // NORMAL
59
+ // =====================================================
60
+
61
+ export const Normal: Story = {
62
+
63
+ args: {
64
+
65
+ label: 'Guardar',
66
+
67
+ icon: 'pi pi-save',
68
+
69
+ severity: 'success'
70
+
71
+ },
72
+
73
+ };
74
+
75
+
76
+ // =====================================================
77
+ // SEVERITIES
78
+ // =====================================================
79
+
80
+ export const Severities: Story = {
81
+
82
+ render: (args) => ({
83
+
84
+ props: args,
85
+
86
+ template: `
87
+
88
+ <div
89
+ style="
90
+ display: flex;
91
+ gap: 1rem;
92
+ flex-wrap: wrap;
93
+ "
94
+ >
95
+
96
+ <byte-button
97
+ label="Primary"
98
+ />
99
+
100
+ <byte-button
101
+ label="Secondary"
102
+ severity="secondary"
103
+ />
104
+
105
+ <byte-button
106
+ label="Success"
107
+ severity="success"
108
+ />
109
+
110
+ <byte-button
111
+ label="Info"
112
+ severity="info"
113
+ />
114
+
115
+ <byte-button
116
+ label="Warn"
117
+ severity="warn"
118
+ />
119
+
120
+ <byte-button
121
+ label="Danger"
122
+ severity="danger"
123
+ />
124
+
125
+ <byte-button
126
+ label="Contrast"
127
+ severity="contrast"
128
+ />
129
+
130
+ </div>
131
+
132
+ `
133
+
134
+ })
135
+
136
+ };
137
+
138
+
139
+ // =====================================================
140
+ // ICON
141
+ // =====================================================
142
+
143
+ /* export const Icon: Story = {
144
+
145
+ args: {
146
+
147
+ label: 'Guardar',
148
+
149
+ icon: 'pi pi-save',
150
+
151
+ severity: 'success'
152
+
153
+ }
154
+
155
+ }; */
156
+
157
+
158
+ // =====================================================
159
+ // ICON ONLY
160
+ // =====================================================
161
+
162
+ export const IconOnly: Story = {
163
+
164
+ args: {
165
+
166
+ icon: 'pi pi-trash',
167
+
168
+ severity: 'danger',
169
+
170
+ rounded: true
171
+
172
+ }
173
+
174
+ };
175
+
176
+
177
+ // =====================================================
178
+ // VARIANTS
179
+ // =====================================================
180
+
181
+ export const Variants: Story = {
182
+
183
+ render: (args) => ({
184
+
185
+ props: args,
186
+
187
+ template: `
188
+
189
+ <div
190
+ style="
191
+ display: flex;
192
+ gap: 1rem;
193
+ flex-wrap: wrap;
194
+ "
195
+ >
196
+
197
+ <byte-button
198
+ label="Default"
199
+ />
200
+
201
+ <byte-button
202
+ label="Outlined"
203
+ variant="outlined"
204
+ />
205
+
206
+ <byte-button
207
+ label="Text"
208
+ variant="text"
209
+ />
210
+
211
+ </div>
212
+
213
+ `
214
+
215
+ })
216
+
217
+ };
218
+
219
+
220
+ // =====================================================
221
+ // SIZES
222
+ // =====================================================
223
+
224
+ export const Sizes: Story = {
225
+
226
+ render: (args) => ({
227
+
228
+ props: args,
229
+
230
+ template: `
231
+
232
+ <div
233
+ style="
234
+ display: flex;
235
+ gap: 1rem;
236
+ align-items: center;
237
+ "
238
+ >
239
+
240
+ <byte-button
241
+ label="Small"
242
+ size="small"
243
+ />
244
+
245
+ <byte-button
246
+ label="Normal"
247
+ />
248
+
249
+ <byte-button
250
+ label="Large"
251
+ size="large"
252
+ />
253
+
254
+ </div>
255
+
256
+ `
257
+
258
+ })
259
+
260
+ };
261
+
262
+
263
+ // =====================================================
264
+ // STATES
265
+ // =====================================================
266
+
267
+ export const States: Story = {
268
+
269
+ render: (args) => ({
270
+
271
+ props: args,
272
+
273
+ template: `
274
+
275
+ <div
276
+ style="
277
+ display: flex;
278
+ gap: 1rem;
279
+ flex-wrap: wrap;
280
+ "
281
+ >
282
+
283
+ <byte-button
284
+ label="Normal"
285
+ />
286
+
287
+ <byte-button
288
+ label="Disabled"
289
+ [disabled]="true"
290
+ />
291
+
292
+ <byte-button
293
+ label="Loading"
294
+ [loading]="true"
295
+ />
296
+
297
+ </div>
298
+
299
+ `
300
+
301
+ })
302
+
303
+ };
304
+
305
+
306
+ // =====================================================
307
+ // BUTTON TYPES
308
+ // =====================================================
309
+
310
+ export const Types: Story = {
311
+
312
+ render: (args) => ({
313
+
314
+ props: args,
315
+
316
+ template: `
317
+
318
+ <div
319
+ style="
320
+ display: flex;
321
+ gap: 1rem;
322
+ "
323
+ >
324
+
325
+ <byte-button
326
+ label="Button"
327
+ type="button"
328
+ />
329
+
330
+ <byte-button
331
+ label="Submit"
332
+ type="submit"
333
+ />
334
+
335
+ <byte-button
336
+ label="Reset"
337
+ type="reset"
338
+ />
339
+
340
+ </div>
341
+
342
+ `
343
+
344
+ })
345
+
346
+ };
347
+
348
+
349
+ // =====================================================
350
+ // SHAPES
351
+ // =====================================================
352
+
353
+ export const Shapes: Story = {
354
+
355
+ render: (args) => ({
356
+
357
+ props: args,
358
+
359
+ template: `
360
+
361
+ <div
362
+ style="
363
+ display: flex;
364
+ gap: 1rem;
365
+ align-items: center;
366
+ "
367
+ >
368
+
369
+ <byte-button
370
+ label="Normal"
371
+ />
372
+
373
+ <byte-button
374
+ label="Raised"
375
+ [raised]="true"
376
+ />
377
+
378
+ <byte-button
379
+ label="Rounded"
380
+ [rounded]="true"
381
+ />
382
+
383
+ </div>
384
+
385
+ `
386
+
387
+ })
388
+
389
+ };
390
+
391
+
392
+ // =====================================================
393
+ // CUSTOM CONTENT
394
+ // =====================================================
395
+
396
+ export const CustomContent: Story = {
397
+
398
+ render: (args) => ({
399
+
400
+ props: args,
401
+
402
+ template: `
403
+
404
+ <byte-button
405
+ severity="success"
406
+ >
407
+
408
+ <ng-template byteButtonContent>
409
+
410
+ <span>
411
+
412
+ <i class="pi pi-check"></i>
413
+
414
+ Guardar cambios
415
+
416
+ </span>
417
+
418
+ </ng-template>
419
+
420
+ </byte-button>
421
+
422
+ `
423
+
424
+ })
425
+
426
+ };
427
+
428
+
429
+ // =====================================================
430
+ // BUTTON GROUP
431
+ // =====================================================
432
+
433
+ export const ButtonGroup: Story = {
434
+
435
+ render: (args) => ({
436
+
437
+ props: args,
438
+
439
+ template: `
440
+ <byte-button-group>
441
+ <byte-button label="Save" icon="pi pi-check" />
442
+ <byte-button label="Delete" icon="pi pi-trash" variant="outlined"/>
443
+ <byte-button label="Cancel" icon="pi pi-times" variant="outlined"/>
444
+ </byte-button-group>
445
+ `
446
+
447
+ })
448
+
449
+ };
@@ -0,0 +1,129 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ ContentChild,
5
+ EventEmitter,
6
+ Input,
7
+ Output
8
+ } from '@angular/core';
9
+
10
+ import { NgTemplateOutlet } from '@angular/common';
11
+ import { ButtonModule } from 'primeng/button';
12
+
13
+ import { ByteButtonContentDirective } from './byte-button.directive';
14
+
15
+
16
+ @Component({
17
+ selector: 'byte-button',
18
+
19
+ imports: [
20
+ ButtonModule,
21
+ NgTemplateOutlet,
22
+ ByteButtonContentDirective
23
+ ],
24
+
25
+ templateUrl: './byte-button.html',
26
+
27
+ styleUrl: './byte-button.css',
28
+
29
+ changeDetection: ChangeDetectionStrategy.OnPush
30
+ })
31
+ export class ByteButton {
32
+
33
+ // =====================================================
34
+ // INPUTS
35
+ // =====================================================
36
+
37
+ @Input()
38
+ label = '';
39
+
40
+ @Input()
41
+ icon = '';
42
+
43
+ @Input()
44
+ iconPos: 'left' | 'right' | 'top' | 'bottom' = 'left';
45
+
46
+ @Input()
47
+ severity:
48
+ | 'secondary'
49
+ | 'success'
50
+ | 'info'
51
+ | 'warn'
52
+ | 'danger'
53
+ | 'contrast'
54
+ | undefined;
55
+
56
+ @Input()
57
+ variant:
58
+ | 'outlined'
59
+ | 'text'
60
+ | undefined;
61
+
62
+ @Input()
63
+ size:
64
+ | 'small'
65
+ | 'large'
66
+ | undefined;
67
+
68
+ @Input()
69
+ disabled = false;
70
+
71
+ @Input()
72
+ loading = false;
73
+
74
+ @Input()
75
+ loadingIcon = '';
76
+
77
+ @Input()
78
+ raised = false;
79
+
80
+ @Input()
81
+ rounded = false;
82
+
83
+ @Input()
84
+ text = false;
85
+
86
+ @Input()
87
+ outlined = false;
88
+
89
+ @Input()
90
+ link = false;
91
+
92
+ @Input()
93
+ plain = false;
94
+
95
+ @Input()
96
+ fluid = false;
97
+
98
+ @Input()
99
+ type: 'button' | 'submit' | 'reset' = 'button';
100
+
101
+ @Input()
102
+ buttonProps: Record<string, any> = {};
103
+
104
+
105
+ // =====================================================
106
+ // CUSTOM TEMPLATE
107
+ // =====================================================
108
+
109
+ @ContentChild(ByteButtonContentDirective)
110
+ contentTemplate?: ByteButtonContentDirective;
111
+
112
+
113
+ // =====================================================
114
+ // OUTPUT
115
+ // =====================================================
116
+
117
+ @Output()
118
+ clicked = new EventEmitter<MouseEvent>();
119
+
120
+
121
+ // =====================================================
122
+ // CLICK
123
+ // =====================================================
124
+
125
+ onButtonClick(event: MouseEvent): void {
126
+ this.clicked.emit(event);
127
+ }
128
+
129
+ }
File without changes
@@ -0,0 +1,21 @@
1
+ import { Directive, TemplateRef } from '@angular/core';
2
+
3
+ @Directive({
4
+ selector: 'ng-template[byteDialogHeader]',
5
+ standalone: true
6
+ })
7
+ export class ByteDialogHeaderDirective {
8
+ constructor(
9
+ public template: TemplateRef<any>
10
+ ) {}
11
+ }
12
+
13
+ @Directive({
14
+ selector: 'ng-template[byteDialogFooter]',
15
+ standalone: true
16
+ })
17
+ export class ByteDialogFooterDirective {
18
+ constructor(
19
+ public template: TemplateRef<any>
20
+ ) {}
21
+ }
@@ -0,0 +1,47 @@
1
+ <p-dialog
2
+ [(visible)]="visible"
3
+ (visibleChange)="onVisibleChange($event)"
4
+ [header]="header"
5
+ [modal]="modal"
6
+ [closable]="closable"
7
+ [draggable]="draggable"
8
+ [resizable]="resizable"
9
+ [dismissableMask]="dismissableMask"
10
+ [closeOnEscape]="closeOnEscape"
11
+ [maximizable]="maximizable"
12
+ [blockScroll]="blockScroll"
13
+ [position]="position"
14
+ [style]="style"
15
+ [styleClass]="styleClass"
16
+ [contentStyle]="contentStyle"
17
+ [breakpoints]="breakpoints"
18
+ appendTo="body"
19
+ >
20
+
21
+ @if (headerTemplate) {
22
+
23
+ <ng-template pTemplate="header">
24
+
25
+ <ng-container
26
+ [ngTemplateOutlet]="headerTemplate.template"
27
+ />
28
+
29
+ </ng-template>
30
+
31
+ }
32
+
33
+ <ng-content></ng-content>
34
+
35
+ @if (footerTemplate) {
36
+
37
+ <ng-template pTemplate="footer">
38
+
39
+ <ng-container
40
+ [ngTemplateOutlet]="footerTemplate.template"
41
+ />
42
+
43
+ </ng-template>
44
+
45
+ }
46
+
47
+ </p-dialog>
@@ -0,0 +1,21 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { ByteDialog } from './byte-dialog';
4
+ import {
5
+ ByteDialogHeaderDirective,
6
+ ByteDialogFooterDirective
7
+ } from './byte-dialog.directive';
8
+
9
+ @NgModule({
10
+ imports: [
11
+ ByteDialog,
12
+ ByteDialogHeaderDirective,
13
+ ByteDialogFooterDirective
14
+ ],
15
+ exports: [
16
+ ByteDialog,
17
+ ByteDialogHeaderDirective,
18
+ ByteDialogFooterDirective
19
+ ]
20
+ })
21
+ export class ByteDialogModule {}
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { ByteDialog } from './byte-dialog';
4
+
5
+ describe('ByteDialog', () => {
6
+ let component: ByteDialog;
7
+ let fixture: ComponentFixture<ByteDialog>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [ByteDialog],
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(ByteDialog);
15
+ component = fixture.componentInstance;
16
+ await fixture.whenStable();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });