creactive 0.0.55 → 0.0.56

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 (60) hide show
  1. package/build/index.js +1656 -2
  2. package/package.json +6 -4
  3. package/source/components/index.ts +2 -0
  4. package/source/components/text/constants/color.ts +26 -0
  5. package/source/components/text/constants/font.ts +32 -0
  6. package/source/components/text/constants/index.ts +5 -0
  7. package/source/components/text/constants/role.ts +12 -0
  8. package/source/components/text/constants/text.ts +22 -0
  9. package/source/components/text/constants/type.ts +27 -0
  10. package/source/components/text/index.ts +2 -0
  11. package/source/components/text/spec/children.spec.tsx +13 -0
  12. package/source/components/text/spec/color.spec.native.tsx +15 -0
  13. package/source/components/text/spec/color.spec.tsx +159 -0
  14. package/source/components/text/spec/color.spec.web.tsx +15 -0
  15. package/source/components/text/spec/font.spec.tsx +196 -0
  16. package/source/components/text/spec/position.spec.tsx +15 -0
  17. package/source/components/text/spec/text.spec.native.tsx +1043 -0
  18. package/source/components/text/spec/text.spec.tsx +39 -0
  19. package/source/components/text/spec/text.spec.web.tsx +1043 -0
  20. package/source/components/text/spec/type.spec.web.tsx +55 -0
  21. package/source/components/text/text.stories.tsx +46 -0
  22. package/source/components/text/text.tsx +262 -0
  23. package/source/components/text/text.types.ts +67 -0
  24. package/source/constants/index.ts +46 -0
  25. package/source/constants/theme/color.ts +27 -0
  26. package/source/constants/theme/font.ts +48 -0
  27. package/source/constants/theme/index.ts +50 -0
  28. package/source/constants/theme/text.ts +12 -0
  29. package/source/contexts/index.ts +15 -0
  30. package/source/contexts/media/components/index.ts +4 -0
  31. package/source/contexts/media/components/media/index.ts +2 -0
  32. package/source/contexts/media/components/media/media.tsx +37 -0
  33. package/source/contexts/media/components/media/media.types.ts +26 -0
  34. package/source/contexts/media/components/wrapper/index.ts +2 -0
  35. package/source/contexts/media/components/wrapper/wrapper.tsx +73 -0
  36. package/source/contexts/media/components/wrapper/wrapper.types.ts +3 -0
  37. package/source/contexts/media/constants/breakpoint.ts +18 -0
  38. package/source/contexts/media/constants/index.ts +6 -0
  39. package/source/contexts/media/hooks/index.ts +1 -0
  40. package/source/contexts/media/hooks/use-breakpoint.ts +18 -0
  41. package/source/contexts/media/index.ts +7 -0
  42. package/source/contexts/media/media.tsx +36 -0
  43. package/source/contexts/media/media.types.ts +38 -0
  44. package/source/contexts/theme/index.ts +8 -0
  45. package/source/contexts/theme/theme.tsx +280 -0
  46. package/source/contexts/theme/theme.types.ts +284 -0
  47. package/source/helpers/index.ts +3 -0
  48. package/source/helpers/storybook/constants/control.ts +25 -0
  49. package/source/helpers/storybook/constants/index.ts +1 -0
  50. package/source/helpers/storybook/control.spec.ts +140 -0
  51. package/source/helpers/storybook/control.ts +115 -0
  52. package/source/helpers/storybook/index.ts +1 -0
  53. package/source/helpers/style/index.ts +2 -0
  54. package/source/helpers/style/style.spec.web.ts +20 -0
  55. package/source/helpers/style/style.ts +14 -0
  56. package/source/helpers/style/style.types.ts +14 -0
  57. package/source/hooks/index.ts +1 -0
  58. package/source/hooks/use-theme-style-sheet.ts +135 -0
  59. package/source/index.ts +24 -0
  60. package/build/index.js.LICENSE.txt +0 -9
