@omniumretail/component-library 1.1.70 → 1.1.71

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.
@@ -14,7 +14,7 @@ pipelines:
14
14
  - step:
15
15
  name: Updating S3 Bucket (Dev)
16
16
  image:
17
- name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.0
17
+ name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.2
18
18
  aws:
19
19
  access-key: $AWS_ACCESS_KEY_ID_PROD
20
20
  secret-key: $AWS_SECRET_ACCESS_KEY_PROD
@@ -58,7 +58,7 @@ pipelines:
58
58
  name: Updating S3 Bucket (Platform)
59
59
  trigger: manual
60
60
  image:
61
- name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.0
61
+ name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.2
62
62
  aws:
63
63
  access-key: $AWS_ACCESS_KEY_ID_PROD
64
64
  secret-key: $AWS_SECRET_ACCESS_KEY_PROD
@@ -78,7 +78,7 @@ pipelines:
78
78
  - step:
79
79
  name: Updating S3 Bucket (Platform)
80
80
  image:
81
- name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.0
81
+ name: 170530511278.dkr.ecr.eu-west-1.amazonaws.com/nodejs-awscli:1.2
82
82
  aws:
83
83
  access-key: $AWS_ACCESS_KEY_ID_PROD
84
84
  secret-key: $AWS_SECRET_ACCESS_KEY_PROD
