@cleartrip/ct-design-theme 4.0.0-TEST.1 → 4.0.0-rc

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 (38) hide show
  1. package/dist/ThemeProvider/ThemeProvider.d.ts +2 -7
  2. package/dist/ThemeProvider/ThemeProvider.d.ts.map +1 -1
  3. package/dist/ThemeProvider/ThemeProvider.native.d.ts +5 -0
  4. package/dist/ThemeProvider/ThemeProvider.native.d.ts.map +1 -0
  5. package/dist/ct-design-theme.browser.cjs.js +1 -1
  6. package/dist/ct-design-theme.browser.cjs.js.map +1 -1
  7. package/dist/ct-design-theme.browser.esm.js +1 -1
  8. package/dist/ct-design-theme.browser.esm.js.map +1 -1
  9. package/dist/ct-design-theme.cjs.js +114 -128
  10. package/dist/ct-design-theme.cjs.js.map +1 -1
  11. package/dist/ct-design-theme.esm.js +114 -128
  12. package/dist/ct-design-theme.esm.js.map +1 -1
  13. package/dist/ct-design-theme.umd.js +148 -192
  14. package/dist/ct-design-theme.umd.js.map +1 -1
  15. package/dist/themes/B2CTheme.d.ts +6 -64
  16. package/dist/themes/B2CTheme.d.ts.map +1 -1
  17. package/dist/themes/BaseTheme.d.ts.map +1 -1
  18. package/dist/themes/type.d.ts +3 -4
  19. package/dist/themes/type.d.ts.map +1 -1
  20. package/dist/utils/index.d.ts.map +1 -1
  21. package/package.json +8 -4
  22. package/src/ThemeProvider/ThemeProvider.native.tsx +20 -0
  23. package/src/ThemeProvider/ThemeProvider.tsx +29 -0
  24. package/src/ThemeProvider/index.ts +3 -0
  25. package/src/ThemeProvider/type.ts +15 -0
  26. package/src/hooks/index.ts +2 -0
  27. package/src/hooks/useTheme.ts +11 -0
  28. package/src/hooks/useThemeContext.ts +8 -0
  29. package/src/index.ts +5 -0
  30. package/src/themes/B2BTheme.ts +94 -0
  31. package/src/themes/B2CTheme.ts +5 -0
  32. package/src/themes/BaseTheme.ts +308 -0
  33. package/src/themes/SMTheme.ts +86 -0
  34. package/src/themes/UltraFkTheme.ts +93 -0
  35. package/src/themes/index.ts +7 -0
  36. package/src/themes/type.ts +233 -0
  37. package/src/utils/ThemeManager.ts +36 -0
  38. package/src/utils/index.ts +21 -0