@@ -0,0 +1,135 @@
1
+ import { useThemeContext } from '@/contexts/theme'
2
+ import { useMemo } from 'react'
3
+ import { StyleSheet } from 'react-native'
4
+
5
+ // Create tailwind-like style sheet for each theme token.
6
+ // Some styles are shared across multiple components.
7
+ // We also export this hook outside just in case.
8
+ export const useThemeStyleSheet = () => {
9
+ const themeContext = useThemeContext()
10
+ // Re-creating style sheet only when theme context changes.
11
+ return useMemo(
12
+ () =>
13
+ StyleSheet.create({
14
+ // Foreground color styles.
15
+ colorForegroundBase100: {
16
+ color: themeContext.colorForegroundBase100,
17
+ },
18
+ colorForegroundBase200: {
19
+ color: themeContext.colorForegroundBase200,
20
+ },
21
+ colorForegroundBase300: {
22
+ color: themeContext.colorForegroundBase300,
23
+ },
24
+ colorForegroundBase400: {
25
+ color: themeContext.colorForegroundBase400,
26
+ },
27
+ colorForegroundBase500: {
28
+ color: themeContext.colorForegroundBase500,
29
+ },
30
+ colorForegroundBase600: {
31
+ color: themeContext.colorForegroundBase600,
32
+ },
33
+ colorForegroundBase700: {
34
+ color: themeContext.colorForegroundBase700,
35
+ },
36
+ colorForegroundBase800: {
37
+ color: themeContext.colorForegroundBase800,
38
+ },
39
+ colorForegroundBase900: {
40
+ color: themeContext.colorForegroundBase900,
41
+ },
42
+ colorForegroundInverse100: {
43
+ color: themeContext.colorForegroundInverse100,
44
+ },
45
+ colorForegroundInverse200: {
46
+ color: themeContext.colorForegroundInverse200,
47
+ },
48
+ colorForegroundInverse300: {
49
+ color: themeContext.colorForegroundInverse300,
50
+ },
51
+ colorForegroundInverse400: {
52
+ color: themeContext.colorForegroundInverse400,
53
+ },
54
+ colorForegroundInverse500: {
55
+ color: themeContext.colorForegroundInverse500,
56
+ },
57
+ colorForegroundInverse600: {
58
+ color: themeContext.colorForegroundInverse600,
59
+ },
60
+ colorForegroundInverse700: {
61
+ color: themeContext.colorForegroundInverse700,
62
+ },
63
+ colorForegroundInverse800: {
64
+ color: themeContext.colorForegroundInverse800,
65
+ },
66
+ colorForegroundInverse900: {
67
+ color: themeContext.colorForegroundInverse900,
68
+ },
69
+ // Font family styles.
70
+ fontFamilyBase: {
71
+ fontFamily: themeContext.fontFamilyBase,
72
+ },
73
+ // Base font weight styles.
74
+ fontWeightBaseThin: {
75
+ fontWeight: themeContext.fontWeightBaseThin,
76
+ },
77
+ fontWeightBaseExtraLight: {
78
+ fontWeight: themeContext.fontWeightBaseExtraLight,
79
+ },
80
+ fontWeightBaseLight: {
81
+ fontWeight: themeContext.fontWeightBaseLight,
82
+ },
83
+ fontWeightBaseRegular: {
84
+ fontWeight: themeContext.fontWeightBaseRegular,
85
+ },
86
+ fontWeightBaseMedium: {
87
+ fontWeight: themeContext.fontWeightBaseMedium,
88
+ },
89
+ fontWeightBaseSemibold: {
90
+ fontWeight: themeContext.fontWeightBaseSemibold,
91
+ },
92
+ fontWeightBaseBold: {
93
+ fontWeight: themeContext.fontWeightBaseBold,
94
+ },
95
+ fontWeightBaseExtraBold: {
96
+ fontWeight: themeContext.fontWeightBaseExtraBold,
97
+ },
98
+ fontWeightBaseBlack: {
99
+ fontWeight: themeContext.fontWeightBaseBlack,
100
+ },
101
+ // Base font size styles.
102
+ fontSizeBaseX2S: {
103
+ fontSize: themeContext.fontSizeBaseX2S,
104
+ },
105
+ fontSizeBaseXS: {
106
+ fontSize: themeContext.fontSizeBaseXS,
107
+ },
108
+ fontSizeBaseSM: {
109
+ fontSize: themeContext.fontSizeBaseSM,
110
+ },
111
+ fontSizeBaseMD: {
112
+ fontSize: themeContext.fontSizeBaseMD,
113
+ },
114
+ fontSizeBaseLG: {
115
+ fontSize: themeContext.fontSizeBaseLG,
116
+ },
117
+ fontSizeBaseXL: {
118
+ fontSize: themeContext.fontSizeBaseXL,
119
+ },
120
+ fontSizeBaseX2L: {
121
+ fontSize: themeContext.fontSizeBaseX2L,
122
+ },
123
+ fontSizeBaseX3L: {
124
+ fontSize: themeContext.fontSizeBaseX3L,
125
+ },
126
+ fontSizeBaseX4L: {
127
+ fontSize: themeContext.fontSizeBaseX4L,
128
+ },
129
+ fontSizeBaseX5L: {
130
+ fontSize: themeContext.fontSizeBaseX5L,
131
+ },
132
+ }),
133
+ [themeContext]
134
+ )
135
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Exports all public stuff, including types.
3
+ * Allows to keep some exports private at the same time.
4
+ */
5
+ export { Text } from '@/components/text'
6
+ export type { TextComponent, TextProps } from '@/components/text'
7
+ export { Media, MediaContextProvider, useMediaContext } from '@/contexts/media'
8
+ export type {
9
+ MediaComponent,
10
+ MediaContextProviderComponent,
11
+ MediaContextValue,
12
+ MediaProps,
13
+ } from '@/contexts/media'
14
+ export { ThemeContextProvider, useThemeContext } from '@/contexts/theme'
15
+ export type {
16
+ ThemeColorRGB,
17
+ ThemeContextProviderComponent,
18
+ ThemeContextProviderProps,
19
+ ThemeContextValue,
20
+ ThemeFontWeight,
21
+ } from '@/contexts/theme'
22
+ export { renderStyle } from '@/helpers/style'
23
+ export type { RenderStyleHelper } from '@/helpers/style'
24
+ export { useThemeStyleSheet } from '@/hooks/use-theme-style-sheet'
@@ -1,9 +0,0 @@
1
- /**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */