lib-pixelbuild 0.1.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 (137) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +176 -0
  3. package/dist/builders/PageBuilder.d.ts +7 -0
  4. package/dist/builders/PageBuilder.js +40 -0
  5. package/dist/components/CardComponent.d.ts +4 -0
  6. package/dist/components/CardComponent.js +13 -0
  7. package/dist/components/CarouselComponent.d.ts +4 -0
  8. package/dist/components/CarouselComponent.js +7 -0
  9. package/dist/components/FormComponent.d.ts +4 -0
  10. package/dist/components/FormComponent.js +26 -0
  11. package/dist/components/ListComponent.d.ts +4 -0
  12. package/dist/components/ListComponent.js +23 -0
  13. package/dist/components/LoadingComponent.d.ts +1 -0
  14. package/dist/components/LoadingComponent.js +5 -0
  15. package/dist/components/MapComponent.d.ts +4 -0
  16. package/dist/components/MapComponent.js +18 -0
  17. package/dist/components/SliderComponent.d.ts +5 -0
  18. package/dist/components/SliderComponent.js +16 -0
  19. package/dist/components/SocialIconsComponent.d.ts +4 -0
  20. package/dist/components/SocialIconsComponent.js +19 -0
  21. package/dist/components/TextComponent.d.ts +4 -0
  22. package/dist/components/TextComponent.js +13 -0
  23. package/dist/constants/ButtonActionEnum.d.ts +4 -0
  24. package/dist/constants/ButtonActionEnum.js +5 -0
  25. package/dist/constants/ComponentEnum.d.ts +17 -0
  26. package/dist/constants/ComponentEnum.js +16 -0
  27. package/dist/constants/ElementEnum.d.ts +18 -0
  28. package/dist/constants/ElementEnum.js +17 -0
  29. package/dist/constants/InputValidateEnum.d.ts +8 -0
  30. package/dist/constants/InputValidateEnum.js +9 -0
  31. package/dist/elements/AlertElement.d.ts +4 -0
  32. package/dist/elements/AlertElement.js +19 -0
  33. package/dist/elements/ButtonElement.d.ts +4 -0
  34. package/dist/elements/ButtonElement.js +50 -0
  35. package/dist/elements/ElementColWrapper.d.ts +6 -0
  36. package/dist/elements/ElementColWrapper.js +5 -0
  37. package/dist/elements/FileElement.d.ts +4 -0
  38. package/dist/elements/FileElement.js +6 -0
  39. package/dist/elements/IconElement.d.ts +4 -0
  40. package/dist/elements/IconElement.js +13 -0
  41. package/dist/elements/ImageElement.d.ts +4 -0
  42. package/dist/elements/ImageElement.js +6 -0
  43. package/dist/elements/InputElement.d.ts +4 -0
  44. package/dist/elements/InputElement.js +24 -0
  45. package/dist/elements/LinkElement.d.ts +4 -0
  46. package/dist/elements/LinkElement.js +6 -0
  47. package/dist/elements/TextElement.d.ts +4 -0
  48. package/dist/elements/TextElement.js +13 -0
  49. package/dist/factories/ButtonActionFactory.d.ts +5 -0
  50. package/dist/factories/ButtonActionFactory.js +13 -0
  51. package/dist/factories/ComponentFactory.d.ts +5 -0
  52. package/dist/factories/ComponentFactory.js +36 -0
  53. package/dist/factories/ElementFactory.d.ts +5 -0
  54. package/dist/factories/ElementFactory.js +42 -0
  55. package/dist/factories/InputValidateFactory.d.ts +9 -0
  56. package/dist/factories/InputValidateFactory.js +21 -0
  57. package/dist/index.d.ts +27 -0
  58. package/dist/index.js +15 -0
  59. package/dist/layouts/Footer.d.ts +4 -0
  60. package/dist/layouts/Footer.js +11 -0
  61. package/dist/layouts/Header.d.ts +4 -0
  62. package/dist/layouts/Header.js +8 -0
  63. package/dist/layouts/Menu.d.ts +5 -0
  64. package/dist/layouts/Menu.js +34 -0
  65. package/dist/layouts/SiteLayout.d.ts +4 -0
  66. package/dist/layouts/SiteLayout.js +7 -0
  67. package/dist/renderers/SectionRenderer.d.ts +4 -0
  68. package/dist/renderers/SectionRenderer.js +39 -0
  69. package/dist/services/AnalyticsService.d.ts +8 -0
  70. package/dist/services/AnalyticsService.js +28 -0
  71. package/dist/services/ApiService.d.ts +5 -0
  72. package/dist/services/ApiService.js +17 -0
  73. package/dist/services/CacheService.d.ts +5 -0
  74. package/dist/services/CacheService.js +16 -0
  75. package/dist/services/ConstructorService.d.ts +12 -0
  76. package/dist/services/ConstructorService.js +33 -0
  77. package/dist/services/EmailService.d.ts +9 -0
  78. package/dist/services/EmailService.js +44 -0
  79. package/dist/services/InputValidateService.d.ts +17 -0
  80. package/dist/services/InputValidateService.js +31 -0
  81. package/dist/stores/UseFormStore.d.ts +32 -0
  82. package/dist/stores/UseFormStore.js +51 -0
  83. package/dist/types/AuthenticateResponseType.d.ts +5 -0
  84. package/dist/types/AuthenticateResponseType.js +1 -0
  85. package/dist/types/ButtonPropertiesType.d.ts +11 -0
  86. package/dist/types/ButtonPropertiesType.js +1 -0
  87. package/dist/types/ColumnWidthType.d.ts +7 -0
  88. package/dist/types/ColumnWidthType.js +1 -0
  89. package/dist/types/ComponentType.d.ts +11 -0
  90. package/dist/types/ComponentType.js +1 -0
  91. package/dist/types/ElementType.d.ts +11 -0
  92. package/dist/types/ElementType.js +1 -0
  93. package/dist/types/FilePropertiesType.d.ts +4 -0
  94. package/dist/types/FilePropertiesType.js +1 -0
  95. package/dist/types/FooterPropertiesType.d.ts +5 -0
  96. package/dist/types/FooterPropertiesType.js +1 -0
  97. package/dist/types/FooterType.d.ts +6 -0
  98. package/dist/types/FooterType.js +1 -0
  99. package/dist/types/FormFieldsType.d.ts +4 -0
  100. package/dist/types/FormFieldsType.js +1 -0
  101. package/dist/types/HeaderPropertiesType.d.ts +5 -0
  102. package/dist/types/HeaderPropertiesType.js +1 -0
  103. package/dist/types/HeaderType.d.ts +6 -0
  104. package/dist/types/HeaderType.js +1 -0
  105. package/dist/types/ImagePropertiesType.d.ts +4 -0
  106. package/dist/types/ImagePropertiesType.js +1 -0
  107. package/dist/types/InputPropertiesType.d.ts +7 -0
  108. package/dist/types/InputPropertiesType.js +1 -0
  109. package/dist/types/LinkPropertiesType.d.ts +4 -0
  110. package/dist/types/LinkPropertiesType.js +1 -0
  111. package/dist/types/MailBodyType.d.ts +8 -0
  112. package/dist/types/MailBodyType.js +1 -0
  113. package/dist/types/PageType.d.ts +17 -0
  114. package/dist/types/PageType.js +1 -0
  115. package/dist/types/PlanWebsiteType.d.ts +9 -0
  116. package/dist/types/PlanWebsiteType.js +1 -0
  117. package/dist/types/PropertiesType.d.ts +27 -0
  118. package/dist/types/PropertiesType.js +1 -0
  119. package/dist/types/RawWebsiteType.d.ts +346 -0
  120. package/dist/types/RawWebsiteType.js +1 -0
  121. package/dist/types/SectionColumnType.d.ts +14 -0
  122. package/dist/types/SectionColumnType.js +1 -0
  123. package/dist/types/SectionType.d.ts +10 -0
  124. package/dist/types/SectionType.js +1 -0
  125. package/dist/types/SocialPropertiesType.d.ts +11 -0
  126. package/dist/types/SocialPropertiesType.js +1 -0
  127. package/dist/types/StylesType.d.ts +35 -0
  128. package/dist/types/StylesType.js +1 -0
  129. package/dist/types/UserType.d.ts +10 -0
  130. package/dist/types/UserType.js +1 -0
  131. package/dist/types/WebsitePropertiesType.d.ts +5 -0
  132. package/dist/types/WebsitePropertiesType.js +1 -0
  133. package/dist/types/WebsiteType.d.ts +23 -0
  134. package/dist/types/WebsiteType.js +1 -0
  135. package/dist/utils/InputValidators.d.ts +14 -0
  136. package/dist/utils/InputValidators.js +88 -0
  137. package/package.json +90 -0