package/dist/main.css CHANGED
@@ -30,4 +30,4 @@
30
30
  .nkyL3EtE9Zsnc5VOW43L{display:flex;flex-wrap:wrap;flex-direction:column}.nkyL3EtE9Zsnc5VOW43L .ant-table-thead>tr>th{background-color:rgba(0,0,0,0);border:0px;color:var(--color-blue)}.nkyL3EtE9Zsnc5VOW43L .ant-table-thead>tr>th:before{display:none}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper{margin-bottom:12px}.nkyL3EtE9Zsnc5VOW43L .ant-table-cell{word-break:break-word}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr{cursor:pointer}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr:last-child>td{border-bottom:1px solid var(--color-grey-light) !important}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr:first-child>td{border-top:1px solid var(--color-blue) !important}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr:hover td{border-radius:0 !important;border-bottom-color:var(--color-grey-light) !important}.nkyL3EtE9Zsnc5VOW43L .ant-space{align-self:flex-end}.nkyL3EtE9Zsnc5VOW43L .ant-select-selection-placeholder{color:var(--color-black)}.nkyL3EtE9Zsnc5VOW43L .ant-select-selector,.nkyL3EtE9Zsnc5VOW43L .ant-select-focused .ant-select-selection-search{border:none !important;box-shadow:none !important}.nkyL3EtE9Zsnc5VOW43L .ant-select-selector:focus,.nkyL3EtE9Zsnc5VOW43L .ant-select-selector:hover,.nkyL3EtE9Zsnc5VOW43L .ant-select-focused .ant-select-selection-search:focus,.nkyL3EtE9Zsnc5VOW43L .ant-select-focused .ant-select-selection-search:hover{border:none !important;box-shadow:none !important}.nkyL3EtE9Zsnc5VOW43L .ant-pagination{max-width:calc(100% - 200px);margin-left:auto !important}.nkyL3EtE9Zsnc5VOW43L button[type=button].ant-pagination-item-link{margin-top:0 !important}.nkyL3EtE9Zsnc5VOW43L button[type=button]{margin-top:-50px}@media screen and (max-width: 1024px){.nkyL3EtE9Zsnc5VOW43L .ant-table-thead>tr>th{font-size:12px}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr>td{font-size:12px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-thead>tr>th{padding:8px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-tbody>tr>td{padding:8px}}@media screen and (max-width: 767px){.nkyL3EtE9Zsnc5VOW43L .ant-table-thead>tr>th{font-size:10px}.nkyL3EtE9Zsnc5VOW43L .ant-table-tbody>tr>td{font-size:10px}.nkyL3EtE9Zsnc5VOW43L .ant-table-content table{width:100%}.nkyL3EtE9Zsnc5VOW43L .ant-table-content{width:100%}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table .ant-table-title,.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table .ant-table-header{word-break:break-all}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-thead>tr>th{padding:4px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-tbody>tr>td{padding:4px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-column-sorter{margin-inline-start:0px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-column-sorter-up{font-size:8px}.nkyL3EtE9Zsnc5VOW43L .ant-table-wrapper .ant-table-column-sorter-down{font-size:8px}.nkyL3EtE9Zsnc5VOW43L .ant-pagination{max-width:unset}}
31
31
  .aZEBTQus3Y3MyodeDwkf{display:flex;flex-direction:column;align-items:center;justify-content:center}.cc1pbQlAgw2CmXVml3bs{height:300px;width:400px}.aTf_CXAsyp0tySsoZdD_{display:flex;justify-content:space-between;margin:10px 10px 0px 10px;font-size:20px}.kuu1hf_JTvYD55IW6Nxl{color:#ff4d4f}.N8ODEO3zDbY7gmecjTrp{color:#52c41a}.WIsL9Shu6c0mGJq9qSSz{margin-top:20px;border-radius:4px;overflow:hidden}.WIsL9Shu6c0mGJq9qSSz img{width:100%;height:auto}
32
32
  .OJKeuXyOSPIeCCssVum2{display:flex;gap:32px}.jzxszvL7wzCV5nztJL0S{padding:12px}.OGA8oJw8RDyohcRftjmo{width:100%}.y2_7QVPOhjRZlAHCRWKf{display:grid;grid-template-columns:minmax(200px, 1fr) auto auto auto auto;gap:46px}.Smkcs3LGp1uPuQge2GxE{margin-top:16px}Label{margin-bottom:8px}.djarlYFkE9Kb7wUjUnrY{height:36px}
33
- :root{--color-grey: #e4e4e4;--color-grey-100: #E5E5E5}.SF5f_Q_Ggz_4JHUHS2Xa{display:flex;align-items:center;padding:13px 20px;box-sizing:border-box;height:72px}.SF5f_Q_Ggz_4JHUHS2Xa *{box-sizing:border-box}.gSVYvBn1sLbcMsGI32b9{display:flex;flex-grow:1;align-items:flex-end;justify-content:center}.gSVYvBn1sLbcMsGI32b9 img{max-width:196px}.gSVYvBn1sLbcMsGI32b9 .fVSt3bSZBcJGsOdA5nIN{font-weight:var(--font-weight-semibold);text-transform:uppercase;color:var(--color-black)}.BIBQmS_NwoMw2Ncq5yuN{cursor:pointer;padding:4px 4px 4px 0;font-size:20px}.ZinSgUtysxITkbGRKdux{position:fixed;top:0;left:-100%;bottom:0;width:100%;max-width:430px;background-color:var(--color-white);padding-inline:15px;z-index:999;box-shadow:0 3px 12px rgba(0,0,0,.45);transition:.6s ease-out}.ZinSgUtysxITkbGRKdux.FW1pOdad0uN5LO9h5PgQ{left:0;transition:.3s ease-in}.ZfA8OEmbRzRsNqLAmdtn{background-color:rgba(0,0,0,.3);backdrop-filter:blur(1px);position:absolute;left:0;top:0;right:0;bottom:0;z-index:998;pointer-events:none;opacity:0;transition:.3s}.ZfA8OEmbRzRsNqLAmdtn.FW1pOdad0uN5LO9h5PgQ{opacity:1;pointer-events:all}.YKSQJmdRP_7tKwvQpeuV{width:calc(100% + 30px);margin-left:-15px;background-color:var(--color-orange);display:flex;align-items:center;justify-content:center}.ISssYC5Uz452JVWP0xDc img{max-width:160px}.E6YZPpa60LxA7qqIW7jQ{position:absolute;top:23px;right:15px;font-size:25px;cursor:pointer;color:var(--color-white)}.YYp3pzktjEDEyW8knAZQ{overflow-y:auto;height:calc(100% - 51px);margin:0;padding:0}.u7k2VQ30AQDk6mKA22GX{height:60px;padding:10px;display:flex;align-items:center;border-bottom:1px solid var(--color-black);cursor:pointer;transition:.3s;text-transform:uppercase;width:100%}.u7k2VQ30AQDk6mKA22GX:hover{background-color:var(--color-grey);color:var(--color-black)}.QQoDB9XPcAK18l2DIym4{list-style:none}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN{height:auto;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding-bottom:0}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX{position:relative}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .NytmT59TmaWHc4FLM2wa{position:absolute;width:60px;height:100%;background:var(--color-black);right:0;display:flex;align-items:center;justify-content:center}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .NytmT59TmaWHc4FLM2wa:hover{background-color:var(--color-orange)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .zo7CFksIKx7Fahu4e4S_{color:var(--color-white)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E{background:var(--color-grey)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E .NytmT59TmaWHc4FLM2wa{background-color:var(--color-orange)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E .uLgjMU9sbvfaa0qKEguP{height:auto;opacity:1}.uLgjMU9sbvfaa0qKEguP{padding:0;width:100%;margin:0;background-color:var(--color-orange);color:var(--color-white);height:0;opacity:0;overflow:hidden;transition:height .3s ease,opacity .3s ease}.uLgjMU9sbvfaa0qKEguP .u7k2VQ30AQDk6mKA22GX{min-height:60px;height:auto;padding-inline:40px}.efnjUnudkE0UTVQ6wrgH{cursor:pointer}.u7k2VQ30AQDk6mKA22GX .fjNRYZMP1O0pTvBDBB3L span{margin-left:8px;transform:translateY(-2px);display:inline-block;font-size:var(--font-size-body-3);text-transform:capitalize}
33
+ :root{--color-grey: #e4e4e4;--color-grey-100: #E5E5E5}.SF5f_Q_Ggz_4JHUHS2Xa{display:flex;align-items:center;padding:13px 20px;box-sizing:border-box;height:72px}.SF5f_Q_Ggz_4JHUHS2Xa *{box-sizing:border-box}.gSVYvBn1sLbcMsGI32b9{display:flex;flex-grow:1;align-items:flex-end;justify-content:center;max-width:calc(100% - 60px)}.gSVYvBn1sLbcMsGI32b9 img{max-width:196px}.gSVYvBn1sLbcMsGI32b9 .fVSt3bSZBcJGsOdA5nIN{font-weight:var(--font-weight-semibold);text-transform:uppercase;color:var(--color-black)}.BIBQmS_NwoMw2Ncq5yuN{cursor:pointer;padding:4px 4px 4px 0;font-size:20px;width:30px;display:flex;align-items:center;justify-content:center}.ZinSgUtysxITkbGRKdux{position:fixed;top:0;left:-100%;bottom:0;width:100%;max-width:430px;background-color:var(--color-white);padding-inline:15px;z-index:999;box-shadow:0 3px 12px rgba(0,0,0,.45);transition:.6s ease-out}.ZinSgUtysxITkbGRKdux.FW1pOdad0uN5LO9h5PgQ{left:0;transition:.3s ease-in}.ZfA8OEmbRzRsNqLAmdtn{background-color:rgba(0,0,0,.3);backdrop-filter:blur(1px);position:absolute;left:0;top:0;right:0;bottom:0;z-index:998;pointer-events:none;opacity:0;transition:.3s}.ZfA8OEmbRzRsNqLAmdtn.FW1pOdad0uN5LO9h5PgQ{opacity:1;pointer-events:all}.YKSQJmdRP_7tKwvQpeuV{width:calc(100% + 30px);margin-left:-15px;background-color:var(--color-orange);display:flex;align-items:center;justify-content:center}.ISssYC5Uz452JVWP0xDc img{max-width:160px}.E6YZPpa60LxA7qqIW7jQ{position:absolute;top:23px;right:15px;font-size:25px;cursor:pointer;color:var(--color-white)}.YYp3pzktjEDEyW8knAZQ{overflow-y:auto;height:calc(100% - 51px);margin:0;padding:0}.u7k2VQ30AQDk6mKA22GX{height:60px;padding:10px;display:flex;align-items:center;border-bottom:1px solid var(--color-black);cursor:pointer;transition:.3s;text-transform:uppercase;width:100%}.u7k2VQ30AQDk6mKA22GX:hover{background-color:var(--color-grey);color:var(--color-black)}.QQoDB9XPcAK18l2DIym4{list-style:none}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN{height:auto;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;padding-bottom:0}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX{position:relative}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .NytmT59TmaWHc4FLM2wa{position:absolute;width:60px;height:100%;background:var(--color-black);right:0;display:flex;align-items:center;justify-content:center}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .NytmT59TmaWHc4FLM2wa:hover{background-color:var(--color-orange)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN>.u7k2VQ30AQDk6mKA22GX .zo7CFksIKx7Fahu4e4S_{color:var(--color-white)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E{background:var(--color-grey)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E .NytmT59TmaWHc4FLM2wa{background-color:var(--color-orange)}.QQoDB9XPcAK18l2DIym4.wrXCksst57UpQuCNgGkN.yk4DnBgiUlzk23Yg_q6E .uLgjMU9sbvfaa0qKEguP{height:auto;opacity:1}.uLgjMU9sbvfaa0qKEguP{padding:0;width:100%;margin:0;background-color:var(--color-orange);color:var(--color-white);height:0;opacity:0;overflow:hidden;transition:height .3s ease,opacity .3s ease}.uLgjMU9sbvfaa0qKEguP .u7k2VQ30AQDk6mKA22GX{min-height:60px;height:auto;padding-inline:40px}.efnjUnudkE0UTVQ6wrgH{cursor:pointer}.u7k2VQ30AQDk6mKA22GX .fjNRYZMP1O0pTvBDBB3L span{margin-left:8px;transform:translateY(-2px);display:inline-block;font-size:var(--font-size-body-3);text-transform:capitalize}
@@ -1,3 +1,7 @@
1
1
  import { HeaderProps } from './Header.types';
2
+ /**
3
+ * Header component to display navigation bar with dropdown menus and action button.
4
+ * @param {HeaderProps} props - Properties passed to the component.
5
+ */
2
6
  export declare const Header: ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
3
7
  export default Header;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/component-library",
3
- "version": "1.1.70",
3
+ "version": "1.1.71",
4
4
  "private": false,
5
5
  "main": "dist/bundle.js",
6
6
  "typings": "./dist/types/index",
@@ -0,0 +1,38 @@
1
+ # Header Component
2
+
3
+ The `Header` component renders a navigation header with support for dropdown menus, dynamic routing, and an action button. It also supports conditional rendering based on user login and profile URL.
4
+
5
+ ## Props
6
+
7
+ ### `HeaderProps`
8
+
9
+ - `actionButton` (optional): An object with the following properties:
10
+ - `element`: A React component to be rendered as the action button (e.g., an icon).
11
+ - `action`: A function to be called when the action button is clicked.
12
+ - `visibility`: A boolean indicating whether the action button should be visible.
13
+ - `menuList` (optional): An array of menu items, where each item is an object with the following properties:
14
+ - `name`: The name of the menu item, which can include HTML content.
15
+ - `action`: A function to be called when the menu item is clicked.
16
+ - `targetRoute` (optional): The target route for the menu item.
17
+ - `dropdownMenu` (optional): An array of sub-menu items with the same structure.
18
+ - `logout` (optional): A function to be called when the user logs out.
19
+ - `homeUrl`: A string representing the URL for the home page.
20
+ - `profileUrl`: A string representing the URL for the profile page.
21
+ - `onLeavingPage` (optional): A function to be called before navigating away from the current page, with the target route as an argument. that is an example here: [APE Example](https://bitbucket.org/product_admin/staffperformanceevaluationcycle-restapi-omnium/src/master/frontend/src/Layout/index.tsx).
22
+ - `userName` (optional): A string representing the user's name, displayed next to the "Profile" menu item.
23
+ - `pageTitle` (optional): A string representing the page title, displayed in the header.
24
+
25
+ ### Explanation of Code
26
+
27
+ #### State and Refs:
28
+ - `isMenuOpen`: Manages the state of the menu (open/closed).
29
+ - `activeDropdown`: Manages the state of the active dropdown menu.
30
+ - `headerRef` and `overlayRef`: Used for referencing the header and overlay elements.
31
+
32
+ #### Helper Functions:
33
+ - `onLogout`: Handles the logout functionality. If a logout function is provided, it is called; otherwise, it navigates to the home page.
34
+ - `onProfile`: Navigates to the profile URL.
35
+ - `onHome`: Navigates to the home URL.
36
+ - `onToggleMenu`: Toggles the menu open and closed state.
37
+ - `handleDropdownClick`: Toggles the active state of the dropdown menus.
38
+ - `renderMenu`: Renders the menu items, including handling clicks for navigation and dropdown menus.
@@ -7,12 +7,19 @@ import classNames from 'classnames';
7
7
  import { HeaderProps, MenuItem } from './Header.types';
8
8
  import { getMenuTopList, getMenuBottomList } from './Header.data';
9
9
 
10
+ /**
11
+ * Header component to display navigation bar with dropdown menus and action button.
12
+ * @param {HeaderProps} props - Properties passed to the component.
13
+ */
10
14
  export const Header = ({ menuList, actionButton, logout, homeUrl, profileUrl, onLeavingPage, userName, pageTitle }: HeaderProps) => {
11
15
  const [isMenuOpen, setIsMenuOpen] = useState(false);
12
16
  const [activeDropdown, setActiveDropdown] = useState<number | null>(null);
13
17
  const headerRef = useRef<HTMLDivElement>(null);
14
18
  const overlayRef = useRef<HTMLDivElement>(null);
15
19
 
20
+ /**
21
+ * Handle the logout action. If no logout function is provided, redirect to home as discussed in a meet
22
+ */
16
23
  const onLogout = () => {
17
24
  if( logout ) {
18
25
  logout();
@@ -21,10 +28,16 @@ export const Header = ({ menuList, actionButton, logout, homeUrl, profileUrl, on
21
28
  }
22
29
  };
23
30
 
31
+ /**
32
+ * Navigate to the profile URL.
33
+ */
24
34
  const onProfile = () => {
25
35
  window.location.href = profileUrl;
26
36
  };
27
37
 
38
+ /**
39
+ * Navigate to the home URL.
40
+ */
28
41
  const onHome = () => {
29
42
  window.location.href = homeUrl;
30
43
  };
@@ -41,15 +54,28 @@ export const Header = ({ menuList, actionButton, logout, homeUrl, profileUrl, on
41
54
 
42
55
  const combinedMenuList = [...menuTopList, ...(menuList || []), ...menuBottomList];
43
56
 
57
+ /**
58
+ * Toggle the menu open and closed state.
59
+ */
44
60
  const onToggleMenu = () => {
45
61
  setIsMenuOpen(!isMenuOpen);
46
62
  };
47
63
 
64
+ /**
65
+ * Handle dropdown click to toggle the active dropdown menu.
66
+ * @param {any} e - The event object.
67
+ * @param {number} index - The index of the dropdown menu.
68
+ */
48
69
  const handleDropdownClick = (e: any, index: number) => {
49
70
  e.stopPropagation();
50
71
  setActiveDropdown(activeDropdown === index ? null : index);
51
72
  };
52
73
 
74
+ /**
75
+ * Render the menu items, including dropdown menus.
76
+ * @param {MenuItem[]} menuList - The list of menu items to render.
77
+ * @returns {JSX.Element[]} The rendered menu items.
78
+ */
53
79
  const renderMenu = (menuList: MenuItem[]) => {
54
80
  return menuList.map((link, index) => (
55
81
  <li
@@ -21,6 +21,7 @@
21
21
  flex-grow: 1;
22
22
  align-items: flex-end;
23
23
  justify-content: center;
24
+ max-width: calc(100% - 60px);
24
25
 
25
26
  img {
26
27
  max-width: 196px;
@@ -37,6 +38,10 @@
37
38
  cursor: pointer;
38
39
  padding: 4px 4px 4px 0;
39
40
  font-size: 20px;
41
+ width: 30px;
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
40
45
  }
41
46
 
42
47
  .menu {