@cleartrip/ct-design-theme 4.0.0-SNAPSHOT-test.0 → 4.0.0-SNAPSHOT-rnfinaltest2.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.
@@ -0,0 +1,5 @@
1
+ import { ThemeContextType, ThemeProviderProps } from './type';
2
+ export declare const ThemeContext: import("react").Context<ThemeContextType>;
3
+ declare const ThemeProvider: ({ children, theme: themeType, platform, }: ThemeProviderProps) => React.JSX.Element;
4
+ export default ThemeProvider;
5
+ //# sourceMappingURL=ThemeProvider.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.native.d.ts","sourceRoot":"","sources":["../../packages/core/theme/src/ThemeProvider/ThemeProvider.native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAE9D,eAAO,MAAM,YAAY,2CAGvB,CAAC;AAEH,QAAA,MAAM,aAAa,GAAI,2CAIpB,kBAAkB,KAAG,KAAK,CAAC,GAAG,CAAC,OAGjC,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleartrip/ct-design-theme",
3
- "version": "4.0.0-SNAPSHOT-test.0",
3
+ "version": "4.0.0-SNAPSHOT-rnfinaltest2.0",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/ct-design-theme.cjs.js",
@@ -13,10 +13,11 @@
13
13
  "./dist/ct-design-theme.cjs.js": "./dist/ct-design-theme.browser.cjs.js"
14
14
  },
15
15
  "files": [
16
- "dist"
16
+ "dist",
17
+ "src"
17
18
  ],
18
19
  "dependencies": {
19
- "@cleartrip/ct-design-tokens": "4.0.0-SNAPSHOT-test.0"
20
+ "@cleartrip/ct-design-tokens": "4.0.0-SNAPSHOT-rnfinaltest2.0"
20
21
  },
