@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,89 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ forwardRef,
5
+ Input
6
+ } from '@angular/core';
7
+
8
+ import {
9
+ ControlValueAccessor,
10
+ FormsModule,
11
+ NG_VALUE_ACCESSOR
12
+ } from '@angular/forms';
13
+
14
+ import { DatePickerModule } from 'primeng/datepicker';
15
+
16
+ @Component({
17
+ selector: 'byte-calendar',
18
+ standalone: true,
19
+ imports: [
20
+ FormsModule,
21
+ DatePickerModule
22
+ ],
23
+ templateUrl: './calendar.html',
24
+ styleUrl: './calendar.css',
25
+ changeDetection: ChangeDetectionStrategy.OnPush,
26
+
27
+ providers: [
28
+ {
29
+ provide: NG_VALUE_ACCESSOR,
30
+ useExisting: forwardRef(() => Calendar),
31
+ multi: true
32
+ }
33
+ ]
34
+ })
35
+ export class Calendar implements ControlValueAccessor {
36
+
37
+ @Input() dateFormat = 'dd/mm/yy';
38
+
39
+ @Input() placeholder = 'dd/mm/yyyy';
40
+
41
+ @Input() showIcon = true;
42
+
43
+ @Input() disabled = false;
44
+
45
+ @Input() minDate?: Date;
46
+
47
+ @Input() maxDate?: Date;
48
+
49
+ @Input() readonlyInput = false;
50
+
51
+ @Input() showClear = false;
52
+
53
+ @Input() inputId = '';
54
+
55
+ @Input() name = '';
56
+
57
+ value: Date | null = null;
58
+
59
+ private onChange: (value: Date | null) => void = () => {};
60
+
61
+ private onTouched: () => void = () => {};
62
+
63
+ writeValue(value: Date | null): void {
64
+ this.value = value;
65
+ }
66
+
67
+ registerOnChange(
68
+ fn: (value: Date | null) => void
69
+ ): void {
70
+ this.onChange = fn;
71
+ }
72
+
73
+ registerOnTouched(
74
+ fn: () => void
75
+ ): void {
76
+ this.onTouched = fn;
77
+ }
78
+
79
+ setDisabledState(isDisabled: boolean): void {
80
+ this.disabled = isDisabled;
81
+ }
82
+
83
+ onValueChange(value: Date | null): void {
84
+ this.value = value;
85
+
86
+ this.onChange(value);
87
+ this.onTouched();
88
+ }
89
+ }
@@ -0,0 +1,16 @@
1
+ :host {
2
+ display: block;
3
+ width: 100%;
4
+ }
5
+
6
+ :host ::ng-deep .p-inputtext,
7
+ :host ::ng-deep .p-inputnumber,
8
+ :host ::ng-deep .p-textarea,
9
+ :host ::ng-deep .p-datepicker,
10
+ :host ::ng-deep .p-select {
11
+ width: 100%;
12
+ }
13
+
14
+ :host ::ng-deep .p-inputnumber-input {
15
+ width: 100%;
16
+ }
@@ -0,0 +1,14 @@
1
+ <p-select
2
+ [options]="options"
3
+ [optionLabel]="optionLabel"
4
+ [optionValue]="optionValue"
5
+ [placeholder]="placeholder"
6
+ [disabled]="disabled"
7
+ [inputId]="inputId"
8
+ [name]="name"
9
+ [ngModel]="value"
10
+
11
+ [filter]="filter" [filterBy]="filterBy"
12
+
13
+ (ngModelChange)="onValueChange($event)"
14
+ />
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { Select } from './select';
4
+
5
+ describe('Select', () => {
6
+ let component: Select;
7
+ let fixture: ComponentFixture<Select>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [Select],
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(Select);
15
+ component = fixture.componentInstance;
16
+ await fixture.whenStable();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -0,0 +1,73 @@
1
+ import {
2
+ ChangeDetectionStrategy,
3
+ Component,
4
+ forwardRef,
5
+ Input
6
+ } from '@angular/core';
7
+
8
+ import {
9
+ ControlValueAccessor,
10
+ FormsModule,
11
+ NG_VALUE_ACCESSOR
12
+ } from '@angular/forms';
13
+
14
+ import { SelectModule } from 'primeng/select';
15
+
16
+ @Component({
17
+ selector: 'shared-select',
18
+ imports: [
19
+ FormsModule,
20
+ SelectModule
21
+ ],
22
+ templateUrl: './select.html',
23
+ styleUrl: './select.css',
24
+ changeDetection: ChangeDetectionStrategy.OnPush,
25
+
26
+ providers: [
27
+ {
28
+ provide: NG_VALUE_ACCESSOR,
29
+ useExisting: forwardRef(() => Select),
30
+ multi: true
31
+ }
32
+ ]
33
+ })
34
+ export class Select {
35
+ @Input() options: any[] = [];
36
+ @Input() optionLabel = '';
37
+ @Input() optionValue = '';
38
+ @Input() placeholder = 'Seleccione';
39
+ @Input() disabled = false;
40
+ @Input() inputId = '';
41
+ @Input() name = '';
42
+
43
+ // Nuevos inputs
44
+ @Input() filter = false;
45
+ @Input() filterBy = '';
46
+
47
+ value: any = null;
48
+
49
+ private onChange: (value: any) => void = () => {};
50
+ private onTouched: () => void = () => {};
51
+
52
+ writeValue(value: any): void {
53
+ this.value = value;
54
+ }
55
+
56
+ registerOnChange(fn: (value: any) => void): void {
57
+ this.onChange = fn;
58
+ }
59
+
60
+ registerOnTouched(fn: () => void): void {
61
+ this.onTouched = fn;
62
+ }
63
+
64
+ setDisabledState(isDisabled: boolean): void {
65
+ this.disabled = isDisabled;
66
+ }
67
+
68
+ onValueChange(value: any): void {
69
+ this.value = value;
70
+ this.onChange(value);
71
+ this.onTouched();
72
+ }
73
+ }
@@ -0,0 +1,5 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { EmpresaUIConfig } from '../providers/empresa-ui-config';
3
+
4
+ export const EMPRESA_UI_CONFIG =
5
+ new InjectionToken<EmpresaUIConfig>('EMPRESA_UI_CONFIG');
@@ -0,0 +1,8 @@
1
+ export type EmpresaUITheme =
2
+ 'aura'
3
+ | 'crm';
4
+
5
+
6
+ export interface EmpresaUIConfig {
7
+ theme?: EmpresaUITheme;
8
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ makeEnvironmentProviders,
3
+ provideEnvironmentInitializer
4
+ } from '@angular/core';
5
+
6
+ import { providePrimeNG } from 'primeng/config';
7
+
8
+ import { EMPRESA_UI_CONFIG } from '../config/empresa-ui.token';
9
+ import { EmpresaUIConfig } from './empresa-ui-config';
10
+
11
+ import { EMPRESA_THEMES } from '../themes/registry';
12
+ import { injectPrimeIconsStylesheet } from '../utils/inject-prime-icons';
13
+
14
+
15
+ export function provideEmpresaUI(
16
+ config: EmpresaUIConfig = {}
17
+ ) {
18
+ const theme =
19
+ EMPRESA_THEMES[config.theme ?? 'crm'];
20
+
21
+
22
+ return makeEnvironmentProviders([
23
+
24
+ providePrimeNG({
25
+ theme: {
26
+ preset: theme,
27
+ options: {
28
+ darkModeSelector: false
29
+ }
30
+ }
31
+ }),
32
+
33
+ {
34
+ provide: EMPRESA_UI_CONFIG,
35
+ useValue: config
36
+ },
37
+
38
+ provideEnvironmentInitializer(() => injectPrimeIconsStylesheet()),
39
+
40
+ ]);
41
+
42
+ }
@@ -0,0 +1,34 @@
1
+ import { definePreset } from '@primeuix/themes';
2
+ import Aura from '@primeuix/themes/aura';
3
+
4
+ export const CRMTheme = definePreset(Aura, {
5
+ semantic: {
6
+ primary: {
7
+ 50: '#EEF4FF',
8
+ 100: '#DCE8FF',
9
+ 200: '#B9D1FF',
10
+ 300: '#8FB4FF',
11
+ 400: '#5F91F5',
12
+ 500: '#2F6FE4',
13
+ 600: '#1F58C4',
14
+ 700: '#18489D',
15
+ 800: '#123574',
16
+ 900: '#0A2453',
17
+ 950: '#00011F'
18
+ }
19
+
20
+ /* secondary: {
21
+ 50: '#F8FAFC',
22
+ 100: '#F1F5F9',
23
+ 200: '#E2E8F0',
24
+ 300: '#CBD5E1',
25
+ 400: '#94A3B8',
26
+ 500: '#64748B',
27
+ 600: '#475569',
28
+ 700: '#334155',
29
+ 800: '#1E293B',
30
+ 900: '#0F172A',
31
+ 950: '#020617'
32
+ } */
33
+ }
34
+ });
@@ -0,0 +1,3 @@
1
+ import Aura from '@primeuix/themes/aura';
2
+
3
+ export const AuraTheme = Aura;
@@ -0,0 +1,2 @@
1
+ export * from './aura';
2
+ export * from './CRM-Theme';
@@ -0,0 +1,9 @@
1
+ import {
2
+ AuraTheme,
3
+ CRMTheme,
4
+ } from './';
5
+
6
+ export const EMPRESA_THEMES = {
7
+ aura: AuraTheme,
8
+ crm: CRMTheme,
9
+ };
@@ -0,0 +1,12 @@
1
+ const PRIME_ICONS_LINK_ID = 'empresa-ui-prime-icons';
2
+ const PRIME_ICONS_VERSION = '7.0.0';
3
+
4
+ export function injectPrimeIconsStylesheet(): void {
5
+ if (document.getElementById(PRIME_ICONS_LINK_ID)) return;
6
+
7
+ const link = document.createElement('link');
8
+ link.id = PRIME_ICONS_LINK_ID;
9
+ link.rel = 'stylesheet';
10
+ link.href = `https://cdn.jsdelivr.net/npm/primeicons@${PRIME_ICONS_VERSION}/primeicons.css`;
11
+ document.head.appendChild(link);
12
+ }
@@ -0,0 +1,30 @@
1
+ /*
2
+ * Public API Surface of shared-ui
3
+ */
4
+
5
+ //export * from './lib/shared-ui';
6
+ export * from './lib/providers/provide-empresa-ui';
7
+ export * from './lib/providers/empresa-ui-config';
8
+
9
+ //COMPONENTES
10
+ export * from './lib/components/calendar/calendar';
11
+ export * from './lib/components/byte-select';
12
+ export * from './lib/components/byte-input/byte-input';
13
+
14
+
15
+ export * from './lib/components/byte-button/byte-button';
16
+ export * from './lib/components/byte-button/byte-button-group/byte-button-group';
17
+ export * from './lib/components/byte-button/byte-button.directive';
18
+ export * from './lib/components/byte-button/byte-button.module';
19
+
20
+ export * from './lib/components/byte-table/byte-table';
21
+ export * from './lib/components/byte-table/byte-table.directive';
22
+ export * from './lib/components/byte-table/byte-table.module';
23
+
24
+ export * from './lib/components/byte-sidebar/byte-sidebar';
25
+ export * from './lib/components/byte-sidebar/byte-sidebar.directive';
26
+ export * from './lib/components/byte-sidebar/byte-sidebar.module';
27
+
28
+ export * from './lib/components/byte-dialog/byte-dialog';
29
+ export * from './lib/components/byte-dialog/byte-dialog.directive';
30
+ export * from './lib/components/byte-dialog/byte-dialog.module';
package/tsconfig.json ADDED
@@ -0,0 +1,45 @@
1
+ /* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
2
+ /* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
3
+ {
4
+ "compileOnSave": false,
5
+ "compilerOptions": {
6
+ "strict": true,
7
+ "noImplicitOverride": true,
8
+ "noPropertyAccessFromIndexSignature": true,
9
+ "noImplicitReturns": true,
10
+ "noFallthroughCasesInSwitch": true,
11
+ "skipLibCheck": true,
12
+ "isolatedModules": true,
13
+ "experimentalDecorators": true,
14
+ "paths": {
15
+ "shared-ui": ["./dist/shared-ui"]
16
+ },
17
+ "importHelpers": true,
18
+ "target": "ES2022",
19
+ "module": "preserve"
20
+ },
21
+ "angularCompilerOptions": {
22
+ "enableI18nLegacyMessageIdFormat": false,
23
+ "strictInjectionParameters": true,
24
+ "strictInputAccessModifiers": true,
25
+ "strictTemplates": true
26
+ },
27
+ "files": [],
28
+ "references": [
29
+ {
30
+ "path": "./projects/shared-ui/tsconfig.lib.json"
31
+ },
32
+ {
33
+ "path": "./projects/shared-ui/tsconfig.spec.json"
34
+ },
35
+ {
36
+ "path": "./projects/demo/tsconfig.app.json"
37
+ },
38
+ {
39
+ "path": "./projects/demo/tsconfig.spec.json"
40
+ },
41
+ {
42
+ "path": "./projects/storybook-host/tsconfig.app.json"
43
+ }
44
+ ]
45
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./out-tsc/lib",
5
+ "declaration": true,
6
+ "declarationMap": true,
7
+ "types": []
8
+ },
9
+ "include": ["src/**/*.ts"],
10
+ "exclude": ["**/*.spec.ts"]
11
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "./tsconfig.lib.json",
3
+ "compilerOptions": {
4
+ "declarationMap": false
5
+ },
6
+ "angularCompilerOptions": {
7
+ "compilationMode": "partial"
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./out-tsc/spec",
5
+ "types": ["vitest/globals"]
6
+ },
7
+ "include": ["src/**/*.d.ts", "src/**/*.spec.ts"]
8
+ }