@@ -0,0 +1,233 @@
1
+ import type { Border } from '@cleartrip/ct-design-tokens';
2
+ import { Size, Elevation } from '@cleartrip/ct-design-tokens';
3
+ import type { Spacing } from '@cleartrip/ct-design-tokens';
4
+ import type { Typography } from '@cleartrip/ct-design-tokens';
5
+
6
+ export type UnderlineType = '' | 'underline';
7
+
8
+ export type Theme = {
9
+ color: {
10
+ text: {
11
+ primary: string;
12
+ secondary: string;
13
+ tertiary: string;
14
+ heading: string;
15
+ subHeading: string;
16
+ disabled: string;
17
+ success: string;
18
+ alert: string;
19
+ warning: string;
20
+ link: string;
21
+ brand: string;
22
+ neutral: string;
23
+ link2: string;
24
+ margarita: string;
25
+ // it's a new color introducted in figma
26
+ alert500: string;
27
+ primary2: string;
28
+ secondary2: string;
29
+ grapetini900: string;
30
+ pinaColada750: string;
31
+ neutral50: string;
32
+ coralpink: string;
33
+ };
34
+ button: {
35
+ outlinedPrimaryLabel: string;
36
+ outlinedPrimaryBorder: string;
37
+ outlinedPrimaryBg: string;
38
+ outlinedSecondaryLabel: string;
39
+ outlinedSecondaryBorder: string;
40
+ outlinedSecondaryBg: string;
41
+ outlinedTertiaryLabel: string;
42
+ outlinedTertiaryBorder: string;
43
+ outlinedTertiaryBg: string;
44
+ outlinedNeutralLabel: string;
45
+ outlinedNeutralBorder: string;
46
+ outlinedNeutralBg: string;
47
+ outlinedDisabledLabel: string;
48
+ outlinedDisabledBg: string;
49
+ containedPrimaryLabel: string;
50
+ containedPrimaryBg: string;
51
+ containedSecondaryLabel: string;
52
+ containedSecondaryBg: string;
53
+ containedTertiaryLabel: string;
54
+ containedTertiaryBg: string;
55
+ containedDisabledLabel: string;
56
+ containedDisabledBg: string;
57
+ containedNeutralLabel: string;
58
+ containedNeutralBg: string;
59
+ hover: unknown;
60
+ };
61
+ chip: {
62
+ nonSelectedPrimaryLabel: string;
63
+ selectedPrimaryLabel: string;
64
+ selectedPrimaryBorder: string;
65
+ selectedPrimaryBg: string;
66
+ disabledPrimaryLabel: string;
67
+ disabledPrimaryBg: string;
68
+ };
69
+ dropdown: {
70
+ shadow: string;
71
+ };
72
+ tab: {
73
+ nonSelectedPrimaryLabel: string;
74
+ selectedPrimaryLabel: string;
75
+ };
76
+ sidenav: {
77
+ primaryBg: string;
78
+ selectedTabBg: string;
79
+ };
80
+ tooltip: {
81
+ primaryBg: string;
82
+ };
83
+ background: {
84
+ primary: string;
85
+ secondary: string;
86
+ tertiary: string;
87
+ brand: string;
88
+ brandLightBg: string;
89
+ link: string;
90
+ link2: string;
91
+ linkLightBg: string;
92
+ success: string;
93
+ successLightBg: string;
94
+ alert: string;
95
+ alertLightBg: string;
96
+ alertSoft: string;
97
+ warning: string;
98
+ warningLightBg: string;
99
+ neutral: string;
100
+ disabled: string;
101
+ disabledSecondaryLight: string;
102
+ disabledSecondary: string;
103
+ disabledDark: string;
104
+ defaultDark: string;
105
+ defaultDarkest: string;
106
+ grey: string;
107
+ secondary2: string;
108
+ sandGrey100: string;
109
+ };
110
+ border: {
111
+ primary: string;
112
+ secondary: string;
113
+ tertiary: string;
114
+ brand: string;
115
+ neutral: string;
116
+ link: string;
117
+ default: string;
118
+ defaultDark: string;
119
+ disabled: string;
120
+ disabledDark: string;
121
+ warning: string;
122
+ divider: string;
123
+ };
124
+ spinner: {
125
+ primary: string;
126
+ primaryBg: string;
127
+ };
128
+ shimmer: {
129
+ disabledLight: string;
130
+ disabledDark: string;
131
+ };
132
+ counter: {
133
+ enabled: {
134
+ stroke: string;
135
+ };
136
+ disabled: {
137
+ stroke: string;
138
+ };
139
+ };
140
+ coupon: {
141
+ primaryBg: string;
142
+ };
143
+ alert: {
144
+ success: string;
145
+ warning: string;
146
+ error: string;
147
+ info: string;
148
+ neutral: string;
149
+ };
150
+ badge: {
151
+ curacao: string;
152
+ curacao900: string;
153
+ pinaColada: string;
154
+ margarita250: string;
155
+ default: string;
156
+ green: string;
157
+ margarita100: string;
158
+ yellow: string;
159
+ orange100: string;
160
+ orange250: string;
161
+ orange500: string;
162
+ red: string;
163
+ green500: string;
164
+ green600: string;
165
+ purple100: string;
166
+ purple250: string;
167
+ gray100: string;
168
+ gray250: string;
169
+ aqua100: string;
170
+ aqua250: string;
171
+ black: string;
172
+ link: string;
173
+ linkText: string;
174
+ blue100: string;
175
+ blue500: string;
176
+ blue900: string;
177
+ neutral100: string;
178
+ pinaColada750: string;
179
+ pinaColada100: string;
180
+ brown: string;
181
+ };
182
+ calendar: {
183
+ accent: string;
184
+ background: string;
185
+ selected: string;
186
+ };
187
+ };
188
+ elevation: Elevation;
189
+ border: Border;
190
+ spacing: Spacing;
191
+ typography: Typography;
192
+ size: Size;
193
+ transitions: {
194
+ easing: {
195
+ easeInOut: string;
196
+ easeOut: string;
197
+ easeIn: string;
198
+ sharp: string;
199
+ };
200
+ duration: {
201
+ shortest: number;
202
+ shorter: number;
203
+ short: number;
204
+ standard: number;
205
+ complex: number;
206
+ enteringScreen: number;
207
+ leavingScreen: number;
208
+ };
209
+ getAutoHeightDuration: unknown;
210
+ create: unknown;
211
+ };
212
+ zIndex: Record<'modal' | 'drawer' | 'tooltip' | 'popOver' | 'sideNav' | 'toolbar' | 'bottomSheet', number>;
213
+ underline: {
214
+ link: UnderlineType;
215
+ primary: UnderlineType;
216
+ secondary: UnderlineType;
217
+ tertiary: UnderlineType;
218
+ disabled: UnderlineType;
219
+ heading: UnderlineType;
220
+ subHeading: UnderlineType;
221
+ success: UnderlineType;
222
+ warning: UnderlineType;
223
+ neutral: UnderlineType;
224
+ link2: UnderlineType;
225
+ primary2: UnderlineType;
226
+ secondary2: UnderlineType;
227
+ grapetini900: UnderlineType;
228
+ pinaColada750: UnderlineType;
229
+ alert: UnderlineType;
230
+ };
231
+ };
232
+
233
+ export type ThemeType = 'B2C' | 'B2B' | 'FK' | 'SM';
@@ -0,0 +1,36 @@
1
+ import { Theme as ThemeType } from '../themes/index';
2
+ import B2CTheme from '../themes/B2CTheme';
3
+
4
+ class ThemeManagerClass {
5
+ static instance: ThemeManagerClass;
6
+ private theme: ThemeType;
7
+
8
+ constructor() {
9
+ if (ThemeManagerClass.instance) {
10
+ throw new Error('You can only create one instance!');
11
+ }
12
+ ThemeManagerClass.instance = this;
13
+ /**
14
+ * 1.) Default theme (Ultra, Light Mode, Dark Mode)
15
+ * 2.) Build time theme
16
+ */
17
+ this.theme = B2CTheme;
18
+ }
19
+
20
+ set(theme: string) {
21
+ switch (theme) {
22
+ case 'B2C':
23
+ default: {
24
+ this.theme = B2CTheme;
25
+ break;
26
+ }
27
+ }
28
+ }
29
+
30
+ get() {
31
+ return this.theme;
32
+ }
33
+ }
34
+
35
+ const ThemeManager = Object.freeze(new ThemeManagerClass());
36
+ export default ThemeManager;
@@ -0,0 +1,21 @@
1
+ import { B2BTheme, B2CTheme, Theme, ThemeType, FKTheme, SMTheme } from '../themes';
2
+
3
+ export const getTheme = (themeType: ThemeType): Theme => {
4
+ switch (themeType) {
5
+ case 'B2C': {
6
+ return B2CTheme;
7
+ }
8
+ case 'B2B': {
9
+ return B2BTheme;
10
+ }
11
+ case 'FK': {
12
+ return FKTheme;
13
+ }
14
+ case 'SM': {
15
+ return SMTheme;
16
+ }
17
+ default: {
18
+ return B2CTheme;
19
+ }
20
+ }
21
+ };