app-studio 0.1.44 → 0.2.2

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.
@@ -1,915 +0,0 @@
1
- import React, { createContext, useContext, useEffect, useState } from 'react';
2
- import Color from 'color-convert';
3
- import styled from 'styled-components';
4
-
5
- const palette = {
6
- white: {
7
- 50: 'rgba(255, 255, 255, 0.04)',
8
- 100: 'rgba(255, 255, 255, 0.08)',
9
- 200: 'rgba(255, 255, 255, 0.16)',
10
- 300: 'rgba(255, 255, 255, 0.24)',
11
- 400: 'rgba(255, 255, 255, 0.36)',
12
- 500: 'rgba(255, 255, 255, 0.48)',
13
- 600: 'rgba(255, 255, 255, 0.64)',
14
- 700: 'rgba(255, 255, 255, 0.80)',
15
- 800: 'rgba(255, 255, 255, 0.92)',
16
- 900: 'rgba(255, 255, 255, 1)'
17
- },
18
- black: {
19
- 50: 'rgba(0, 0, 0, 0.04)',
20
- 100: 'rgba(0, 0, 0, 0.08)',
21
- 200: 'rgba(0, 0, 0, 0.16)',
22
- 300: 'rgba(0, 0, 0, 0.24)',
23
- 400: 'rgba(0, 0, 0, 0.36)',
24
- 500: 'rgba(0, 0, 0, 0.48)',
25
- 600: 'rgba(0, 0, 0, 0.64)',
26
- 700: 'rgba(0, 0, 0, 0.80)',
27
- 800: 'rgba(0, 0, 0, 0.92)',
28
- 900: 'rgba(0, 0, 0, 1)'
29
- },
30
- rose: {
31
- 50: '#fff1f2',
32
- 100: '#ffe4e6',
33
- 200: '#fecdd3',
34
- 300: '#fda4af',
35
- 400: '#fb7185',
36
- 500: '#f43f5e',
37
- 600: '#e11d48',
38
- 700: '#be123c',
39
- 800: '#9f1239',
40
- 900: '#881337'
41
- },
42
- pink: {
43
- 50: '#fdf2f8',
44
- 100: '#fce7f3',
45
- 200: '#fbcfe8',
46
- 300: '#f9a8d4',
47
- 400: '#f472b6',
48
- 500: '#ec4899',
49
- 600: '#db2777',
50
- 700: '#be185d',
51
- 800: '#9d174d',
52
- 900: '#831843'
53
- },
54
- fuchsia: {
55
- 50: '#fdf4ff',
56
- 100: '#fae8ff',
57
- 200: '#f5d0fe',
58
- 300: '#f0abfc',
59
- 400: '#e879f9',
60
- 500: '#d946ef',
61
- 600: '#c026d3',
62
- 700: '#a21caf',
63
- 800: '#86198f',
64
- 900: '#701a75'
65
- },
66
- purple: {
67
- 50: '#faf5ff',
68
- 100: '#f3e8ff',
69
- 200: '#e9d5ff',
70
- 300: '#d8b4fe',
71
- 400: '#c084fc',
72
- 500: '#a855f7',
73
- 600: '#9333ea',
74
- 700: '#7e22ce',
75
- 800: '#6b21a8',
76
- 900: '#581c87'
77
- },
78
- violet: {
79
- 50: '#f5f3ff',
80
- 100: '#ede9fe',
81
- 200: '#ddd6fe',
82
- 300: '#c4b5fd',
83
- 400: '#a78bfa',
84
- 500: '#8b5cf6',
85
- 600: '#7c3aed',
86
- 700: '#6d28d9',
87
- 800: '#5b21b6',
88
- 900: '#4c1d95'
89
- },
90
- indigo: {
91
- 50: '#eef2ff',
92
- 100: '#e0e7ff',
93
- 200: '#c7d2fe',
94
- 300: '#a5b4fc',
95
- 400: '#818cf8',
96
- 500: '#6366f1',
97
- 600: '#4f46e5',
98
- 700: '#4338ca',
99
- 800: '#3730a3',
100
- 900: '#312e81'
101
- },
102
- blue: {
103
- 50: '#eff6ff',
104
- 100: '#dbeafe',
105
- 200: '#bfdbfe',
106
- 300: '#93c5fd',
107
- 400: '#60a5fa',
108
- 500: '#3b82f6',
109
- 600: '#2563eb',
110
- 700: '#1d4ed8',
111
- 800: '#1e40af',
112
- 900: '#1e3a8a'
113
- },
114
- lightBlue: {
115
- 50: '#f0f9ff',
116
- 100: '#e0f2fe',
117
- 200: '#bae6fd',
118
- 300: '#7dd3fc',
119
- 400: '#38bdf8',
120
- 500: '#0ea5e9',
121
- 600: '#0284c7',
122
- 700: '#0369a1',
123
- 800: '#075985',
124
- 900: '#0c4a6e'
125
- },
126
- cyan: {
127
- 50: '#ecfeff',
128
- 100: '#cffafe',
129
- 200: '#a5f3fc',
130
- 300: '#67e8f9',
131
- 400: '#22d3ee',
132
- 500: '#06b6d4',
133
- 600: '#0891b2',
134
- 700: '#0e7490',
135
- 800: '#155e75',
136
- 900: '#164e63'
137
- },
138
- teal: {
139
- 50: '#f0fdfa',
140
- 100: '#ccfbf1',
141
- 200: '#99f6e4',
142
- 300: '#5eead4',
143
- 400: '#2dd4bf',
144
- 500: '#14b8a6',
145
- 600: '#0d9488',
146
- 700: '#0f766e',
147
- 800: '#115e59',
148
- 900: '#134e4a'
149
- },
150
- emerald: {
151
- 50: '#ecfdf5',
152
- 100: '#d1fae5',
153
- 200: '#a7f3d0',
154
- 300: '#6ee7b7',
155
- 400: '#34d399',
156
- 500: '#10b981',
157
- 600: '#059669',
158
- 700: '#047857',
159
- 800: '#065f46',
160
- 900: '#064e3b'
161
- },
162
- green: {
163
- 50: '#f0fdf4',
164
- 100: '#dcfce7',
165
- 200: '#bbf7d0',
166
- 300: '#86efac',
167
- 400: '#4ade80',
168
- 500: '#22c55e',
169
- 600: '#16a34a',
170
- 700: '#15803d',
171
- 800: '#166534',
172
- 900: '#14532d'
173
- },
174
- lime: {
175
- 50: '#f7fee7',
176
- 100: '#ecfccb',
177
- 200: '#d9f99d',
178
- 300: '#bef264',
179
- 400: '#a3e635',
180
- 500: '#84cc16',
181
- 600: '#65a30d',
182
- 700: '#4d7c0f',
183
- 800: '#3f6212',
184
- 900: '#365314'
185
- },
186
- yellow: {
187
- 50: '#fefce8',
188
- 100: '#fef9c3',
189
- 200: '#fef08a',
190
- 300: '#fde047',
191
- 400: '#facc15',
192
- 500: '#eab308',
193
- 600: '#ca8a04',
194
- 700: '#a16207',
195
- 800: '#854d0e',
196
- 900: '#713f12'
197
- },
198
- amber: {
199
- 50: '#fffbeb',
200
- 100: '#fef3c7',
201
- 200: '#fde68a',
202
- 300: '#fcd34d',
203
- 400: '#fbbf24',
204
- 500: '#f59e0b',
205
- 600: '#d97706',
206
- 700: '#b45309',
207
- 800: '#92400e',
208
- 900: '#78350f'
209
- },
210
- orange: {
211
- 50: '#fff7ed',
212
- 100: '#ffedd5',
213
- 200: '#fed7aa',
214
- 300: '#fdba74',
215
- 400: '#fb923c',
216
- 500: '#f97316',
217
- 600: '#ea580c',
218
- 700: '#c2410c',
219
- 800: '#9a3412',
220
- 900: '#7c2d12'
221
- },
222
- red: {
223
- 50: '#fef2f2',
224
- 100: '#fee2e2',
225
- 200: '#fecaca',
226
- 300: '#fca5a5',
227
- 400: '#f87171',
228
- 500: '#ef4444',
229
- 600: '#dc2626',
230
- 700: '#b91c1c',
231
- 800: '#991b1b',
232
- 900: '#7f1d1d'
233
- },
234
- warmGray: {
235
- 50: '#fafaf9',
236
- 100: '#f5f5f4',
237
- 200: '#e7e5e4',
238
- 300: '#d6d3d1',
239
- 400: '#a8a29e',
240
- 500: '#78716c',
241
- 600: '#57534e',
242
- 700: '#44403c',
243
- 800: '#292524',
244
- 900: '#1c1917'
245
- },
246
- trueGray: {
247
- 50: '#fafafa',
248
- 100: '#f5f5f5',
249
- 200: '#e5e5e5',
250
- 300: '#d4d4d4',
251
- 400: '#a3a3a3',
252
- 500: '#737373',
253
- 600: '#525252',
254
- 700: '#404040',
255
- 800: '#262626',
256
- 900: '#171717'
257
- },
258
- gray: {
259
- 50: '#fafafa',
260
- 100: '#f4f4f5',
261
- 200: '#e4e4e7',
262
- 300: '#d4d4d8',
263
- 400: '#a1a1aa',
264
- 500: '#71717a',
265
- 600: '#52525b',
266
- 700: '#3f3f46',
267
- 800: '#27272a',
268
- 900: '#18181b'
269
- },
270
- dark: {
271
- 50: '#18181b',
272
- 100: '#27272a',
273
- 200: '#3f3f46',
274
- 300: '#52525b',
275
- 400: '#71717a',
276
- 500: '#a1a1aa',
277
- 600: '#d4d4d8',
278
- 700: '#e4e4e7',
279
- 800: '#f4f4f5',
280
- 900: '#fafafa'
281
- },
282
- coolGray: {
283
- 50: '#f9fafb',
284
- 100: '#f3f4f6',
285
- 200: '#e5e7eb',
286
- 300: '#d1d5db',
287
- 400: '#9ca3af',
288
- 500: '#6b7280',
289
- 600: '#4b5563',
290
- 700: '#374151',
291
- 800: '#1f2937',
292
- 900: '#111827'
293
- },
294
- blueGray: {
295
- 50: '#f8fafc',
296
- 100: '#f1f5f9',
297
- 200: '#e2e8f0',
298
- 300: '#cbd5e1',
299
- 400: '#94a3b8',
300
- 500: '#64748b',
301
- 600: '#475569',
302
- 700: '#334155',
303
- 800: '#1e293b',
304
- 900: '#0f172a'
305
- }
306
- };
307
-
308
- const defaultThemeMain = {
309
- primary: 'color.black',
310
- secondary: 'color.blue',
311
- success: 'color.green.500',
312
- error: 'color.red.500',
313
- warning: 'color.orange.500',
314
- disabled: 'color.gray.500',
315
- loading: 'color.dark.500'
316
- };
317
- const defaultColors = {
318
- white: '#FFFFFF',
319
- black: '#000000',
320
- red: '#FF0000',
321
- green: '#00FF00',
322
- blue: '#0000FF',
323
- yellow: '#FFFF00',
324
- cyan: '#00FFFF',
325
- magenta: '#FF00FF',
326
- grey: '#808080',
327
- orange: '#FFA500',
328
- brown: '#A52A2A',
329
- purple: '#800080',
330
- pink: '#FFC0CB',
331
- lime: '#00FF00',
332
- teal: '#008080',
333
- navy: '#000080',
334
- olive: '#808000',
335
- maroon: '#800000',
336
- gold: '#FFD700',
337
- silver: '#C0C0C0',
338
- indigo: '#4B0082',
339
- violet: '#EE82EE',
340
- beige: '#F5F5DC',
341
- turquoise: '#40E0D0',
342
- coral: '#FF7F50',
343
- chocolate: '#D2691E',
344
- skyBlue: '#87CEEB',
345
- plum: '#DDA0DD',
346
- darkGreen: '#006400',
347
- salmon: '#FA8072'
348
- };
349
- const ThemeContext = /*#__PURE__*/createContext({
350
- getColor: name => {
351
- return name;
352
- },
353
- colors: {
354
- main: defaultColors,
355
- palette: palette
356
- },
357
- theme: {
358
- main: defaultThemeMain,
359
- components: {}
360
- }
361
- });
362
- const useTheme = () => useContext(ThemeContext);
363
- const ThemeProvider = _ref => {
364
- let {
365
- theme = {
366
- main: defaultThemeMain,
367
- components: {}
368
- },
369
- colors = {
370
- main: defaultColors,
371
- palette: palette
372
- },
373
- children
374
- } = _ref;
375
- const getColor = name => {
376
- if (name === 'transparent') return name;
377
- try {
378
- // Si le nom commence par "theme.", nous recherchons dans les couleurs du thème
379
- if (name.startsWith('theme.')) {
380
- const keys = name.split('.');
381
- if (keys[1] !== undefined && typeof theme.components[keys[1]] == 'object' && theme.components[keys[1]][keys[2]] !== undefined) {
382
- return getColor(theme.components[keys[1]][keys[2]]);
383
- } else if (theme.main[keys[1]] && theme.main[keys[1]] !== undefined) {
384
- return getColor(theme.main[keys[1]]);
385
- } else {
386
- console.log('Color ' + name + ' not found');
387
- }
388
- }
389
- // Si le nom commence par "color.", nous recherchons dans la palette
390
- else if (name.startsWith('color.')) {
391
- const keys = name.split('.'); // Retirer le préfixe "color."
392
- if (colors.palette && colors.palette[keys[1]][keys[2]] !== undefined) {
393
- return colors.palette[keys[1]][keys[2]];
394
- } else if (colors.palette && colors.palette[keys[1]][parseInt(keys[2])] !== undefined) {
395
- return colors.palette[keys[1]][parseInt(keys[2])];
396
- } else if (colors.main && colors.main[keys[1]] !== undefined) {
397
- return colors.main[keys[1]];
398
- } else {
399
- console.log('Color ' + name + ' not found');
400
- }
401
- }
402
- } catch (e) {}
403
- return name;
404
- };
405
- return /*#__PURE__*/React.createElement(ThemeContext.Provider, {
406
- value: {
407
- getColor,
408
- theme: {
409
- main: {
410
- ...defaultThemeMain,
411
- ...theme.main
412
- },
413
- components: {
414
- ...theme.components
415
- }
416
- },
417
- colors: {
418
- main: {
419
- ...defaultColors,
420
- ...colors.main
421
- },
422
- palette: {
423
- ...palette,
424
- ...colors.palette
425
- }
426
- }
427
- }
428
- }, children);
429
- };
430
-
431
- const Shadows = {
432
- 0: {
433
- shadowColor: '#000',
434
- shadowOffset: {
435
- width: 1,
436
- height: 2
437
- },
438
- shadowOpacity: 0.18,
439
- shadowRadius: 1.0
440
- },
441
- 1: {
442
- shadowColor: '#000',
443
- shadowOffset: {
444
- width: 2,
445
- height: 2
446
- },
447
- shadowOpacity: 0.2,
448
- shadowRadius: 1.41
449
- },
450
- 2: {
451
- shadowColor: '#000',
452
- shadowOffset: {
453
- width: 3,
454
- height: 3
455
- },
456
- shadowOpacity: 0.22,
457
- shadowRadius: 2.22
458
- },
459
- 3: {
460
- shadowColor: '#000',
461
- shadowOffset: {
462
- width: 4,
463
- height: 4
464
- },
465
- shadowOpacity: 0.23,
466
- shadowRadius: 2.62
467
- },
468
- 4: {
469
- shadowColor: '#000',
470
- shadowOffset: {
471
- width: 5,
472
- height: 5
473
- },
474
- shadowOpacity: 0.25,
475
- shadowRadius: 3.84
476
- },
477
- 5: {
478
- shadowColor: '#000',
479
- shadowOffset: {
480
- width: 6,
481
- height: 6
482
- },
483
- shadowOpacity: 0.27,
484
- shadowRadius: 4.65
485
- },
486
- 6: {
487
- shadowColor: '#000',
488
- shadowOffset: {
489
- width: 7,
490
- height: 7
491
- },
492
- shadowOpacity: 0.29,
493
- shadowRadius: 4.65
494
- },
495
- 7: {
496
- shadowColor: '#000',
497
- shadowOffset: {
498
- width: 8,
499
- height: 8
500
- },
501
- shadowOpacity: 0.3,
502
- shadowRadius: 4.65
503
- },
504
- 8: {
505
- shadowColor: '#000',
506
- shadowOffset: {
507
- width: 9,
508
- height: 9
509
- },
510
- shadowOpacity: 0.32,
511
- shadowRadius: 5.46
512
- },
513
- 9: {
514
- shadowColor: '#000',
515
- shadowOffset: {
516
- width: 10,
517
- height: 10
518
- },
519
- shadowOpacity: 0.34,
520
- shadowRadius: 6.27
521
- }
522
- };
523
-
524
- const StyleProps = /*#__PURE__*/new Set(['alignContent', 'alignItems', 'alignSelf', 'alignmentBaseline', 'all', 'animation', 'animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction', 'appearance', 'backdropFilter', 'backfaceVisibility', 'background', 'backgroundAttachment', 'backgroundBlendMode', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPosition', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundRepeatX', 'backgroundRepeatY', 'backgroundSize', 'baselineShift', 'blockSize', 'border', 'borderBlockEnd', 'borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth', 'borderBlockStart', 'borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth', 'borderBottom', 'borderBottomColor', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStyle', 'borderBottomWidth', 'borderCollapse', 'borderColor', 'borderImage', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderInlineEnd', 'borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth', 'borderInlineStart', 'borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth', 'borderLeft', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRadius', 'borderRight', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderSpacing', 'borderStyle', 'borderTop', 'borderTopColor', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStyle', 'borderTopWidth', 'borderWidth', 'bottom', 'boxShadow', 'boxSizing', 'breakAfter', 'breakBefore', 'breakInside', 'bufferedRendering', 'captionSide', 'caretColor', 'clear', 'clip', 'clipPath', 'clipRule', 'color', 'colorInterpolation', 'colorInterpolationFilters', 'colorRendering', 'columnCount', 'columnFill', 'columnGap', 'columnRule', 'columnRuleColor', 'columnRuleStyle', 'columnRuleWidth', 'columnSpan', 'columnWidth', 'columns', 'contain', 'content', 'counterIncrement', 'counterReset', 'cursor', 'cx', 'cy', 'd', 'direction', 'display', 'dominantBaseline', 'emptyCells', 'fill', 'fillOpacity', 'fillRule', 'filter', 'flex', 'flexBasis', 'flexDirection', 'flexFlow', 'flexGrow', 'flexShrink', 'flexWrap', 'float', 'floodColor', 'floodOpacity', 'font', 'fontDisplay', 'fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontSize', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariationSettings', 'fontWeight', 'gap', 'grid', 'gridArea', 'gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridColumn', 'gridColumnEnd', 'gridColumnGap', 'gridColumnStart', 'gridGap', 'gridRow', 'gridRowEnd', 'gridRowGap', 'gridRowStart', 'gridTemplate', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows', 'height', 'hyphens', 'imageRendering', 'inlineSize', 'isolation', 'justifyContent', 'justifyItems', 'justifySelf', 'left', 'letterSpacing', 'lightingColor', 'lineBreak', 'lineHeight', 'listStyle', 'listStyleImage', 'listStylePosition', 'listStyleType', 'margin', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginTop', 'marker', 'markerEnd', 'markerMid', 'markerStart', 'mask', 'maskType', 'maxBlockSize', 'maxHeight', 'maxInlineSize', 'maxWidth', 'maxZoom', 'minBlockSize', 'minHeight', 'minInlineSize', 'minWidth', 'minZoom', 'mixBlendMode', 'objectFit', 'objectPosition', 'offset', 'offsetDistance', 'offsetPath', 'offsetRotate', 'opacity', 'order', 'orientation', 'orphans', 'outline', 'outlineColor', 'outlineOffset', 'outlineStyle', 'outlineWidth', 'overflow', 'overflowAnchor', 'overflowWrap', 'overflowX', 'overflowY', 'overscrollBehavior', 'overscrollBehaviorBlock', 'overscrollBehaviorInline', 'overscrollBehaviorX', 'overscrollBehaviorY', 'padding', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingTop', 'page', 'pageBreakAfter', 'pageBreakBefore', 'pageBreakInside', 'paintOrder', 'perspective', 'perspectiveOrigin', 'placeContent', 'placeItems', 'placeSelf', 'pointerEvents', 'position', 'quotes', 'r', 'resize', 'right', 'rowGap', 'rx', 'ry', 'scrollBehavior', 'scrollMargin', 'scrollMarginBlock', 'scrollMarginBlockEnd', 'scrollMarginBlockStart', 'scrollMarginBottom', 'scrollMarginInline', 'scrollMarginInlineEnd', 'scrollMarginInlineStart', 'scrollMarginLeft', 'scrollMarginRight', 'scrollMarginTop', 'scrollPadding', 'scrollPaddingBlock', 'scrollPaddingBlockEnd', 'scrollPaddingBlockStart', 'scrollPaddingBottom', 'scrollPaddingInline', 'scrollPaddingInlineEnd', 'scrollPaddingInlineStart', 'scrollPaddingLeft', 'scrollPaddingRight', 'scrollPaddingTop', 'scrollSnapAlign', 'scrollSnapStop', 'scrollSnapType', 'shapeImageThreshold', 'shapeMargin', 'shapeOutside', 'shapeRendering', 'size', 'speak', 'src', 'stopColor', 'stopOpacity', 'stroke', 'strokeDasharray', 'strokeDashoffset', 'strokeLinecap', 'strokeLinejoin', 'strokeMiterlimit', 'strokeOpacity', 'strokeWidth', 'tabSize', 'tableLayout', 'textAlign', 'textAlignLast', 'textAnchor', 'textCombineUpright', 'textDecoration', 'textDecorationColor', 'textDecorationLine', 'textDecorationSkipInk', 'textDecorationStyle', 'textIndent', 'textOrientation', 'textOverflow', 'textRendering', 'textShadow', 'textSizeAdjust', 'textTransform', 'textUnderlinePosition', 'top', 'touchAction', 'transform', 'transformBox', 'transformOrigin', 'transformStyle', 'transition', 'transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction', 'unicodeBidi', 'unicodeRange', 'userSelect', 'userZoom', 'vectorEffect', 'verticalAlign', 'visibility', 'whiteSpace', 'widows', 'width', 'willChange', 'wordBreak', 'wordSpacing', 'wordWrap', 'writingMode', 'x', 'y', 'zIndex', 'zoom', 'alwaysBounceHorizontal', 'alwaysBounceVertical', 'automaticallyAdjustContentInsets', 'bounces', 'bouncesZoom', 'canCancelContentTouches', 'centerContent', 'contentLayoutStyle', 'contentInset', 'contentInsetAdjustmentBehavior', 'contentOffset', 'decelerationRate', 'directionalLockEnabled', 'disableIntervalMomentum', 'disableScrollViewPanResponder', 'endFillColor', 'fadingEdgeLength', 'horizontal', 'indicatorStyle', 'invertStickyHeaders', 'keyboardDismissMode', 'keyboardShouldPersistTaps', 'maintainVisibleContentPosition', 'maximumZoomScale', 'minimumZoomScale', 'nestedScrollEnabled', 'onContentSizeChange', 'onMomentumScrollBegin', 'onMomentumScrollEnd', 'onScroll', 'onScrollBeginDrag', 'onScrollEndDrag', 'onScrollToTop', 'overScrollMode', 'pagingEnabled', 'persistentScrollbar', 'pinchGestureEnabled', 'refreshControl', 'removeClippedSubviews', 'scrollBarThumbImage', 'scrollEnabled', 'scrollEventThrottle', 'scrollIndicatorInsets', 'scrollPerfTag', 'scrollToOverflowEnabled', 'scrollsToTop', 'DEPRECATED_sendUpdatedChildFrames', 'showsHorizontalScrollIndicator', 'showsVerticalScrollIndicator', 'snapToAlignment', 'snapToEnd', 'snapToInterval', 'snapToOffsets', 'snapToStart', 'stickyHeaderIndices', 'zoomScale', 'borderRightColor', 'backfaceVisibility', 'borderBottomColor', 'borderBottomEndRadius', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStartRadius', 'borderBottomWidth', 'borderColor', 'borderEndColor', 'borderLeftColor', 'borderLeftWidth', 'borderRadius', 'backgroundColor', 'borderRightWidth', 'borderStartColor', 'borderStyle', 'borderTopColor', 'borderTopEndRadius', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStartRadius', 'borderTopWidth', 'borderWidth', 'border', 'opacity', 'elevation', 'shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius', 'alignContent', 'alignItems', 'alignSelf', 'aspectRatio', 'borderBottomWidth', 'borderEndWidth', 'borderLeftWidth', 'borderRightWidth', 'borderStartWidth', 'borderTopWidth', 'borderWidth', 'bottom', 'direction', 'display', 'end', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'height', 'justifyContent', 'left', 'margin', 'marginBottom', 'marginEnd', 'marginHorizontal', 'marginLeft', 'marginRight', 'marginStart', 'marginTop', 'marginVertical', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'overflow', 'overflowX', 'overflowY', 'padding', 'paddingBottom', 'paddingEnd', 'paddingHorizontal', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'paddingVertical', 'position', 'right', 'start', 'top', 'width', 'zIndex', 'borderTopRightRadius', 'backfaceVisibility', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderColor', 'borderRadius', 'borderTopLeftRadius', 'backgroundColor', 'borderWidth', 'opacity', 'overflow', 'overflowX', 'overflowY', 'resizeMode', 'tintColor', 'overlayColor', 'transform', 'transformMatrix', 'rotation', 'scaleX', 'scaleY', 'translateX', 'translateY', 'perspective', 'rotate', 'rotateX', 'rotateY', 'rotateZ', 'scale', 'skewX', 'skewY', 'testID', 'decomposedMatrix']);
525
- const nonStyleAttributes = /*#__PURE__*/new Set(['length', 'parentRule', 'src']);
526
- const isStyleProp = property => {
527
- return StyleProps.has(property) || nonStyleAttributes.has(property);
528
- };
529
-
530
- const defaultBreakpointsConfig = {
531
- xs: 0,
532
- sm: 340,
533
- md: 560,
534
- lg: 1080,
535
- xl: 1300
536
- };
537
- const defaultDeviceConfig = {
538
- mobile: ['xs', 'sm'],
539
- tablet: ['md', 'lg'],
540
- desktop: ['lg', 'xl']
541
- };
542
- const getMediaQueries = b => {
543
- const defaultKeys = Object.keys(b);
544
- const breakpointValue = defaultKeys.map(breakpoint => {
545
- const value = {
546
- breakpoint: breakpoint,
547
- min: b[breakpoint],
548
- max: 0
549
- };
550
- return value;
551
- }).sort((a, b) => a.min - b.min);
552
- breakpointValue.reduce((a, b) => {
553
- if (b) a.max = b.min;
554
- return b;
555
- });
556
- const query = {};
557
- breakpointValue.map(sizeScreen => {
558
- query[sizeScreen.breakpoint] = `only screen ${sizeScreen.min && sizeScreen.min >= 0 ? 'and (min-width:' + sizeScreen.min + 'px)' : ''} ${sizeScreen.max && sizeScreen.max >= 0 ? 'and (max-width:' + sizeScreen.max + 'px)' : ''}`;
559
- });
560
- return query;
561
- };
562
- const defaultScreenConfig = {
563
- breakpoints: defaultBreakpointsConfig,
564
- devices: defaultDeviceConfig,
565
- mediaQueries: /*#__PURE__*/getMediaQueries(defaultBreakpointsConfig)
566
- };
567
- const ResponsiveContext = /*#__PURE__*/createContext(defaultScreenConfig);
568
- const useResponsiveContext = () => useContext(ResponsiveContext);
569
- const ResponsiveProvider = _ref => {
570
- let {
571
- breakpoints = defaultBreakpointsConfig,
572
- devices = defaultDeviceConfig,
573
- children
574
- } = _ref;
575
- return /*#__PURE__*/React.createElement(ResponsiveContext.Provider, {
576
- value: {
577
- breakpoints,
578
- devices,
579
- mediaQueries: getMediaQueries(breakpoints)
580
- }
581
- }, children);
582
- };
583
-
584
- // Liste des propriétés numériques
585
- const NumberProps = ['numberOfLines', 'fontWeight', 'timeStamp', 'flex', 'flexGrow', 'flexShrink', 'order', 'zIndex', 'aspectRatio', 'shadowOpacity', 'shadowRadius', 'scale', 'opacity', 'min', 'max', 'now'];
586
- // Stocke si une propriété est numérique
587
- const NumberPropsStyle = {};
588
- NumberProps.forEach(property => {
589
- NumberPropsStyle[property] = true;
590
- });
591
- // Fonction pour définir la taille de l'élément
592
- const setSize = (newSize, styleProps) => {
593
- styleProps.height = styleProps.width = newSize; // Définit la hauteur et la largeur
594
- };
595
- // Fonction pour appliquer les styles à un composant
596
- const applyStyle = props => {
597
- const {
598
- getColor
599
- } = useTheme(); // Utilise le hook pour obtenir les couleurs du thème
600
- const {
601
- mediaQueries,
602
- devices
603
- } = useResponsiveContext(); // Utilise le contexte responsive
604
- // eslint-disable-next-line prefer-const
605
- let styleProps = {}; // Stocke les styles
606
- // Applique un curseur pointeur si un gestionnaire de clic est présent
607
- if (props.onClick && styleProps.cursor == undefined) {
608
- styleProps.cursor = 'pointer';
609
- }
610
- // Gère la taille de l'élément
611
- const size = props.height !== undefined && props.width !== undefined && props.height === props.width ? props.height : props.size ? props.size : null;
612
- if (size) {
613
- setSize(size, styleProps); // Applique la taille
614
- }
615
- // Gère le padding et la marge
616
- if (props.paddingHorizontal) {
617
- styleProps.paddingLeft = props.paddingHorizontal;
618
- styleProps.paddingRight = props.paddingHorizontal;
619
- }
620
- if (props.marginHorizontal) {
621
- styleProps.marginLeft = props.marginHorizontal;
622
- styleProps.marginRight = props.marginHorizontal;
623
- }
624
- if (props.paddingVertical) {
625
- styleProps.paddingTop = props.paddingVertical;
626
- styleProps.paddingBottom = props.paddingVertical;
627
- }
628
- if (props.marginVertical) {
629
- styleProps.marginTop = props.marginVertical;
630
- styleProps.marginBottom = props.marginVertical;
631
- }
632
- // Applique les ombres si spécifié
633
- if (props.shadow) {
634
- if (typeof props.shadow === 'number' || typeof props.shadow === 'boolean') {
635
- const shadowValue = typeof props.shadow === 'number' && Shadows[props.shadow] !== undefined ? props.shadow : 2;
636
- if (Shadows[shadowValue]) {
637
- const shadowColor = Color.hex.rgb(Shadows[shadowValue].shadowColor).join(',');
638
- styleProps['boxShadow'] = `${Shadows[shadowValue].shadowOffset.height}px ${Shadows[shadowValue].shadowOffset.width}px ${Shadows[shadowValue].shadowRadius}px rgba(${shadowColor},${Shadows[shadowValue].shadowOpacity})`;
639
- }
640
- } else {
641
- const shadowColor = Color.hex.rgb(props.shadow.shadowColor).join(',');
642
- styleProps['boxShadow'] = `${props.shadow.shadowOffset.height}px ${props.shadow.shadowOffset.width}px ${props.shadow.shadowRadius}px rgba(${shadowColor},${props.shadow.shadowOpacity})`;
643
- }
644
- delete props['shadow'];
645
- }
646
- // Gère les styles pour des médias spécifiques
647
- if (props.only) {
648
- const {
649
- only,
650
- ...newProps
651
- } = props;
652
- only.map(o => {
653
- });
654
- const styleKeys = Object.keys(newProps).filter(key => isStyleProp(key));
655
- styleKeys.map(key => {
656
- only.map(o => {
657
- props.media[o][key] = newProps[key];
658
- });
659
- delete props[key];
660
- });
661
- delete props['only'];
662
- }
663
- // Gère les styles CSS personnalisés
664
- if (props.css) {
665
- const {
666
- css
667
- } = props;
668
- props = {
669
- ...css,
670
- props
671
- };
672
- delete props['css'];
673
- }
674
- // Applique les styles
675
- Object.keys(props).map(property => {
676
- if (property !== 'shadow' && property !== 'size') {
677
- if (isStyleProp(property) || property == 'on' || property == 'media') {
678
- if (typeof props[property] === 'object') {
679
- if (property === 'on') {
680
- for (const event in props[property]) {
681
- styleProps['&:' + event] = applyStyle(props[property][event]);
682
- }
683
- } else if (property === 'media') {
684
- for (const screenOrDevices in props[property]) {
685
- if (mediaQueries[screenOrDevices] !== undefined && props[property][screenOrDevices] !== undefined) {
686
- styleProps['@media ' + mediaQueries[screenOrDevices]] = applyStyle(props[property][screenOrDevices]);
687
- } else if (devices[screenOrDevices] !== undefined) {
688
- for (const deviceScreen in devices[screenOrDevices]) {
689
- if (mediaQueries[devices[screenOrDevices][deviceScreen]] !== undefined && props[property][screenOrDevices] !== undefined) {
690
- styleProps['@media ' + mediaQueries[devices[screenOrDevices][deviceScreen]]] = applyStyle(props[property][screenOrDevices]);
691
- }
692
- }
693
- }
694
- }
695
- } else {
696
- styleProps[property] = applyStyle(props[property]);
697
- }
698
- } else if (typeof props[property] === 'number' && NumberPropsStyle[property] === undefined) {
699
- styleProps[property] = props[property] + 'px';
700
- } else if (property.toLowerCase().indexOf('color') !== -1) {
701
- styleProps[property] = getColor(props[property]);
702
- } else {
703
- styleProps[property] = props[property];
704
- }
705
- }
706
- }
707
- });
708
- return styleProps;
709
- };
710
- // Clés à exclure lors de la création du composant stylisé
711
- const excludedKeys = /*#__PURE__*/new Set(['on', 'shadow', 'only', 'media', 'css', 'paddingHorizontal', 'paddingVertical', 'marginHorizontal', 'marginVertical']);
712
- const includeKeys = /*#__PURE__*/new Set(['src', 'alt', 'style']);
713
- // Crée un composant div stylisé, en excluant certaines props
714
- const ElementComponent = /*#__PURE__*/styled.div.withConfig({
715
- shouldForwardProp: key => {
716
- return !excludedKeys.has(key) && !isStyleProp(key) || includeKeys.has(key);
717
- }
718
- })`
719
- // Applique les styles dynamiques en utilisant la fonction applyStyle
720
- ${props => props.css}
721
- `;
722
- const useStyledProps = props => {
723
- const styledProps = applyStyle(props);
724
- // Filtrer les props pour exclure celles qui sont utilisées pour le style
725
- const newProps = Object.keys(props).reduce((acc, key) => {
726
- if (!excludedKeys.has(key) && !isStyleProp(key) || includeKeys.has(key)) {
727
- acc[key] = props[key];
728
- }
729
- return acc;
730
- }, {});
731
- return {
732
- newProps,
733
- styledProps
734
- };
735
- };
736
- const Element = props => {
737
- // eslint-disable-next-line prefer-const
738
- let {
739
- onPress,
740
- ...rest
741
- } = props;
742
- // eslint-disable-next-line prefer-const
743
- let {
744
- newProps,
745
- styledProps
746
- } = useStyledProps(rest);
747
- if (onPress) {
748
- newProps.onClick = onPress;
749
- }
750
- // Rendu du composant avec les props
751
- return /*#__PURE__*/React.createElement(ElementComponent, Object.assign({}, rest, {
752
- css: styledProps
753
- }));
754
- };
755
-
756
- const View = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props)));
757
- const Div = View;
758
- const SafeArea = View;
759
- const Scroll = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(View, Object.assign({
760
- overflow: 'auto'
761
- }, props)));
762
- const Span = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props, {
763
- as: "span"
764
- })));
765
-
766
- const Image = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props, {
767
- as: "img"
768
- })));
769
-
770
- const Text = /*#__PURE__*/React.memo(props => {
771
- return /*#__PURE__*/React.createElement(Element, Object.assign({}, props));
772
- });
773
-
774
- // Utilisation de React.memo pour une meilleure performance
775
- const Form = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props, {
776
- as: "form"
777
- })));
778
- const Input = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props, {
779
- as: "input"
780
- })));
781
- const Button = /*#__PURE__*/React.memo(props => /*#__PURE__*/React.createElement(Element, Object.assign({}, props, {
782
- as: "button"
783
- })));
784
-
785
- const Typography = {
786
- letterSpacings: {
787
- tighter: -0.08,
788
- tight: -0.4,
789
- normal: 0,
790
- wide: 0.4,
791
- wider: 0.8,
792
- widest: 1.6
793
- },
794
- lineHeights: {
795
- xs: 10,
796
- sm: 12,
797
- md: 14,
798
- lg: 16,
799
- xl: 20,
800
- '2xl': 24,
801
- '3xl': 30,
802
- '4xl': 36,
803
- '5xl': 48,
804
- '6xl': 64
805
- },
806
- fontWeights: {
807
- hairline: 100,
808
- thin: 200,
809
- light: 300,
810
- normal: 400,
811
- medium: 500,
812
- semiBold: 600,
813
- bold: 700,
814
- extraBold: 800,
815
- black: 900
816
- },
817
- fontSizes: {
818
- xs: 10,
819
- sm: 12,
820
- md: 14,
821
- lg: 16,
822
- xl: 20,
823
- '2xl': 24,
824
- '3xl': 30,
825
- '4xl': 36,
826
- '5xl': 48,
827
- '6xl': 64
828
- }
829
- };
830
-
831
- /**
832
- * whether in browser env
833
- */
834
- const isBrowser = () => typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
835
- /**
836
- * get window.g_initialProps
837
- */
838
- const getWindowInitialProps = () => isBrowser() ? window.g_initialProps : undefined;
839
- /**
840
- * whether SSR success in client
841
- */
842
- const isSSR = ! /*#__PURE__*/isBrowser();
843
- function isDev() {
844
- let dev = false;
845
- if (isBrowser()) {
846
- dev = !(window.location.hostname.indexOf('localhost') === -1);
847
- }
848
- return dev;
849
- }
850
- function isProd() {
851
- if (isBrowser()) {
852
- if (window && window.location && window.location.hostname) {
853
- return window.location.hostname.includes('localhost') || window.location.hostname.includes('develop');
854
- }
855
- }
856
- return false;
857
- }
858
- function isMobile() {
859
- return navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i);
860
- }
861
-
862
- const useMount = callback => {
863
- useEffect(() => {
864
- callback();
865
- }, []);
866
- };
867
-
868
- const createQuery = (keyScreen, query, set) => {
869
- const mql = window.matchMedia(query);
870
- const onChange = () => {
871
- if (!!mql.matches) {
872
- set(keyScreen);
873
- }
874
- };
875
- mql.addListener(onChange);
876
- if (!!mql.matches) {
877
- set(keyScreen);
878
- }
879
- return () => {
880
- mql.removeListener(onChange);
881
- };
882
- };
883
- const useResponsive = () => {
884
- const {
885
- breakpoints,
886
- devices,
887
- mediaQueries
888
- } = useResponsiveContext();
889
- const [screen, setScreen] = useState('xs');
890
- const [orientation, setOrientation] = useState('landscape');
891
- useMount(() => {
892
- for (const screenSize in mediaQueries) {
893
- createQuery(screenSize, mediaQueries[screenSize], setScreen);
894
- }
895
- createQuery('landscape', 'only screen and (orientation: landscape)', setOrientation);
896
- createQuery('portrait', 'only screen and (orientation: portrait)', setOrientation);
897
- });
898
- const on = device => {
899
- return devices[device].includes(screen);
900
- };
901
- const is = s => {
902
- return s == screen;
903
- };
904
- return {
905
- breakpoints,
906
- devices,
907
- orientation,
908
- screen,
909
- on,
910
- is
911
- };
912
- };
913
-
914
- export { Button, Div, Element, Form, Image, Input, ResponsiveContext, ResponsiveProvider, SafeArea, Scroll, Shadows, Span, Text, ThemeContext, ThemeProvider, Typography, View, applyStyle, createQuery, defaultColors, defaultThemeMain, getWindowInitialProps, isBrowser, isDev, isMobile, isProd, isSSR, palette, setSize, useMount, useResponsive, useResponsiveContext, useTheme };
915
- //# sourceMappingURL=app-studio.esm.js.map