@cleartrip/ct-design-theme 4.0.0-rc → 5.0.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.
@@ -1,5 +1,6 @@
1
1
  import { colors, border, typography, spacing, size, elevation } from '@cleartrip/ct-design-tokens';
2
- import { Theme } from './type';
2
+
3
+ import type { Theme } from './type';
3
4
 
4
5
  // inspired from chakra UI
5
6
  export const duration = {
@@ -40,8 +41,10 @@ function getAutoHeightDuration(height: number) {
40
41
  return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
41
42
  }
42
43
 
43
- const create = (props = ['all'], options: unknown = {}) => {
44
- // @ts-ignore
44
+ const create = (
45
+ props = ['all'],
46
+ options: { duration?: number | string; easing?: string; delay?: number | string } = {},
47
+ ) => {
45
48
  const { duration: durationOption = duration.standard, easing: easingOption = easing.easeInOut, delay = 0 } = options;
46
49
  return (Array.isArray(props) ? props : [props])
47
50
  .map(
@@ -53,27 +56,6 @@ const create = (props = ['all'], options: unknown = {}) => {
53
56
  .join(',');
54
57
  };
55
58
 
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
59
  const zIndex = {
78
60
  drawer: 1200,
79
61
  modal: 1300,
@@ -82,6 +64,7 @@ const zIndex = {
82
64
  sideNav: 100,
83
65
  toolbar: 50,
84
66
  bottomSheet: 100,
67
+ pageLoader: 1600,
85
68
  };
86
69
 
87
70
  const counter = {
@@ -104,7 +87,6 @@ const BaseTheme: Theme = {
104
87
  disabled: colors.disabledText,
105
88
  success: colors.successText,
106
89
  alert: colors.alertText,
107
- alert500: colors.alert500,
108
90
  warning: colors.warningText,
109
91
  link: colors.linkText,
110
92
  brand: colors.brandText,
@@ -115,8 +97,13 @@ const BaseTheme: Theme = {
115
97
  secondary2: colors.blue100,
116
98
  grapetini900: colors.grapetini900,
117
99
  pinaColada750: colors.pinaColada750,
100
+ alert500: colors.alert500,
118
101
  neutral50: colors.neutral50,
119
- coralpink: colors.coralpink,
102
+ margarita750: colors.margarita750,
103
+ green100: colors.green100,
104
+ red100: colors.red100,
105
+ coralpink: colors.pinkVibrant500,
106
+ primary3: colors.bluePrimary500,
120
107
  },
121
108
  button: {
122
109
  outlinedPrimaryLabel: colors.neutral900,
@@ -128,9 +115,6 @@ const BaseTheme: Theme = {
128
115
  outlinedTertiaryLabel: colors.link,
129
116
  outlinedTertiaryBorder: colors.link,
130
117
  outlinedTertiaryBg: colors.neutral100,
131
- outlinedNeutralLabel: colors.neutral100,
132
- outlinedNeutralBorder: colors.neutral100,
133
- outlinedNeutralBg: colors.transparent,
134
118
  outlinedDisabledLabel: colors.disabledText,
135
119
  outlinedDisabledBg: colors.neutral300,
136
120
  containedPrimaryLabel: colors.neutral100,
@@ -143,7 +127,26 @@ const BaseTheme: Theme = {
143
127
  containedDisabledBg: colors.neutral300,
144
128
  containedNeutralLabel: colors.neutral900,
145
129
  containedNeutralBg: colors.neutral100,
146
- hover,
130
+ outlinedNeutralLabel: colors.neutral900,
131
+ outlinedNeutralBorder: colors.neutral900,
132
+ outlinedNeutralBg: colors.neutral100,
133
+ hover: {
134
+ [colors.neutral100]: colors.neutral100,
135
+ [colors.neutral900]: colors.neutral900,
136
+ [colors.neutral900]: colors.neutral900,
137
+ [colors.neutral100]: colors.neutral100,
138
+ [colors.brand]: colors.bgPrimaryHover,
139
+ [colors.neutral100]: colors.neutral100,
140
+ [colors.disabledText]: colors.disabledText,
141
+ [colors.neutral300]: colors.neutral300,
142
+ [colors.neutral100]: colors.neutral100,
143
+ [colors.link2]: colors.link2Hover,
144
+ [colors.neutral100]: colors.neutral100,
145
+ [colors.neutral900]: colors.neutral900,
146
+ [colors.neutral100]: colors.neutral100,
147
+ [colors.disabledText]: colors.disabledText,
148
+ [colors.neutral300]: colors.neutral300,
149
+ },
147
150
  },
148
151
  chip: {
149
152
  nonSelectedPrimaryLabel: colors.neutral900,
@@ -151,7 +154,7 @@ const BaseTheme: Theme = {
151
154
  selectedPrimaryLabel: colors.neutral900,
152
155
  selectedPrimaryBorder: colors.neutral900,
153
156
  selectedPrimaryBg: colors.neutral300,
154
- disabledPrimaryBg: colors.neutral100,
157
+ disabledPrimaryBg: colors.neutral300,
155
158
  },
156
159
  dropdown: {
157
160
  shadow: colors.shadow,
@@ -189,10 +192,23 @@ const BaseTheme: Theme = {
189
192
  disabledSecondary: colors.neutral400,
190
193
  disabledDark: colors.disabled100,
191
194
  defaultDark: colors.neutral700,
195
+ darkGrey: colors.darkGrey,
192
196
  defaultDarkest: colors.neutral900,
193
- grey: colors.neutral500,
197
+ darkNetural300: colors.darkNeutral300,
198
+ transparent: colors.transparent,
194
199
  secondary2: colors.blue100,
195
- sandGrey100: colors.sandGrey100,
200
+ gray500: colors.gray500,
201
+ mintCream: colors.mintCream,
202
+ pinaColada100: colors.pinaColada100,
203
+ margarita100: colors.margarita100,
204
+ lightCyan: colors.lightCyan,
205
+ neutral300: colors.neutral300,
206
+ orange200: colors.orange200,
207
+ couponGreen: colors.couponGreen,
208
+ black100: colors.black100,
209
+ orange100: colors.orange100,
210
+ lightRed: colors.red100,
211
+ neutral100: colors.neutral100,
196
212
  },
197
213
  border: {
198
214
  primary: colors.neutral900,
@@ -207,6 +223,12 @@ const BaseTheme: Theme = {
207
223
  disabledDark: colors.disabled100,
208
224
  warning: colors.warning,
209
225
  divider: colors.neutral300,
226
+ borderAccent: colors.lightSkyBlue,
227
+ neutral100: colors.neutral100,
228
+ bluePrimary500: colors.bluePrimary500,
229
+ disabled100: colors.disabled100,
230
+ lightGray: colors.lightGray,
231
+ darkRed: colors.red500,
210
232
  },
211
233
  spinner: {
212
234
  primary: colors.neutral700,
@@ -222,23 +244,27 @@ const BaseTheme: Theme = {
222
244
  alert: {
223
245
  success: colors.successBg,
224
246
  warning: colors.alertBg,
247
+ warningLight: colors.warningLight,
225
248
  info: colors.blue100,
226
- error: colors.orange100,
249
+ error: colors.warningBg,
227
250
  neutral: colors.neutral100,
228
251
  },
229
252
  badge: {
230
253
  curacao: colors.curacao250,
231
254
  curacao900: colors.curacao900,
232
255
  pinaColada: colors.pinaColada250,
256
+ pinaColada300: colors.pinaColada300,
233
257
  margarita250: colors.margarita250,
234
258
  default: colors.neutral300,
235
259
  green: colors.successBg,
260
+ green100: colors.freshGreen100,
236
261
  margarita100: colors.margarita100,
237
262
  yellow: colors.alertBg,
238
263
  orange100: colors.orange100,
239
264
  orange250: colors.orange250,
240
265
  orange500: colors.orange500,
241
266
  red: colors.warningBg,
267
+ red100: colors.alert100,
242
268
  green500: colors.success500,
243
269
  green600: colors.success600,
244
270
  purple100: colors.purple100,
@@ -249,13 +275,20 @@ const BaseTheme: Theme = {
249
275
  aqua250: colors.aqua250,
250
276
  black: colors.black,
251
277
  link: colors.link,
252
- linkText: colors.linkText,
253
278
  blue100: colors.blue100,
254
- blue500: colors.blue500,
255
279
  blue900: colors.blue900,
280
+ blue500: colors.blue500,
256
281
  neutral100: colors.neutral100,
282
+ neutral700: colors.neutral700,
257
283
  pinaColada750: colors.pinaColada750,
258
284
  pinaColada100: colors.pinaColada100,
285
+ gray800: colors.gray800,
286
+ couponGreen: colors.couponGreen,
287
+ alert500: colors.alert500,
288
+ alertSoft: colors.alert100,
289
+ red200: colors.red200,
290
+ red500: colors.red500,
291
+ redSoft: colors.red100,
259
292
  brown: colors.brown,
260
293
  },
261
294
  counter,
@@ -264,6 +297,19 @@ const BaseTheme: Theme = {
264
297
  background: colors.neutral300,
265
298
  selected: colors.neutral900,
266
299
  },
300
+ cursor: {
301
+ neutral900: colors.neutral900,
302
+ },
303
+ chipicon: {
304
+ default: colors.neutral900,
305
+ blue: colors.blueSky500,
306
+ pink: colors.pinkVibrant500,
307
+ yellow: colors.yellowSun500,
308
+ purple: colors.purpleRoyal500,
309
+ green: colors.greenFresh500,
310
+ cfwBlue: colors.blue900,
311
+ orange: colors.orange500,
312
+ },
267
313
  },
268
314
  elevation: { ...elevation },
269
315
  border: {
@@ -284,24 +330,6 @@ const BaseTheme: Theme = {
284
330
  create,
285
331
  getAutoHeightDuration,
286
332
  },
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
333
  zIndex,
306
334
  };
307
335
 
@@ -4,4 +4,4 @@ export { default as FKTheme } from './UltraFkTheme';
4
4
  export { default as BaseTheme } from './BaseTheme';
5
5
  export { default as SMTheme } from './SMTheme';
6
6
 
7
- export * from './type';
7
+ export type * from './type';
@@ -23,13 +23,17 @@ export type Theme = {
23
23
  link2: string;
24
24
  margarita: string;
25
25
  // it's a new color introducted in figma
26
- alert500: string;
27
26
  primary2: string;
28
27
  secondary2: string;
29
28
  grapetini900: string;
30
29
  pinaColada750: string;
30
+ alert500: string;
31
31
  neutral50: string;
32
+ margarita750?: string;
33
+ green100: string;
34
+ red100: string;
32
35
  coralpink: string;
36
+ primary3: string;
33
37
  };
34
38
  button: {
35
39
  outlinedPrimaryLabel: string;
@@ -41,9 +45,6 @@ export type Theme = {
41
45
  outlinedTertiaryLabel: string;
42
46
  outlinedTertiaryBorder: string;
43
47
  outlinedTertiaryBg: string;
44
- outlinedNeutralLabel: string;
45
- outlinedNeutralBorder: string;
46
- outlinedNeutralBg: string;
47
48
  outlinedDisabledLabel: string;
48
49
  outlinedDisabledBg: string;
49
50
  containedPrimaryLabel: string;
@@ -56,6 +57,9 @@ export type Theme = {
56
57
  containedDisabledBg: string;
57
58
  containedNeutralLabel: string;
58
59
  containedNeutralBg: string;
60
+ outlinedNeutralLabel: string;
61
+ outlinedNeutralBorder: string;
62
+ outlinedNeutralBg: string;
59
63
  hover: unknown;
60
64
  };
61
65
  chip: {
@@ -103,9 +107,22 @@ export type Theme = {
103
107
  disabledDark: string;
104
108
  defaultDark: string;
105
109
  defaultDarkest: string;
106
- grey: string;
110
+ darkNetural300: string;
111
+ darkGrey: string;
112
+ transparent: string;
107
113
  secondary2: string;
108
- sandGrey100: string;
114
+ gray500: string;
115
+ mintCream: string;
116
+ pinaColada100: string;
117
+ lightCyan: string;
118
+ margarita100: string;
119
+ neutral300: string;
120
+ orange200: string;
121
+ couponGreen: string;
122
+ black100: string;
123
+ orange100: string;
124
+ lightRed: string;
125
+ neutral100: string;
109
126
  };
110
127
  border: {
111
128
  primary: string;
@@ -120,6 +137,12 @@ export type Theme = {
120
137
  disabledDark: string;
121
138
  warning: string;
122
139
  divider: string;
140
+ disabled100: string;
141
+ borderAccent: string;
142
+ neutral100: string;
143
+ bluePrimary500: string;
144
+ lightGray: string;
145
+ darkRed: string;
123
146
  };
124
147
  spinner: {
125
148
  primary: string;
@@ -143,6 +166,7 @@ export type Theme = {
143
166
  alert: {
144
167
  success: string;
145
168
  warning: string;
169
+ warningLight: string;
146
170
  error: string;
147
171
  info: string;
148
172
  neutral: string;
@@ -151,15 +175,18 @@ export type Theme = {
151
175
  curacao: string;
152
176
  curacao900: string;
153
177
  pinaColada: string;
178
+ pinaColada300: string;
154
179
  margarita250: string;
155
180
  default: string;
156
181
  green: string;
182
+ green100: string;
157
183
  margarita100: string;
158
184
  yellow: string;
159
185
  orange100: string;
160
186
  orange250: string;
161
187
  orange500: string;
162
188
  red: string;
189
+ red100: string;
163
190
  green500: string;
164
191
  green600: string;
165
192
  purple100: string;
@@ -170,13 +197,20 @@ export type Theme = {
170
197
  aqua250: string;
171
198
  black: string;
172
199
  link: string;
173
- linkText: string;
174
200
  blue100: string;
175
- blue500: string;
176
201
  blue900: string;
202
+ blue500: string;
177
203
  neutral100: string;
204
+ neutral700: string;
178
205
  pinaColada750: string;
179
206
  pinaColada100: string;
207
+ gray800: string;
208
+ couponGreen: string;
209
+ alert500: string;
210
+ alertSoft: string;
211
+ red200: string;
212
+ red500: string;
213
+ redSoft: string;
180
214
  brown: string;
181
215
  };
182
216
  calendar: {
@@ -184,6 +218,19 @@ export type Theme = {
184
218
  background: string;
185
219
  selected: string;
186
220
  };
221
+ cursor: {
222
+ neutral900: string;
223
+ };
224
+ chipicon: {
225
+ default: string;
226
+ blue: string;
227
+ pink: string;
228
+ yellow: string;
229
+ purple: string;
230
+ green: string;
231
+ cfwBlue: string;
232
+ orange: string;
233
+ };
187
234
  };
188
235
  elevation: Elevation;
189
236
  border: Border;
@@ -206,28 +253,20 @@ export type Theme = {
206
253
  enteringScreen: number;
207
254
  leavingScreen: number;
208
255
  };
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;
256
+ getAutoHeightDuration: (height: number) => number;
257
+ create: (
258
+ props: string[],
259
+ options: {
260
+ duration?: number | string;
261
+ easing?: string;
262
+ delay?: number | string;
263
+ },
264
+ ) => string;
230
265
  };
266
+ zIndex: Record<
267
+ 'modal' | 'drawer' | 'tooltip' | 'popOver' | 'sideNav' | 'toolbar' | 'bottomSheet' | 'pageLoader',
268
+ number
269
+ >;
231
270
  };
232
271
 
233
272
  export type ThemeType = 'B2C' | 'B2B' | 'FK' | 'SM';