@cleartrip/ct-design-header 1.2.0-SNAPSHOT-header-v0.11.0 → 1.2.0-SNAPSHOT-header-fix-v3.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,8 +1,12 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-typography'), require('@cleartrip/ct-design-button'), require('@cleartrip/ct-design-divider'), require('@cleartrip/ct-design-icons')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', '@cleartrip/ct-design-typography', '@cleartrip/ct-design-button', '@cleartrip/ct-design-divider', '@cleartrip/ct-design-icons'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemHeader = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.ctDesignTypography, global.ctDesignButton, global.ctDesignDivider, global.ctDesignIcons));
5
- })(this, (function (exports, jsxRuntime, react, ctDesignContainer, ctDesignTypography, ctDesignButton, ctDesignDivider, ctDesignIcons) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-typography'), require('@cleartrip/ct-design-button'), require('@cleartrip/ct-design-divider'), require('@cleartrip/ct-design-icons'), require('styled-components'), require('@cleartrip/ct-design-shimmer')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', '@cleartrip/ct-design-typography', '@cleartrip/ct-design-button', '@cleartrip/ct-design-divider', '@cleartrip/ct-design-icons', 'styled-components', '@cleartrip/ct-design-shimmer'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemHeader = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.ctDesignTypography, global.ctDesignButton, global.ctDesignDivider, global.ctDesignIcons, global.styled, global.ctDesignShimmer));
5
+ })(this, (function (exports, jsxRuntime, react, ctDesignContainer, ctDesignTypography, ctDesignButton, ctDesignDivider, ctDesignIcons, styled, ctDesignShimmer) { 'use strict';
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var styled__default = /*#__PURE__*/_interopDefault(styled);
6
10
 
7
11
  /******************************************************************************
8
12
  Copyright (c) Microsoft Corporation.
@@ -39,6 +43,16 @@
39
43
  }
40
44
  return to.concat(ar || Array.prototype.slice.call(from));
41
45
  }
46
+ function __makeTemplateObject(cooked, raw) {
47
+ if (Object.defineProperty) {
48
+ Object.defineProperty(cooked, "raw", {
49
+ value: raw
50
+ });
51
+ } else {
52
+ cooked.raw = raw;
53
+ }
54
+ return cooked;
55
+ }
42
56
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
43
57
  var e = new Error(message);
44
58
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -140,14 +154,14 @@
140
154
  var THEME_CONFIG = {
141
155
  NOVAC: {
142
156
  headerBackground: 'transparent',
143
- hoverColor: '#FFB8A5',
157
+ hoverColor: '#FDBA12',
144
158
  logoFill: '#FFF',
145
159
  fkcompanyColor: '#FFF',
146
160
  typographyColor: '#FFF',
147
161
  loginButtonColorVariant: ctDesignButton.ButtonColor.NEUTRAL
148
162
  },
149
163
  DEFAULT: {
150
- headerBackground: '#F7FAFF',
164
+ headerBackground: '#FFFFFF',
151
165
  hoverColor: '#FF4F17',
152
166
  logoFill: '#FF4F17',
153
167
  fkcompanyColor: '#1A1A1A',
@@ -181,44 +195,54 @@
181
195
  alignItems: 'center',
182
196
  justifyContent: 'center',
183
197
  padding: '16px',
184
- height: '64',
185
- background: '#F3F5FA',
198
+ background: '#F7FAFF',
186
199
  top: '64px',
187
200
  zIndex: 2,
188
201
  css: {
189
- gap: 40
202
+ gap: 24
190
203
  }
191
204
  }, {
192
205
  children: LOB_DATA.map(function (item, index) {
193
206
  var title = item.title,
194
207
  link = item.link,
195
208
  image = item.image;
196
- return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
197
- display: 'flex',
198
- alignItems: 'center',
199
- cursor: 'pointer',
200
- css: {
201
- gap: 8,
202
- background: selectedLOB === title ? '#FFFFFF' : 'transparent',
203
- borderRadius: selectedLOB === title ? '40px' : '0',
204
- padding: selectedLOB === title ? '8px 16px 8px 8px' : '0'
205
- },
206
- onClick: function () {
207
- window.location.href = link;
209
+ var isSelected = selectedLOB === title;
210
+ return jsxRuntime.jsx("a", __assign({
211
+ href: isSelected ? undefined : link,
212
+ style: {
213
+ textDecoration: 'none',
214
+ pointerEvents: isSelected ? 'none' : 'auto'
208
215
  }
209
216
  }, {
210
- children: [jsxRuntime.jsx("img", {
211
- src: image,
212
- alt: title,
213
- width: 32,
214
- height: 32
215
- }), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
216
- variant: selectedLOB === title ? ctDesignTypography.TypographyVariant.HM3 : ctDesignTypography.TypographyVariant.B1,
217
- isClickable: true
217
+ children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
218
+ display: 'flex',
219
+ alignItems: 'center',
220
+ width: '116px',
221
+ height: '48px',
222
+ justifyContent: 'center',
223
+ cursor: 'pointer',
224
+ css: {
225
+ gap: 8,
226
+ background: isSelected ? '#FFFFFF' : 'transparent',
227
+ border: isSelected ? '1px solid #E6E6E6' : '',
228
+ borderRadius: '40px',
229
+ padding: '8px 16px 8px 8px',
230
+ transition: 'background 0.2s ease'
231
+ }
218
232
  }, {
219
- children: title
220
- }))]
221
- }), index);
233
+ children: [jsxRuntime.jsx("img", {
234
+ src: image,
235
+ alt: title,
236
+ width: 32,
237
+ height: 32
238
+ }), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
239
+ variant: isSelected ? ctDesignTypography.TypographyVariant.HM3 : ctDesignTypography.TypographyVariant.B1,
240
+ isClickable: true
241
+ }, {
242
+ children: title
243
+ }))]
244
+ }), index)
245
+ }));
222
246
  })
223
247
  }));
224
248
  };
@@ -566,34 +590,41 @@
566
590
  details = _a.details,
567
591
  link = _a.link,
568
592
  ravenActionName = _a.ravenActionName;
569
- return jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
570
- cursor: 'pointer',
571
- width: '200px',
572
- className: 'bd-hover-container',
593
+ return jsxRuntime.jsxs(BDHoverContainer, __assign({
594
+ className: 'bd-hover-container-js',
573
595
  onClick: function () {
574
596
  return handleBusinessDropdownClick(link, title, ravenActionName);
575
597
  }
576
598
  }, {
577
599
  children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
578
600
  display: 'flex',
579
- flexDirection: 'row',
580
- alignItems: 'center',
581
- columnGap: '8px'
601
+ flexDirection: 'column',
602
+ rowGap: '4px'
582
603
  }, {
583
- children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
584
- variant: 'HM2',
585
- className: 'color-orange-on-hover'
604
+ children: [jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
605
+ display: 'flex',
606
+ flexDirection: 'row',
607
+ alignItems: 'center',
608
+ columnGap: '8px'
586
609
  }, {
587
- children: title
588
- })), jsxRuntime.jsx(AnimatedArrow, {})]
589
- })), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
590
- variant: 'B3',
591
- css: {
592
- marginTop: '4px',
593
- opacity: 0.75
594
- }
595
- }, {
596
- children: subtitle
610
+ children: [jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
611
+ variant: 'HM2',
612
+ className: 'color-orange-on-hover-js',
613
+ css: {
614
+ transition: 'color 200ms ease'
615
+ }
616
+ }, {
617
+ children: title
618
+ })), jsxRuntime.jsx(AnimatedArrow, {})]
619
+ })), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
620
+ variant: 'B3',
621
+ css: {
622
+ marginTop: '4px',
623
+ opacity: 0.75
624
+ }
625
+ }, {
626
+ children: subtitle
627
+ }))]
597
628
  })), jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
598
629
  variant: 'P3',
599
630
  color: 'subheading',
@@ -610,17 +641,38 @@
610
641
  };
611
642
  var AnimatedArrow = function () {
612
643
  return jsxRuntime.jsx(ctDesignContainer.Container, __assign({
613
- className: 'bd-arrow-container'
644
+ className: 'bd-arrow-container-js',
645
+ css: arrowContainerStyles
614
646
  }, {
615
647
  children: __spreadArray([], Array(3), true).map(function (_, index) {
616
648
  return jsxRuntime.jsx(ctDesignContainer.Container, __assign({
617
- className: 'bd-arrow-wrapper'
649
+ className: 'bd-arrow-wrapper-js',
650
+ display: 'flex',
651
+ alignItems: 'center'
618
652
  }, {
619
653
  children: jsxRuntime.jsx(ctDesignIcons.ArrowRight, {})
620
654
  }), index);
621
655
  })
622
656
  }));
623
657
  };
658
+ var moveRight = styled.keyframes(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
659
+ var moveRightAgain = styled.keyframes(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"], ["\n from {\n transform: translateX(-20.01px);\n }\n to {\n transform: translateX(0px);\n }\n"])));
660
+ var arrowContainerStyles = {
661
+ display: 'flex',
662
+ backgroundColor: 'black',
663
+ transition: 'background-color 200ms ease',
664
+ 'flex-direction': 'row',
665
+ justifyContent: 'center',
666
+ width: '20px',
667
+ height: '20px',
668
+ overflow: 'hidden',
669
+ borderRadius: '50%'
670
+ };
671
+ var BDHoverContainer = /*#__PURE__*/styled__default.default.div.withConfig({
672
+ displayName: "BusinessDropdown__BDHoverContainer",
673
+ componentId: "sc-1tsshe4-0"
674
+ })(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"], ["\n cursor: pointer;\n width: 200px;\n &:hover {\n .bd-arrow-container-js {\n background-color: rgba(255, 79, 23, 1);\n transition: color 200ms ease;\n }\n .bd-arrow-wrapper-js {\n animation: ", " 200ms linear;\n display: flex;\n }\n .color-orange-on-hover-js {\n color: rgba(255, 79, 23, 1);\n transition: background-color 200ms ease;\n }\n }\n &:not(:hover) .bd-arrow-wrapper-js {\n animation: ", " 200ms linear backwards;\n }\n"])), moveRight, moveRightAgain);
675
+ var templateObject_1, templateObject_2, templateObject_3;
624
676
 
625
677
  var ACCOUNT_OPTIONS_POPUP_CONFIG = [{
626
678
  text: 'My Profile',
@@ -942,22 +994,20 @@
942
994
  gap: '4px'
943
995
  }
944
996
  }, {
945
- children: [loyaltyLoading ? jsxRuntime.jsx(ctDesignContainer.Container, {
997
+ children: [loyaltyLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
946
998
  width: '50px',
947
999
  height: '32px',
948
- borderRadius: '8px',
949
- backgroundColor: '#efefef'
1000
+ borderRadius: '8px'
950
1001
  }) : selectedLoyaltyType && LOYALTY_DATA[selectedLoyaltyType] && !hideLoyaltyChip && jsxRuntime.jsx(LoyaltyChip, {
951
1002
  icon: LOYALTY_DATA[selectedLoyaltyType].icon,
952
1003
  borderGradient: LOYALTY_DATA[selectedLoyaltyType].borderGradient,
953
1004
  backgroundGradient: LOYALTY_DATA[selectedLoyaltyType].backgroundGradient,
954
1005
  chevronFillColor: ((_a = LOYALTY_DATA[selectedLoyaltyType]) === null || _a === void 0 ? void 0 : _a.chevronFillColor) || '#FFF',
955
1006
  handleChipClick: loyaltyChipClick
956
- }), superCoinsLoading ? jsxRuntime.jsx(ctDesignContainer.Container, {
1007
+ }), superCoinsLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
957
1008
  width: '50px',
958
1009
  height: '32px',
959
- borderRadius: '8px',
960
- backgroundColor: '#efefef'
1010
+ borderRadius: '8px'
961
1011
  }) : !hideSupercoinsChip && jsxRuntime.jsx(ExpandableItem, {
962
1012
  icon: jsxRuntime.jsx(ctDesignIcons.Supercoin, {
963
1013
  width: 20,
@@ -966,11 +1016,10 @@
966
1016
  value: superCoinBalance,
967
1017
  handleChipClick: supercoinsChipClick,
968
1018
  type: 'supercoin'
969
- }), walletLoading ? jsxRuntime.jsx(ctDesignContainer.Container, {
1019
+ }), walletLoading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
970
1020
  width: '50px',
971
1021
  height: '32px',
972
- borderRadius: '8px',
973
- backgroundColor: '#efefef'
1022
+ borderRadius: '8px'
974
1023
  }) : !hideWalletChip && jsxRuntime.jsx(ExpandableItem, {
975
1024
  icon: jsxRuntime.jsx(ctDesignIcons.Wallet, {
976
1025
  width: 20,
@@ -1041,11 +1090,9 @@
1041
1090
  variant: variant,
1042
1091
  color: color
1043
1092
  }, {
1044
- children: loading ? jsxRuntime.jsx(ctDesignContainer.Container, {
1093
+ children: loading ? jsxRuntime.jsx(ctDesignShimmer.Shimmer, {
1045
1094
  height: variant === 'HM3' ? '18px' : '12px',
1046
- width: variant === 'HM3' ? '140px' : '200px',
1047
- backgroundColor: '#efefef',
1048
- borderRadius: '8px'
1095
+ width: variant === 'HM3' ? '140px' : '200px'
1049
1096
  }) : content
1050
1097
  }));
1051
1098
  };
@@ -1100,13 +1147,13 @@
1100
1147
  icon = _a.icon,
1101
1148
  redirectionLink = _a.redirectionLink;
1102
1149
  return jsxRuntime.jsx(ctDesignContainer.Container, __assign({
1103
- className: 'hoverable-container',
1104
1150
  padding: '8px',
1105
1151
  borderRadius: '8px',
1106
1152
  cursor: 'pointer',
1107
1153
  onClick: function () {
1108
1154
  return handleAccountOptionsClick(text, redirectionLink);
1109
- }
1155
+ },
1156
+ css: __assign({}, getAccountOptionHoverStyles())
1110
1157
  }, {
1111
1158
  children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1112
1159
  display: 'flex',
@@ -1132,12 +1179,13 @@
1132
1179
  borderBottom: '1px dashed #E6E6E6'
1133
1180
  }
1134
1181
  }), jsxRuntime.jsxs(ctDesignContainer.Container, __assign({
1135
- className: 'logout-button',
1136
1182
  display: 'flex',
1137
1183
  padding: '8px',
1138
1184
  borderRadius: '8px',
1139
1185
  cursor: 'pointer',
1140
- onClick: handleLogoutClick
1186
+ columnGap: '8px',
1187
+ onClick: handleLogoutClick,
1188
+ css: __assign({}, getLogoutButtonHoverStyles())
1141
1189
  }, {
1142
1190
  children: [jsxRuntime.jsx(ctDesignIcons.Signout, {
1143
1191
  height: 24,
@@ -1157,6 +1205,22 @@
1157
1205
  }))]
1158
1206
  }));
1159
1207
  };
1208
+ var getAccountOptionHoverStyles = function () {
1209
+ return {
1210
+ transition: 'background-color 0.2s ease-in-out',
1211
+ '&:hover': {
1212
+ backgroundColor: '#ECF3FF'
1213
+ }
1214
+ };
1215
+ };
1216
+ var getLogoutButtonHoverStyles = function () {
1217
+ return {
1218
+ transition: 'background-color 0.2s ease-in-out',
1219
+ '&:hover': {
1220
+ backgroundColor: '#FBEFEF'
1221
+ }
1222
+ };
1223
+ };
1160
1224
 
1161
1225
  var UserAccount = function () {
1162
1226
  var _a = useHeaderContext(),
@@ -1181,7 +1245,7 @@
1181
1245
  setScrolled = _d[1];
1182
1246
  react.useEffect(function () {
1183
1247
  var handleScroll = function () {
1184
- setScrolled(window.scrollY >= 100);
1248
+ setScrolled(window.scrollY >= 50);
1185
1249
  };
1186
1250
  window.addEventListener('scroll', handleScroll);
1187
1251
  return function () {
@@ -1283,20 +1347,20 @@
1283
1347
  setScrolled = _f[1];
1284
1348
  react.useEffect(function () {
1285
1349
  var handleScroll = function () {
1286
- setScrolled(window.scrollY >= 100);
1350
+ setScrolled(window.scrollY >= 50);
1287
1351
  };
1288
1352
  window.addEventListener('scroll', handleScroll);
1289
1353
  return function () {
1290
1354
  return window.removeEventListener('scroll', handleScroll);
1291
1355
  };
1292
1356
  }, []);
1293
- var theme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1294
- var headerBackground = theme.headerBackground,
1295
- logoFill = theme.logoFill,
1296
- loginButtonColorVariant = theme.loginButtonColorVariant,
1297
- hoverColor = theme.hoverColor,
1298
- fkcompanyColor = theme.fkcompanyColor,
1299
- typographyColor = theme.typographyColor;
1357
+ var headerTheme = isNovacThemeEnabled && !scrolled ? THEME_CONFIG.NOVAC : THEME_CONFIG.DEFAULT;
1358
+ var headerBackground = headerTheme.headerBackground,
1359
+ logoFill = headerTheme.logoFill,
1360
+ loginButtonColorVariant = headerTheme.loginButtonColorVariant,
1361
+ hoverColor = headerTheme.hoverColor,
1362
+ fkcompanyColor = headerTheme.fkcompanyColor,
1363
+ typographyColor = headerTheme.typographyColor;
1300
1364
  var _g = useHoverDropdown({
1301
1365
  openDelay: 0
1302
1366
  }),
@@ -1471,23 +1535,16 @@
1471
1535
  }, {
1472
1536
  children: jsxRuntime.jsx(UserAccount, {})
1473
1537
  })) : jsxRuntime.jsx(ctDesignButton.Button, __assign({
1474
- variant: 'outline',
1475
- color: loginButtonColorVariant,
1476
- className: "".concat(headerBackground === 'transparent' ? 'novac-login-button' : 'login-button'),
1477
1538
  onClick: onLoginButtonClick,
1478
1539
  css: {
1479
1540
  width: 153,
1480
1541
  height: 40
1481
1542
  },
1482
- loading: false
1543
+ loading: false,
1544
+ color: loginButtonColorVariant,
1545
+ variant: ctDesignButton.ButtonVariant.OUTLINE
1483
1546
  }, {
1484
- children: jsxRuntime.jsx(ctDesignTypography.Typography, __assign({
1485
- componentNode: 'span',
1486
- variant: 'L2',
1487
- color: loginButtonColorVariant === ctDesignButton.ButtonColor.NEUTRAL ? 'neutral' : 'primary'
1488
- }, {
1489
- children: LOG_IN_TEXT
1490
- }))
1547
+ children: LOG_IN_TEXT
1491
1548
  }))
1492
1549
  })]
1493
1550
  }))]