21
22
  "peerDependencies": {
22
23
  "react": ">=16.8.0",
@@ -0,0 +1,20 @@
1
+ import { createContext } from 'react';
2
+ import { B2CTheme } from '../themes';
3
+ import { getTheme } from '../utils';
4
+ import { ThemeContextType, ThemeProviderProps } from './type';
5
+
6
+ export const ThemeContext = createContext<ThemeContextType>({
7
+ theme: B2CTheme,
8
+ platform: 'mobile',
9
+ });
10
+
11
+ const ThemeProvider = ({
12
+ children,
13
+ theme: themeType = 'B2C',
14
+ platform = 'mobile',
15
+ }: ThemeProviderProps): React.JSX.Element => {
16
+ const theme = getTheme(themeType);
17
+ return <ThemeContext.Provider value={{ theme, platform }}>{children}</ThemeContext.Provider>;
18
+ };
19
+
20
+ export default ThemeProvider;
@@ -0,0 +1,27 @@
1
+ import { createContext } from 'react';
2
+ import { ThemeProvider as EmotionProvider } from '@emotion/react';
3
+ import { B2CTheme } from '../themes';
4
+ import { getTheme } from '../utils';
5
+ import { ThemeContextType, ThemeProviderProps } from './type';
6
+
7
+ export const ThemeContext = createContext<ThemeContextType>({
8
+ theme: B2CTheme,
9
+ platform: 'mobile',
10
+ });
11
+
12
+ const ThemeProvider = ({
13
+ children,
14
+ theme: themeType = 'B2C',
15
+ platform = 'mobile',
16
+ }: ThemeProviderProps): React.JSX.Element => {
17
+ const theme = getTheme(themeType);
18
+ return (
19
+ <ThemeContext.Provider value={{ theme, platform }}>
20
+ <EmotionProvider theme={theme}>
21
+ <>{children}</>
22
+ </EmotionProvider>
23
+ </ThemeContext.Provider>
24
+ );
25
+ };
26
+
27
+ export default ThemeProvider;
@@ -0,0 +1,3 @@
1
+ export { default as ThemeProvider } from './ThemeProvider';
2
+ export * from './ThemeProvider';
3
+ export * from './type';
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { Theme, ThemeType } from '../themes';
3
+
4
+ export type PlatformType = 'mobile' | 'desktop';
5
+
6
+ export type ThemeContextType = {
7
+ theme: Theme;
8
+ platform: PlatformType;
9
+ };
10
+
11
+ export interface ThemeProviderProps {
12
+ theme?: ThemeType;
13
+ platform?: PlatformType;
14
+ children?: ReactNode;
15
+ }
@@ -0,0 +1,2 @@
1
+ export { default as useTheme } from './useTheme';
2
+ export { default as useThemeContext } from './useThemeContext';
@@ -0,0 +1,11 @@
1
+ import { useContext } from 'react';
2
+ import { ThemeContext } from '../ThemeProvider';
3
+ import { B2CTheme } from '../themes';
4
+
5
+ const useTheme = () => {
6
+ const themeContext = useContext(ThemeContext);
7
+ const { theme } = themeContext || { theme: B2CTheme };
8
+ return theme;
9
+ };
10
+
11
+ export default useTheme;
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react';
2
+ import { ThemeContext } from '../ThemeProvider';
3
+
4
+ const useThemeContext = () => {
5
+ return useContext(ThemeContext);
6
+ };
7
+
8
+ export default useThemeContext;
package/src/index.ts ADDED
@@ -0,0 +1,5 @@
1
+ export * from './themes';
2
+ export * from './ThemeProvider';
3
+ export * from './hooks';
4
+ export * from './utils';
5
+ export { default as ThemeManager } from './utils/ThemeManager';
@@ -0,0 +1,94 @@
1
+ import { Theme } from './type';
2
+ import { colors } from '@cleartrip/ct-design-tokens';
3
+ import BaseTheme from './BaseTheme';
4
+
5
+ const hover = (key: string) => {
6
+ const bg = {
7
+ [colors.neutral100]: colors.neutral100,
8
+ [colors.neutral900]: colors.neutral900,
9
+ [colors.neutral900]: colors.neutral900,
10
+ [colors.neutral100]: colors.neutral100,
11
+ [colors.brand]: colors.bgPrimaryHover,
12
+ [colors.neutral100]: colors.neutral100,
13
+ [colors.disabledText]: colors.disabledText,
14
+ [colors.neutral300]: colors.neutral300,
15
+ [colors.neutral100]: colors.neutral100,
16
+ [colors.link2]: colors.link2Hover,
17
+ [colors.neutral100]: colors.neutral100,
18
+ [colors.neutral900]: colors.neutral900,
19
+ [colors.neutral100]: colors.neutral100,
20
+ [colors.disabledText]: colors.disabledText,
21
+ [colors.neutral300]: colors.neutral300,
22
+ };
23
+ return bg[key];
24
+ };
25
+
26
+ const B2BTheme: Theme = {
27
+ ...BaseTheme,
28
+ color: {
29
+ ...BaseTheme.color,
30
+ text: {
31
+ ...BaseTheme.color.text,
32
+ secondary: colors.link2,
33
+ tertiary: colors.neutral500,
34
+ },
35
+ button: {
36
+ ...BaseTheme.color.button,
37
+ outlinedPrimaryLabel: colors.link2,
38
+ outlinedPrimaryBorder: colors.link2,
39
+ outlinedPrimaryBg: colors.neutral100,
40
+ outlinedSecondaryLabel: colors.neutral900,
41
+ outlinedSecondaryBorder: colors.neutral900,
42
+ outlinedSecondaryBg: colors.neutral100,
43
+ outlinedTertiaryLabel: colors.brand,
44
+ outlinedTertiaryBorder: colors.brand,
45
+ outlinedTertiaryBg: colors.neutral100,
46
+ outlinedDisabledLabel: colors.disabledText,
47
+ outlinedDisabledBg: colors.neutral300,
48
+ containedPrimaryLabel: colors.neutral100,
49
+ containedPrimaryBg: colors.link2,
50
+ containedSecondaryLabel: colors.neutral100,
51
+ containedSecondaryBg: colors.neutral900,
52
+ containedTertiaryLabel: colors.neutral100,
53
+ containedTertiaryBg: colors.brand,
54
+ containedDisabledLabel: colors.disabledText,
55
+ containedDisabledBg: colors.neutral300,
56
+ hover: hover,
57
+ },
58
+ chip: {
59
+ ...BaseTheme.color.chip,
60
+ selectedPrimaryLabel: colors.link2,
61
+ selectedPrimaryBorder: colors.link2,
62
+ selectedPrimaryBg: colors.linkBg,
63
+ },
64
+ tab: {
65
+ ...BaseTheme.color.tab,
66
+ nonSelectedPrimaryLabel: colors.neutral900,
67
+ selectedPrimaryLabel: colors.link2,
68
+ },
69
+ background: {
70
+ ...BaseTheme.color.background,
71
+ primary: colors.link2,
72
+ secondary: colors.neutral900,
73
+ tertiary: colors.brand,
74
+ },
75
+ border: {
76
+ ...BaseTheme.color.border,
77
+ primary: colors.link2,
78
+ secondary: colors.neutral900,
79
+ tertiary: colors.brand,
80
+ divider: colors.line,
81
+ },
82
+ spinner: {
83
+ primary: colors.link2,
84
+ primaryBg: colors.alertBg,
85
+ },
86
+ calendar: {
87
+ accent: '',
88
+ background: '',
89
+ selected: colors.link2,
90
+ },
91
+ },
92
+ };
93
+
94
+ export default B2BTheme;
@@ -0,0 +1,5 @@
1
+ import BaseTheme from './BaseTheme';
2
+
3
+ const B2CTheme = { ...BaseTheme };
4
+
5
+ export default B2CTheme;
@@ -0,0 +1,308 @@
1
+ import { colors, border, typography, spacing, size, elevation } from '@cleartrip/ct-design-tokens';
2
+ import { Theme } from './type';
3
+
4
+ // inspired from chakra UI
5
+ export const duration = {
6
+ shortest: 150,
7
+ shorter: 200,
8
+ short: 250,
9
+ // most basic recommended timing
10
+ standard: 300,
11
+ // this is to be used in complex animations
12
+ complex: 375,
13
+ // recommended when something is entering screen
14
+ enteringScreen: 225,
15
+ // recommended when something is leaving screen
16
+ leavingScreen: 195,
17
+ };
18
+
19
+ // inspired from chakra UI
20
+ export const easing = {
21
+ // This is the most common easing curve.
22
+ easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
23
+ // Objects enter the screen at full velocity from off-screen and
24
+ // slowly decelerate to a resting point.
25
+ easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
26
+ // Objects leave the screen at full velocity. They do not decelerate when off-screen.
27
+ easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
28
+ // The sharp curve is used by objects that may return to the screen at any time.
29
+ sharp: 'cubic-bezier(0.4, 0, 0.6, 1)',
30
+ };
31
+
32
+ function getAutoHeightDuration(height: number) {
33
+ if (!height) {
34
+ return 0;
35
+ }
36
+
37
+ const constant = height / 36;
38
+
39
+ // https://www.wolframalpha.com/input/?i=(4+%2B+15+*+(x+%2F+36+)+**+0.25+%2B+(x+%2F+36)+%2F+5)+*+10
40
+ return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
41
+ }
42
+
43
+ const create = (props = ['all'], options: unknown = {}) => {
44
+ // @ts-ignore
45
+ const { duration: durationOption = duration.standard, easing: easingOption = easing.easeInOut, delay = 0 } = options;
46
+ return (Array.isArray(props) ? props : [props])
47
+ .map(
48
+ (animatedProp) =>
49
+ `${animatedProp} ${
50
+ typeof durationOption === 'string' ? durationOption : `${durationOption}ms`
51
+ } ${easingOption} ${typeof delay === 'string' ? delay : `${delay}ms`}`,
52
+ )
53
+ .join(',');
54
+ };
55
+
56
+ const hover = (key: string) => {
57
+ const bg = {
58
+ [colors.neutral100]: colors.neutral100,
59
+ [colors.neutral900]: colors.neutral900,
60
+ [colors.neutral900]: colors.neutral900,
61
+ [colors.neutral100]: colors.neutral100,
62
+ [colors.brand]: colors.bgPrimaryHover,
63
+ [colors.neutral100]: colors.neutral100,
64
+ [colors.disabledText]: colors.disabledText,
65
+ [colors.neutral300]: colors.neutral300,
66
+ [colors.neutral100]: colors.neutral100,
67
+ [colors.link2]: colors.link2Hover,
68
+ [colors.neutral100]: colors.neutral100,
69
+ [colors.neutral900]: colors.neutral900,
70
+ [colors.neutral100]: colors.neutral100,
71
+ [colors.disabledText]: colors.disabledText,
72
+ [colors.neutral300]: colors.neutral300,
73
+ };
74
+ return bg[key];
75
+ };
76
+
77
+ const zIndex = {
78
+ drawer: 1200,
79
+ modal: 1300,
80
+ popOver: 1300,
81
+ tooltip: 1500,
82
+ sideNav: 100,
83
+ toolbar: 50,
84
+ bottomSheet: 100,
85
+ };
86
+
87
+ const counter = {
88
+ enabled: {
89
+ stroke: colors.neutral900,
90
+ },
91
+ disabled: {
92
+ stroke: colors.neutral500,
93
+ },
94
+ };
95
+
96
+ const BaseTheme: Theme = {
97
+ color: {
98
+ text: {
99
+ primary: colors.neutral900,
100
+ secondary: colors.brandText,
101
+ tertiary: colors.neutral500,
102
+ heading: colors.neutral900,
103
+ subHeading: colors.neutral700,
104
+ disabled: colors.disabledText,
105
+ success: colors.successText,
106
+ alert: colors.alertText,
107
+ alert500: colors.alert500,
108
+ warning: colors.warningText,
109
+ link: colors.linkText,
110
+ brand: colors.brandText,
111
+ neutral: colors.neutral100,
112
+ link2: colors.link2,
113
+ margarita: colors.margarita750,
114
+ primary2: colors.grapetini900,
115
+ secondary2: colors.blue100,
116
+ grapetini900: colors.grapetini900,
117
+ pinaColada750: colors.pinaColada750,
118
+ neutral50: colors.neutral50,
119
+ coralpink: colors.coralpink,
120
+ },
121
+ button: {
122
+ outlinedPrimaryLabel: colors.neutral900,
123
+ outlinedPrimaryBorder: colors.neutral900,
124
+ outlinedPrimaryBg: colors.neutral100,
125
+ outlinedSecondaryLabel: colors.brand,
126
+ outlinedSecondaryBorder: colors.brand,
127
+ outlinedSecondaryBg: colors.neutral100,
128
+ outlinedTertiaryLabel: colors.link,
129
+ outlinedTertiaryBorder: colors.link,
130
+ outlinedTertiaryBg: colors.neutral100,
131
+ outlinedNeutralLabel: colors.neutral100,
132
+ outlinedNeutralBorder: colors.neutral100,
133
+ outlinedNeutralBg: colors.transparent,
134
+ outlinedDisabledLabel: colors.disabledText,
135
+ outlinedDisabledBg: colors.neutral300,
136
+ containedPrimaryLabel: colors.neutral100,
137
+ containedPrimaryBg: colors.neutral900,
138
+ containedSecondaryLabel: colors.neutral100,
139
+ containedSecondaryBg: colors.brand,
140
+ containedTertiaryLabel: colors.neutral100,
141
+ containedTertiaryBg: colors.link,
142
+ containedDisabledLabel: colors.disabledText,
143
+ containedDisabledBg: colors.neutral300,
144
+ containedNeutralLabel: colors.neutral900,
145
+ containedNeutralBg: colors.neutral100,
146
+ hover,
147
+ },
148
+ chip: {
149
+ nonSelectedPrimaryLabel: colors.neutral900,
150
+ disabledPrimaryLabel: colors.disabledText,
151
+ selectedPrimaryLabel: colors.neutral900,
152
+ selectedPrimaryBorder: colors.neutral900,
153
+ selectedPrimaryBg: colors.neutral300,
154
+ disabledPrimaryBg: colors.neutral100,
155
+ },
156
+ dropdown: {
157
+ shadow: colors.shadow,
158
+ },
159
+ tab: {
160
+ nonSelectedPrimaryLabel: colors.neutral700,
161
+ selectedPrimaryLabel: colors.neutral900,
162
+ },
163
+ sidenav: {
164
+ primaryBg: colors.neutral900,
165
+ selectedTabBg: colors.highlightBg,
166
+ },
167
+ tooltip: {
168
+ primaryBg: colors.neutral900,
169
+ },
170
+ background: {
171
+ primary: colors.neutral900,
172
+ secondary: colors.brand,
173
+ tertiary: colors.link,
174
+ brand: colors.brand,
175
+ brandLightBg: colors.brandBg,
176
+ link: colors.link,
177
+ link2: colors.link2,
178
+ linkLightBg: colors.linkBg,
179
+ success: colors.success,
180
+ successLightBg: colors.successBg,
181
+ alert: colors.alert,
182
+ alertLightBg: colors.alertBg,
183
+ alertSoft: colors.alert100,
184
+ warning: colors.warning,
185
+ warningLightBg: colors.warningBg,
186
+ neutral: colors.neutral100,
187
+ disabled: colors.neutral300,
188
+ disabledSecondaryLight: colors.neutral350,
189
+ disabledSecondary: colors.neutral400,
190
+ disabledDark: colors.disabled100,
191
+ defaultDark: colors.neutral700,
192
+ defaultDarkest: colors.neutral900,
193
+ grey: colors.neutral500,
194
+ secondary2: colors.blue100,
195
+ sandGrey100: colors.sandGrey100,
196
+ },
197
+ border: {
198
+ primary: colors.neutral900,
199
+ secondary: colors.brand,
200
+ tertiary: colors.link,
201
+ brand: colors.brand,
202
+ neutral: colors.neutral900,
203
+ link: colors.link,
204
+ default: colors.line,
205
+ defaultDark: colors.neutral700,
206
+ disabled: colors.neutral500,
207
+ disabledDark: colors.disabled100,
208
+ warning: colors.warning,
209
+ divider: colors.neutral300,
210
+ },
211
+ spinner: {
212
+ primary: colors.neutral700,
213
+ primaryBg: colors.alertBg,
214
+ },
215
+ shimmer: {
216
+ disabledLight: colors.disabledLight,
217
+ disabledDark: colors.disabled250,
218
+ },
219
+ coupon: {
220
+ primaryBg: colors.blue100,
221
+ },
222
+ alert: {
223
+ success: colors.successBg,
224
+ warning: colors.alertBg,
225
+ info: colors.blue100,
226
+ error: colors.orange100,
227
+ neutral: colors.neutral100,
228
+ },
229
+ badge: {
230
+ curacao: colors.curacao250,
231
+ curacao900: colors.curacao900,
232
+ pinaColada: colors.pinaColada250,
233
+ margarita250: colors.margarita250,
234
+ default: colors.neutral300,
235
+ green: colors.successBg,
236
+ margarita100: colors.margarita100,
237
+ yellow: colors.alertBg,
238
+ orange100: colors.orange100,
239
+ orange250: colors.orange250,
240
+ orange500: colors.orange500,
241
+ red: colors.warningBg,
242
+ green500: colors.success500,
243
+ green600: colors.success600,
244
+ purple100: colors.purple100,
245
+ purple250: colors.purple250,
246
+ gray100: colors.gray100,
247
+ gray250: colors.gray250,
248
+ aqua100: colors.aqua100,
249
+ aqua250: colors.aqua250,
250
+ black: colors.black,
251
+ link: colors.link,
252
+ linkText: colors.linkText,
253
+ blue100: colors.blue100,
254
+ blue500: colors.blue500,
255
+ blue900: colors.blue900,
256
+ neutral100: colors.neutral100,
257
+ pinaColada750: colors.pinaColada750,
258
+ pinaColada100: colors.pinaColada100,
259
+ brown: colors.brown,
260
+ },
261
+ counter,
262
+ calendar: {
263
+ accent: colors.neutral900,
264
+ background: colors.neutral300,
265
+ selected: colors.neutral900,
266
+ },
267
+ },
268
+ elevation: { ...elevation },
269
+ border: {
270
+ ...border,
271
+ },
272
+ spacing: {
273
+ ...spacing,
274
+ },
275
+ typography: {
276
+ ...typography,
277
+ },
278
+ size: {
279
+ ...size,
280
+ },
281
+ transitions: {
282
+ duration,
283
+ easing,
284
+ create,
285
+ getAutoHeightDuration,
286
+ },
287
+ underline: {
288
+ link: '',
289
+ primary: '',
290
+ secondary: '',
291
+ tertiary: '',
292
+ disabled: '',
293
+ heading: '',
294
+ subHeading: '',
295
+ success: '',
296
+ warning: '',
297
+ neutral: '',
298
+ link2: '',
299
+ primary2: '',
300
+ secondary2: '',
301
+ grapetini900: '',
302
+ pinaColada750: '',
303
+ alert: '',
304
+ },
305
+ zIndex,
306
+ };
307
+
308
+ export default BaseTheme;
@@ -0,0 +1,86 @@
1
+ import { Theme } from './type';
2
+ import { colors } from '@cleartrip/ct-design-tokens';
3
+ import BaseTheme from './BaseTheme';
4
+
5
+ const hover = (key: string) => {
6
+ const bg = {
7
+ [colors.neutral100]: colors.neutral100,
8
+ [colors.brand]: colors.bgPrimaryHover,
9
+ [colors.disabledText]: colors.disabledText,
10
+ [colors.neutral300]: colors.neutral300,
11
+ [colors.link2]: colors.link2Hover,
12
+ [colors.neutral100]: colors.neutral100,
13
+ [colors.neutral900]: colors.neutral900,
14
+ [colors.superGrey700]: colors.superGrey700,
15
+ [colors.superGrey300]: colors.superGrey300,
16
+ [colors.superGrey800]: colors.superGrey800,
17
+ [colors.superGreen500]: colors.superGreen500,
18
+ };
19
+ return bg[key];
20
+ };
21
+
22
+ const SMTheme: Theme = {
23
+ ...BaseTheme,
24
+ color: {
25
+ ...BaseTheme.color,
26
+ text: {
27
+ ...BaseTheme.color.text,
28
+ primary: colors.superGrey800,
29
+ secondary: colors.superGrey500,
30
+ tertiary: colors.superGrey400,
31
+ warning: colors.systemRed500,
32
+ disabled: colors.superGrey400,
33
+ subHeading: colors.superGrey400,
34
+ success: colors.systemGreen500,
35
+ link: colors.superBlue500,
36
+ link2: colors.superBlue500,
37
+ },
38
+ button: {
39
+ ...BaseTheme.color.button,
40
+ outlinedPrimaryLabel: colors.superGrey700,
41
+ outlinedPrimaryBorder: colors.superGrey300,
42
+ outlinedTertiaryLabel: colors.superGrey700,
43
+ outlinedTertiaryBorder: colors.superGrey300,
44
+ outlinedDisabledLabel: colors.disabledText,
45
+ containedSecondaryLabel: colors.superGrey800,
46
+ containedPrimaryBg: colors.superBlue500,
47
+ containedSecondaryBg: colors.superGreen500,
48
+ containedTertiaryLabel: colors.superGrey300,
49
+ containedDisabledLabel: colors.disabledText,
50
+ containedPrimaryLabel: colors.neutral100,
51
+ hover: hover,
52
+ },
53
+ chip: {
54
+ ...BaseTheme.color.chip,
55
+ selectedPrimaryLabel: colors.superBlue500,
56
+ selectedPrimaryBorder: colors.superBlue500,
57
+ selectedPrimaryBg: colors.superBlue25,
58
+ disabledPrimaryLabel: colors.superGrey400,
59
+ nonSelectedPrimaryLabel: colors.superGrey700,
60
+ disabledPrimaryBg: colors.superGrey200,
61
+ },
62
+ tab: {
63
+ ...BaseTheme.color.tab,
64
+ nonSelectedPrimaryLabel: colors.superGrey500,
65
+ selectedPrimaryLabel: colors.superBlue500,
66
+ },
67
+ background: {
68
+ ...BaseTheme.color.background,
69
+ primary: colors.superBlue500,
70
+ disabled: colors.superGrey50,
71
+ disabledDark: colors.superGrey300,
72
+ warning: colors.systemRed500,
73
+ },
74
+ border: {
75
+ ...BaseTheme.color.border,
76
+ primary: colors.superBlue500,
77
+ secondary: colors.neutral900,
78
+ disabledDark: colors.superGrey300,
79
+ defaultDark: colors.superGrey400,
80
+ default: colors.superGrey300,
81
+ disabled: colors.superGrey200,
82
+ },
83
+ },
84
+ };
85
+
86
+ export default SMTheme;
@@ -0,0 +1,93 @@
1
+ import { colors } from '@cleartrip/ct-design-tokens';
2
+
3
+ import { Theme } from './type';
4
+ import BaseTheme from './BaseTheme';
5
+
6
+ const hover = (key: string) => {
7
+ const bg = {
8
+ [colors.neutral100]: colors.neutral100,
9
+ [colors.neutral900]: colors.neutral900,
10
+ [colors.neutral900]: colors.neutral900,
11
+ [colors.neutral100]: colors.neutral100,
12
+ [colors.brand]: colors.bgPrimaryHover,
13
+ [colors.neutral100]: colors.neutral100,
14
+ [colors.disabledText]: colors.disabledText,
15
+ [colors.neutral300]: colors.neutral300,
16
+ [colors.neutral100]: colors.neutral100,
17
+ [colors.link2]: colors.link2Hover,
18
+ [colors.neutral100]: colors.neutral100,
19
+ [colors.neutral900]: colors.neutral900,
20
+ [colors.neutral100]: colors.neutral100,
21
+ [colors.disabledText]: colors.disabledText,
22
+ [colors.neutral300]: colors.neutral300,
23
+ [colors.bluePrimary500]: colors.bluePrimary500,
24
+ [colors.yellowSecondary]: colors.yellowSecondary,
25
+ };
26
+ return bg[key];
27
+ };
28
+
29
+ const counter = {
30
+ enabled: {
31
+ stroke: colors.bluePrimary500,
32
+ },
33
+ disabled: {
34
+ stroke: colors.neutral500,
35
+ },
36
+ };
37
+
38
+ const FKTheme: Theme = {
39
+ ...BaseTheme,
40
+ color: {
41
+ ...BaseTheme.color,
42
+ text: {
43
+ ...BaseTheme.color.text,
44
+ link: colors.bluePrimary500,
45
+ },
46
+ button: {
47
+ ...BaseTheme.color.button,
48
+ outlinedPrimaryLabel: colors.primaryNeutral900,
49
+ outlinedPrimaryBg: colors.neutral100,
50
+ containedPrimaryLabel: colors.neutral100,
51
+ containedPrimaryBg: colors.bluePrimary500,
52
+ containedSecondaryLabel: colors.primaryNeutral900,
53
+ containedSecondaryBg: colors.yellowSecondary,
54
+ hover: hover,
55
+ },
56
+ chip: {
57
+ ...BaseTheme.color.chip,
58
+ selectedPrimaryLabel: colors.link2,
59
+ selectedPrimaryBorder: colors.link2,
60
+ selectedPrimaryBg: colors.linkBg,
61
+ nonSelectedPrimaryLabel: colors.neutral900,
62
+ },
63
+ tab: {
64
+ ...BaseTheme.color.tab,
65
+ nonSelectedPrimaryLabel: colors.neutral900,
66
+ selectedPrimaryLabel: colors.bluePrimary500,
67
+ },
68
+ background: {
69
+ ...BaseTheme.color.background,
70
+ primary: colors.bluePrimary500,
71
+ secondary: colors.neutral900,
72
+ tertiary: colors.brand,
73
+ linkLightBg: colors.blueSecondary,
74
+ },
75
+ border: {
76
+ ...BaseTheme.color.border,
77
+ primary: colors.bluePrimary500,
78
+ brand: colors.bluePrimary500,
79
+ },
80
+ spinner: {
81
+ primary: colors.link2,
82
+ primaryBg: colors.alertBg,
83
+ },
84
+ counter,
85
+ calendar: {
86
+ accent: colors.bluePrimary500,
87
+ background: colors.blueSecondary,
88
+ selected: colors.bluePrimary500,
89
+ },
90
+ },
91
+ };
92
+
93
+ export default FKTheme;
@@ -0,0 +1,7 @@
1
+ export { default as B2CTheme } from './B2CTheme';
2
+ export { default as B2BTheme } from './B2BTheme';
3
+ export { default as FKTheme } from './UltraFkTheme';
4
+ export { default as BaseTheme } from './BaseTheme';
5
+ export { default as SMTheme } from './SMTheme';
6
+
7
+ export * from './type';
@@ -0,0 +1,234 @@
1
+ import '@emotion/styled';
2
+ import type { Border } from '@cleartrip/ct-design-tokens';
3
+ import { Size, Elevation } from '@cleartrip/ct-design-tokens';
4
+ import type { Spacing } from '@cleartrip/ct-design-tokens';
5
+ import type { Typography } from '@cleartrip/ct-design-tokens';
6
+
7
+ export type UnderlineType = '' | 'underline';
8
+
9
+ export type Theme = {
10
+ color: {
11
+ text: {
12
+ primary: string;
13
+ secondary: string;
14
+ tertiary: string;
15
+ heading: string;
16
+ subHeading: string;
17
+ disabled: string;
18
+ success: string;
19
+ alert: string;
20
+ warning: string;
21
+ link: string;
22
+ brand: string;
23
+ neutral: string;
24
+ link2: string;
25
+ margarita: string;
26
+ // it's a new color introducted in figma
27
+ alert500: string;
28
+ primary2: string;
29
+ secondary2: string;
30
+ grapetini900: string;
31
+ pinaColada750: string;
32
+ neutral50: string;
33
+ coralpink: string;
34
+ };
35
+ button: {
36
+ outlinedPrimaryLabel: string;
37
+ outlinedPrimaryBorder: string;
38
+ outlinedPrimaryBg: string;
39
+ outlinedSecondaryLabel: string;
40
+ outlinedSecondaryBorder: string;
41
+ outlinedSecondaryBg: string;
42
+ outlinedTertiaryLabel: string;
43
+ outlinedTertiaryBorder: string;
44
+ outlinedTertiaryBg: string;
45
+ outlinedNeutralLabel: string;
46
+ outlinedNeutralBorder: string;
47
+ outlinedNeutralBg: string;
48
+ outlinedDisabledLabel: string;
49
+ outlinedDisabledBg: string;
50
+ containedPrimaryLabel: string;
51
+ containedPrimaryBg: string;
52
+ containedSecondaryLabel: string;
53
+ containedSecondaryBg: string;
54
+ containedTertiaryLabel: string;
55
+ containedTertiaryBg: string;
56
+ containedDisabledLabel: string;
57
+ containedDisabledBg: string;
58
+ containedNeutralLabel: string;
59
+ containedNeutralBg: string;
60
+ hover: unknown;
61
+ };
62
+ chip: {
63
+ nonSelectedPrimaryLabel: string;
64
+ selectedPrimaryLabel: string;
65
+ selectedPrimaryBorder: string;
66
+ selectedPrimaryBg: string;
67
+ disabledPrimaryLabel: string;
68
+ disabledPrimaryBg: string;
69
+ };
70
+ dropdown: {
71
+ shadow: string;
72
+ };
73
+ tab: {
74
+ nonSelectedPrimaryLabel: string;
75
+ selectedPrimaryLabel: string;
76
+ };
77
+ sidenav: {
78
+ primaryBg: string;
79
+ selectedTabBg: string;
80
+ };
81
+ tooltip: {
82
+ primaryBg: string;
83
+ };
84
+ background: {
85
+ primary: string;
86
+ secondary: string;
87
+ tertiary: string;
88
+ brand: string;
89
+ brandLightBg: string;
90
+ link: string;
91
+ link2: string;
92
+ linkLightBg: string;
93
+ success: string;
94
+ successLightBg: string;
95
+ alert: string;
96
+ alertLightBg: string;
97
+ alertSoft: string;
98
+ warning: string;
99
+ warningLightBg: string;
100
+ neutral: string;
101
+ disabled: string;
102
+ disabledSecondaryLight: string;
103
+ disabledSecondary: string;
104
+ disabledDark: string;
105
+ defaultDark: string;
106
+ defaultDarkest: string;
107
+ grey: string;
108
+ secondary2: string;
109
+ sandGrey100: string;
110
+ };
111
+ border: {
112
+ primary: string;
113
+ secondary: string;
114
+ tertiary: string;
115
+ brand: string;
116
+ neutral: string;
117
+ link: string;
118
+ default: string;
119
+ defaultDark: string;
120
+ disabled: string;
121
+ disabledDark: string;
122
+ warning: string;
123
+ divider: string;
124
+ };
125
+ spinner: {
126
+ primary: string;
127
+ primaryBg: string;
128
+ };
129
+ shimmer: {
130
+ disabledLight: string;
131
+ disabledDark: string;
132
+ };
133
+ counter: {
134
+ enabled: {
135
+ stroke: string;
136
+ };
137
+ disabled: {
138
+ stroke: string;
139
+ };
140
+ };
141
+ coupon: {
142
+ primaryBg: string;
143
+ };
144
+ alert: {
145
+ success: string;
146
+ warning: string;
147
+ error: string;
148
+ info: string;
149
+ neutral: string;
150
+ };
151
+ badge: {
152
+ curacao: string;
153
+ curacao900: string;
154
+ pinaColada: string;
155
+ margarita250: string;
156
+ default: string;
157
+ green: string;
158
+ margarita100: string;
159
+ yellow: string;
160
+ orange100: string;
161
+ orange250: string;
162
+ orange500: string;
163
+ red: string;
164
+ green500: string;
165
+ green600: string;
166
+ purple100: string;
167
+ purple250: string;
168
+ gray100: string;
169
+ gray250: string;
170
+ aqua100: string;
171
+ aqua250: string;
172
+ black: string;
173
+ link: string;
174
+ linkText: string;
175
+ blue100: string;
176
+ blue500: string;
177
+ blue900: string;
178
+ neutral100: string;
179
+ pinaColada750: string;
180
+ pinaColada100: string;
181
+ brown: string;
182
+ };
183
+ calendar: {
184
+ accent: string;
185
+ background: string;
186
+ selected: string;
187
+ };
188
+ };
189
+ elevation: Elevation;
190
+ border: Border;
191
+ spacing: Spacing;
192
+ typography: Typography;
193
+ size: Size;
194
+ transitions: {
195
+ easing: {
196
+ easeInOut: string;
197
+ easeOut: string;
198
+ easeIn: string;
199
+ sharp: string;
200
+ };
201
+ duration: {
202
+ shortest: number;
203
+ shorter: number;
204
+ short: number;
205
+ standard: number;
206
+ complex: number;
207
+ enteringScreen: number;
208
+ leavingScreen: number;
209
+ };
210
+ getAutoHeightDuration: unknown;
211
+ create: unknown;
212
+ };
213
+ zIndex: Record<'modal' | 'drawer' | 'tooltip' | 'popOver' | 'sideNav' | 'toolbar' | 'bottomSheet', number>;
214
+ underline: {
215
+ link: UnderlineType;
216
+ primary: UnderlineType;
217
+ secondary: UnderlineType;
218
+ tertiary: UnderlineType;
219
+ disabled: UnderlineType;
220
+ heading: UnderlineType;
221
+ subHeading: UnderlineType;
222
+ success: UnderlineType;
223
+ warning: UnderlineType;
224
+ neutral: UnderlineType;
225
+ link2: UnderlineType;
226
+ primary2: UnderlineType;
227
+ secondary2: UnderlineType;
228
+ grapetini900: UnderlineType;
229
+ pinaColada750: UnderlineType;
230
+ alert: UnderlineType;
231
+ };
232
+ };
233
+
234
+ 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
+ };