@@ -0,0 +1,346 @@
1
+ export type RawWebsiteType = {
2
+ id: number;
3
+ name: string;
4
+ domain: string;
5
+ domainStage: string;
6
+ logo: string;
7
+ header: {
8
+ properties: {
9
+ logoAlign: 'left' | 'right' | 'center';
10
+ showLogo: boolean;
11
+ };
12
+ styles: {
13
+ alignItems?: string;
14
+ backgroundColor?: string;
15
+ borderColor?: string;
16
+ borderRadius?: string;
17
+ borderStyle?: string;
18
+ borderWidth?: string;
19
+ color?: string;
20
+ display?: string;
21
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
22
+ fluid?: boolean;
23
+ fontSize?: string;
24
+ fontWeight?: string;
25
+ height?: string;
26
+ marginTop?: string;
27
+ marginLeft?: string;
28
+ marginRight?: string;
29
+ marginBottom?: string;
30
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
31
+ paddingTop?: string;
32
+ paddingLeft?: string;
33
+ paddingRight?: string;
34
+ paddingBottom?: string;
35
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
36
+ width?: string;
37
+ };
38
+ };
39
+ footer: {
40
+ properties: {
41
+ text1: string;
42
+ text2: string;
43
+ text3: string;
44
+ };
45
+ styles: {
46
+ alignItems?: string;
47
+ backgroundColor?: string;
48
+ borderColor?: string;
49
+ borderRadius?: string;
50
+ borderStyle?: string;
51
+ borderWidth?: string;
52
+ color?: string;
53
+ display?: string;
54
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
55
+ fluid?: boolean;
56
+ fontSize?: string;
57
+ fontWeight?: string;
58
+ height?: string;
59
+ marginTop?: string;
60
+ marginLeft?: string;
61
+ marginRight?: string;
62
+ marginBottom?: string;
63
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
64
+ paddingTop?: string;
65
+ paddingLeft?: string;
66
+ paddingRight?: string;
67
+ paddingBottom?: string;
68
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
69
+ width?: string;
70
+ };
71
+ };
72
+ properties: {
73
+ loadingMessage: string;
74
+ social: {
75
+ facebook: {
76
+ path: string;
77
+ };
78
+ linktree: {
79
+ path: string;
80
+ };
81
+ instagram: {
82
+ path: string;
83
+ };
84
+ };
85
+ };
86
+ styles: {
87
+ alignItems?: string;
88
+ backgroundColor?: string;
89
+ backgroundImage?: string;
90
+ backgroundGradientColorStart?: string;
91
+ backgroundGradientColorEnd?: string;
92
+ backgroundPosition?: string;
93
+ backgroundSize?: string;
94
+ borderColor?: string;
95
+ borderRadius?: string;
96
+ borderStyle?: string;
97
+ borderWidth?: string;
98
+ color?: string;
99
+ display?: string;
100
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
101
+ fontSize?: string;
102
+ fontWeight?: string;
103
+ height?: string;
104
+ marginTop?: string;
105
+ marginLeft?: string;
106
+ marginRight?: string;
107
+ marginBottom?: string;
108
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
109
+ paddingTop?: string;
110
+ paddingLeft?: string;
111
+ paddingRight?: string;
112
+ paddingBottom?: string;
113
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
114
+ width?: string;
115
+ };
116
+ enabled: boolean;
117
+ publishedAt: string | null;
118
+ createdAt: string;
119
+ updatedAt: string;
120
+ deletedAt: string | null;
121
+ planId: number;
122
+ pages: Array<{
123
+ id: number;
124
+ websiteId: number;
125
+ title: string;
126
+ name: string;
127
+ path: string;
128
+ menu: number;
129
+ menuOrder: number;
130
+ menuType: 'link' | 'dropdown' | 'sections';
131
+ menuSections?: Array<{
132
+ section: string;
133
+ name: string;
134
+ order: number;
135
+ styles: {
136
+ alignItems?: string;
137
+ backgroundColor?: string;
138
+ borderColor?: string;
139
+ borderRadius?: string;
140
+ borderStyle?: string;
141
+ borderWidth?: string;
142
+ color?: string;
143
+ display?: string;
144
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
145
+ fluid?: boolean;
146
+ fontSize?: string;
147
+ fontWeight?: string;
148
+ height?: string;
149
+ marginTop?: string;
150
+ marginLeft?: string;
151
+ marginRight?: string;
152
+ marginBottom?: string;
153
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
154
+ paddingTop?: string;
155
+ paddingLeft?: string;
156
+ paddingRight?: string;
157
+ paddingBottom?: string;
158
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
159
+ width?: string;
160
+ };
161
+ }>;
162
+ enabled: boolean;
163
+ properties: {
164
+ size: {
165
+ xs: {
166
+ span: number;
167
+ offset?: number;
168
+ };
169
+ sm: {
170
+ span: number;
171
+ offset?: number;
172
+ };
173
+ md: {
174
+ span: number;
175
+ offset?: number;
176
+ };
177
+ lg: {
178
+ span: number;
179
+ offset?: number;
180
+ };
181
+ };
182
+ };
183
+ styles: {
184
+ alignItems?: string;
185
+ backgroundColor?: string;
186
+ borderColor?: string;
187
+ borderRadius?: string;
188
+ borderStyle?: string;
189
+ borderWidth?: string;
190
+ color?: string;
191
+ display?: string;
192
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
193
+ fluid?: boolean;
194
+ fontSize?: string;
195
+ fontWeight?: string;
196
+ height?: string;
197
+ marginTop?: string;
198
+ marginLeft?: string;
199
+ marginRight?: string;
200
+ marginBottom?: string;
201
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
202
+ paddingTop?: string;
203
+ paddingLeft?: string;
204
+ paddingRight?: string;
205
+ paddingBottom?: string;
206
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
207
+ width?: string;
208
+ };
209
+ createdAt: string;
210
+ updatedAt: string;
211
+ deletedAt: string | null;
212
+ components: Array<{
213
+ id: number;
214
+ pageId: number;
215
+ componentTypeId: number;
216
+ name: string;
217
+ properties: {
218
+ size: {
219
+ xs: {
220
+ span: number;
221
+ offset?: number;
222
+ };
223
+ sm: {
224
+ span: number;
225
+ offset?: number;
226
+ };
227
+ md: {
228
+ span: number;
229
+ offset?: number;
230
+ };
231
+ lg: {
232
+ span: number;
233
+ offset?: number;
234
+ };
235
+ };
236
+ };
237
+ styles: {
238
+ alignItems?: string;
239
+ backgroundColor?: string;
240
+ borderColor?: string;
241
+ borderRadius?: string;
242
+ borderStyle?: string;
243
+ borderWidth?: string;
244
+ color?: string;
245
+ display?: string;
246
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
247
+ fontSize?: string;
248
+ fontWeight?: string;
249
+ height?: string;
250
+ marginTop?: string;
251
+ marginLeft?: string;
252
+ marginRight?: string;
253
+ marginBottom?: string;
254
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
255
+ paddingTop?: string;
256
+ paddingLeft?: string;
257
+ paddingRight?: string;
258
+ paddingBottom?: string;
259
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
260
+ width?: string;
261
+ };
262
+ sort: number;
263
+ enabled: boolean;
264
+ createdAt: string;
265
+ updatedAt: string;
266
+ deletedAt: string | null;
267
+ elements: {
268
+ line: number;
269
+ content: [
270
+ {
271
+ id: number;
272
+ componentId: number;
273
+ elementTypeId: number;
274
+ componentParent: number | null;
275
+ sort: number;
276
+ properties: {
277
+ name: string;
278
+ title: string;
279
+ message: string;
280
+ type: string;
281
+ startHidden: boolean;
282
+ size: {
283
+ xs: {
284
+ span: number;
285
+ offset?: number;
286
+ };
287
+ sm: {
288
+ span: number;
289
+ offset?: number;
290
+ };
291
+ md: {
292
+ span: number;
293
+ offset?: number;
294
+ };
295
+ lg: {
296
+ span: number;
297
+ offset?: number;
298
+ };
299
+ };
300
+ path?: string;
301
+ mask?: string;
302
+ placeholder?: string;
303
+ required?: boolean;
304
+ inputValidateId?: number;
305
+ loadingTime?: number;
306
+ hideOnClick?: boolean;
307
+ actionId?: number;
308
+ successActionId?: number;
309
+ errorActionId?: number;
310
+ successMessageId?: number;
311
+ errorMessageId?: number;
312
+ };
313
+ styles: {
314
+ alignItems?: string;
315
+ backgroundColor?: string;
316
+ borderColor?: string;
317
+ borderRadius?: string;
318
+ borderStyle?: string;
319
+ borderWidth?: string;
320
+ color?: string;
321
+ display?: string;
322
+ float?: 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
323
+ fontSize?: string;
324
+ fontWeight?: string;
325
+ height?: string;
326
+ marginTop?: string;
327
+ marginLeft?: string;
328
+ marginRight?: string;
329
+ marginBottom?: string;
330
+ objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
331
+ paddingTop?: string;
332
+ paddingLeft?: string;
333
+ paddingRight?: string;
334
+ paddingBottom?: string;
335
+ textAlign?: 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
336
+ width?: string;
337
+ };
338
+ createdAt: string;
339
+ updatedAt: string;
340
+ deletedAt: string | null;
341
+ }
342
+ ];
343
+ };
344
+ }>;
345
+ }>;
346
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { StylesType } from './StylesType.js';
2
+ import type { ColumnWidthType } from './ColumnWidthType.js';
3
+ import type { ComponentType } from './ComponentType.js';
4
+ import type { SectionType } from './SectionType.js';
5
+ export interface SectionColumnType {
6
+ id: number;
7
+ width: ColumnWidthType;
8
+ offset: ColumnWidthType;
9
+ sort: number;
10
+ properties: Record<string, unknown>;
11
+ styles: StylesType;
12
+ components: ComponentType[];
13
+ childSections: SectionType[];
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { StylesType } from './StylesType.js';
2
+ import type { SectionColumnType } from './SectionColumnType.js';
3
+ export interface SectionType {
4
+ id: number;
5
+ sectionType: 'container' | 'container-fluid' | 'row';
6
+ sort: number;
7
+ properties: Record<string, unknown>;
8
+ styles: StylesType;
9
+ columns: SectionColumnType[];
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface SocialPropertiesType {
2
+ instagram: {
3
+ path: string;
4
+ };
5
+ facebook: {
6
+ path: string;
7
+ };
8
+ linktree: {
9
+ path: string;
10
+ };
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ export type Float = 'left' | 'right' | 'none' | 'inline-start' | 'inline-end';
2
+ export type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
3
+ export type ObjectFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
4
+ export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
5
+ export interface StylesType {
6
+ alignItems?: string;
7
+ backgroundColor?: string;
8
+ backgroundGradientColorStart?: string;
9
+ backgroundGradientColorEnd?: string;
10
+ backgroundImage?: string;
11
+ backgroundSize?: string;
12
+ backgroundPosition?: string;
13
+ borderColor?: string;
14
+ borderRadius?: string;
15
+ borderStyle?: string;
16
+ borderWidth?: string;
17
+ color?: string;
18
+ display?: string;
19
+ float?: Float;
20
+ fluid?: boolean;
21
+ fontSize?: string;
22
+ fontWeight?: FontWeight;
23
+ height?: string;
24
+ marginTop?: string;
25
+ marginLeft?: string;
26
+ marginRight?: string;
27
+ marginBottom?: string;
28
+ objectFit?: ObjectFit;
29
+ paddingTop?: string;
30
+ paddingLeft?: string;
31
+ paddingRight?: string;
32
+ paddingBottom?: string;
33
+ textAlign?: TextAlign;
34
+ width?: string;
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export interface UserType {
2
+ id: number;
3
+ email: string;
4
+ password: string;
5
+ defaultWebsiteId: number;
6
+ token: string;
7
+ accessLevel: {
8
+ id: number;
9
+ };
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { SocialPropertiesType } from './SocialPropertiesType.js';
2
+ export interface WebsitePropertiesType {
3
+ loadingMessage: string;
4
+ social: SocialPropertiesType;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { PageType } from './PageType.js';
2
+ import type { StylesType } from './StylesType.js';
3
+ import type { HeaderType } from './HeaderType.js';
4
+ import type { FooterType } from './FooterType.js';
5
+ import type { WebsitePropertiesType } from './WebsitePropertiesType.js';
6
+ export interface WebsiteType {
7
+ id: number;
8
+ name: string;
9
+ domain: string;
10
+ domainStage: string;
11
+ logo: string;
12
+ header: HeaderType;
13
+ footer: FooterType;
14
+ properties: WebsitePropertiesType;
15
+ styles: StylesType;
16
+ enabled: boolean;
17
+ publishedAt: string | null;
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ deletedAt: string | null;
21
+ planId: number;
22
+ pages: PageType[];
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ export interface ValidationResult {
2
+ success: boolean;
3
+ message?: string;
4
+ [key: string]: boolean | string | undefined;
5
+ }
6
+ export declare function nameValidation(name: string): ValidationResult;
7
+ export declare function birthDateValidation(birthDate: string): ValidationResult;
8
+ export declare function dateValidate(data: string): boolean;
9
+ export declare function emailValidation(email: string): ValidationResult;
10
+ export declare function emailValidate(email: string): boolean;
11
+ export declare function cpfValidation(cpf: string): ValidationResult;
12
+ export declare function cpfValidate(cpf: string): boolean;
13
+ export declare function phoneValidation(phone: string): ValidationResult;
14
+ export declare function phoneValidate(cel: string): boolean;
@@ -0,0 +1,88 @@
1
+ export function nameValidation(name) {
2
+ if (!name || name.length === 0) {
3
+ return { success: false, message: 'Campo obrigatório' };
4
+ }
5
+ if (name.length < 3) {
6
+ return { success: false, message: 'Nome muito curto' };
7
+ }
8
+ if (name.length > 50) {
9
+ return { success: false, message: 'Nome muito longo' };
10
+ }
11
+ return { success: true };
12
+ }
13
+ export function birthDateValidation(birthDate) {
14
+ if (!birthDate || birthDate.length === 0) {
15
+ return { success: false, message: 'Campo obrigatório' };
16
+ }
17
+ if (!dateValidate(birthDate)) {
18
+ return { success: false, message: 'Data inválida' };
19
+ }
20
+ return { success: true };
21
+ }
22
+ export function dateValidate(data) {
23
+ const [dia, mes, ano] = data.split('/');
24
+ if (!dia || !mes || !ano)
25
+ return false;
26
+ const d = new Date(`${ano}-${mes}-${dia}`);
27
+ const hoje = new Date();
28
+ return /^\d{2}\/\d{2}\/\d{4}$/.test(data) && !Number.isNaN(d.getTime()) && d <= hoje;
29
+ }
30
+ export function emailValidation(email) {
31
+ if (!email || email.length === 0) {
32
+ return { success: false, message: 'Campo obrigatório' };
33
+ }
34
+ if (emailValidate(email)) {
35
+ return { success: true };
36
+ }
37
+ return { success: false, message: 'Email inválido' };
38
+ }
39
+ export function emailValidate(email) {
40
+ return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
41
+ }
42
+ export function cpfValidation(cpf) {
43
+ const onlyDigits = cpf === null || cpf === void 0 ? void 0 : cpf.replaceAll(/\D/g, '');
44
+ if (!cpf || onlyDigits.length === 0) {
45
+ return { success: false, message: 'Campo obrigatório' };
46
+ }
47
+ else if (cpfValidate(onlyDigits)) {
48
+ return { success: true };
49
+ }
50
+ else {
51
+ return { success: false, message: 'CPF inválido' };
52
+ }
53
+ }
54
+ export function cpfValidate(cpf) {
55
+ cpf = cpf.replaceAll(/[^\d]+/g, '');
56
+ if (cpf.length !== 11 || /^(\d)\1+$/.test(cpf))
57
+ return false;
58
+ let soma = 0;
59
+ for (let i = 0; i < 9; i++)
60
+ soma += Number.parseInt(cpf.charAt(i)) * (10 - i);
61
+ let resto = 11 - (soma % 11);
62
+ if (resto === 10 || resto === 11)
63
+ resto = 0;
64
+ if (resto !== Number.parseInt(cpf.charAt(9)))
65
+ return false;
66
+ soma = 0;
67
+ for (let i = 0; i < 10; i++)
68
+ soma += Number.parseInt(cpf.charAt(i)) * (11 - i);
69
+ resto = 11 - (soma % 11);
70
+ if (resto === 10 || resto === 11)
71
+ resto = 0;
72
+ return resto === Number.parseInt(cpf.charAt(10));
73
+ }
74
+ export function phoneValidation(phone) {
75
+ const onlyDigits = phone === null || phone === void 0 ? void 0 : phone.replaceAll(/\D/g, '');
76
+ if (!onlyDigits || onlyDigits.length === 0) {
77
+ return { success: false, message: 'Campo obrigatório' };
78
+ }
79
+ else if (phoneValidate(phone)) {
80
+ return { success: true };
81
+ }
82
+ else {
83
+ return { success: false, message: 'Celular inválido' };
84
+ }
85
+ }
86
+ export function phoneValidate(cel) {
87
+ return /^\(\d{2}\) \d{5}-\d{4}$/.test(cel);
88
+ }
package/package.json ADDED
@@ -0,0 +1,90 @@
1
+ {
2
+ "name": "lib-pixelbuild",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.d.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "sideEffects": [
17
+ "*.css"
18
+ ],
19
+ "scripts": {
20
+ "prepublishOnly": "npm run build",
21
+ "build": "tsc && tsc-esm-fix dist",
22
+ "test": "echo \"Error: no test specified\" && exit 1",
23
+ "lint": "eslint . --ext .ts,.tsx",
24
+ "lint:fix": "eslint . --ext .ts,.tsx --fix",
25
+ "format": "prettier --write .",
26
+ "build:watch": "node scripts/build-watch.mjs",
27
+ "link:global": "npm link",
28
+ "unlink:global": "npm unlink --no-save",
29
+ "link:consumer-peers": "node scripts/link-consumer-peers.mjs"
30
+ },
31
+ "keywords": [
32
+ "pixelbuild",
33
+ "react",
34
+ "render-engine",
35
+ "schema-driven",
36
+ "website-builder"
37
+ ],
38
+ "author": {
39
+ "name": "Lucas da Silva",
40
+ "email": "lucas.2601@gmail.com"
41
+ },
42
+ "license": "ISC",
43
+ "description": "React render engine for schema-driven PixelBuild websites",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/Lucas-SCCP/lib-pixelbuild.git"
47
+ },
48
+ "bugs": {
49
+ "url": "https://github.com/Lucas-SCCP/lib-pixelbuild/issues"
50
+ },
51
+ "homepage": "https://github.com/Lucas-SCCP/lib-pixelbuild#readme",
52
+ "devDependencies": {
53
+ "@eslint/js": "^9.29.0",
54
+ "@types/node": "^24.0.13",
55
+ "@types/react": "^18.3.3",
56
+ "@types/react-bootstrap": "^1.0.1",
57
+ "@types/react-dom": "^18.3.0",
58
+ "@types/react-input-mask": "^3.0.6",
59
+ "@types/react-slick": "^0.23.13",
60
+ "@typescript-eslint/eslint-plugin": "^8.35.0",
61
+ "@typescript-eslint/parser": "^8.35.0",
62
+ "bootstrap": "^5.3.7",
63
+ "eslint": "^9.31.0",
64
+ "eslint-config-prettier": "^10.1.5",
65
+ "eslint-plugin-prettier": "^5.5.1",
66
+ "eslint-plugin-react": "^7.37.5",
67
+ "eslint-plugin-react-hooks": "^5.2.0",
68
+ "eslint-plugin-react-refresh": "^0.4.20",
69
+ "prettier": "^3.6.2",
70
+ "tsc-esm-fix": "^3.1.2",
71
+ "typescript": "^5.8.3",
72
+ "typescript-eslint": "^8.34.1"
73
+ },
74
+ "peerDependencies": {
75
+ "bootstrap": "^5.0.0",
76
+ "dompurify": "^3.2.6",
77
+ "react": "^18.0.0",
78
+ "react-bootstrap": "^2.10.10",
79
+ "react-dom": "^18.0.0",
80
+ "react-ga4": "^2.1.0",
81
+ "react-helmet-async": "^2.0.5",
82
+ "react-icons": "^5.3.0",
83
+ "react-input-mask": "^2.0.4",
84
+ "react-router-dom": "^6.28.0 || ^7.0.0",
85
+ "react-slick": "^0.30.3",
86
+ "slick-carousel": "^1.8.1",
87
+ "zustand": "^5.0.5",
88
+ "keen-slider": "^6.8.6"
89
+ }
90
+ }