rez-table-listing-mui 1.2.9 → 1.2.11

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez-table-listing-mui",
3
- "version": "1.2.9",
3
+ "version": "1.2.11",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
package/src/App.tsx CHANGED
@@ -34,7 +34,7 @@ function App() {
34
34
  const [searchTerm, setSearchTerm] = useState("");
35
35
  // const [data, setData] = useState<Person[]>(() => makeData(50, 3, 2));
36
36
 
37
- const [selectedTab, setSelectedTab] = useState("ALL");
37
+ const [selectedTab, setSelectedTab] = useState("All");
38
38
 
39
39
  const tableStates = useCraftTable();
40
40
  const filterSettingStates = useCraftTableFilterSettings();
@@ -195,9 +195,9 @@ function App() {
195
195
  (tab) => tab.tab_value?.toLowerCase() === "all"
196
196
  );
197
197
  if (allTab) {
198
- setSelectedTab(allTab.tab_value || "ALL");
198
+ setSelectedTab(allTab.tab_value || "All");
199
199
  } else {
200
- setSelectedTab(tabsData[0].tab_value || "ALL");
200
+ setSelectedTab(tabsData[0].tab_value || "All");
201
201
  }
202
202
  }
203
203
  }, [tabsData, selectedTab]);
@@ -205,7 +205,7 @@ function App() {
205
205
  const totalCount = useMemo(() => {
206
206
  return Number(
207
207
  tableData?.entity_tabs?.find((tab) => {
208
- const activeTab = selectedTab || "ALL";
208
+ const activeTab = selectedTab || "All";
209
209
  return (
210
210
  tab.tab_value?.toLocaleLowerCase() === activeTab.toLocaleLowerCase()
211
211
  );
@@ -389,7 +389,7 @@ function App() {
389
389
  showIcon: true,
390
390
  onClick: () => setShowListViewSettings(!showListViewSettings),
391
391
  }}
392
- activeTab={selectedTab?.toUpperCase()}
392
+ activeTab={selectedTab}
393
393
  tableStates={tableStates}
394
394
  tabsData={tabsData}
395
395
  onClick={(state) => {
@@ -792,22 +792,22 @@ export const DragandDrogIcon = () => {
792
792
  );
793
793
  };
794
794
 
795
- export const SettingIcon = () => {
796
- return (
797
- <svg
798
- width="18"
799
- height="17"
800
- viewBox="0 0 18 17"
801
- fill="none"
802
- xmlns="http://www.w3.org/2000/svg"
803
- >
804
- <path
805
- d="M15.1935 9.31669C15.2269 9.05002 15.2519 8.78335 15.2519 8.50002C15.2519 8.21669 15.2269 7.95002 15.1935 7.68335L16.9519 6.30835C17.1102 6.18335 17.1518 5.95835 17.0518 5.77502L15.3852 2.89169C15.3102 2.75835 15.1685 2.68335 15.0185 2.68335C14.9685 2.68335 14.9185 2.69169 14.8768 2.70835L12.8018 3.54169C12.3685 3.20835 11.9018 2.93335 11.3935 2.72502L11.0768 0.516687C11.0518 0.316687 10.8769 0.166687 10.6685 0.166687H7.33518C7.12685 0.166687 6.95185 0.316687 6.92685 0.516687L6.61018 2.72502C6.10185 2.93335 5.63518 3.21669 5.20185 3.54169L3.12685 2.70835C3.07685 2.69169 3.02685 2.68335 2.97685 2.68335C2.83518 2.68335 2.69352 2.75835 2.61852 2.89169L0.95185 5.77502C0.843516 5.95835 0.893517 6.18335 1.05185 6.30835L2.81018 7.68335C2.77685 7.95002 2.75185 8.22502 2.75185 8.50002C2.75185 8.77502 2.77685 9.05002 2.81018 9.31669L1.05185 10.6917C0.893517 10.8167 0.85185 11.0417 0.95185 11.225L2.61852 14.1084C2.69352 14.2417 2.83518 14.3167 2.98518 14.3167C3.03518 14.3167 3.08518 14.3084 3.12685 14.2917L5.20185 13.4584C5.63518 13.7917 6.10185 14.0667 6.61018 14.275L6.92685 16.4834C6.95185 16.6834 7.12685 16.8334 7.33518 16.8334H10.6685C10.8769 16.8334 11.0518 16.6834 11.0768 16.4834L11.3935 14.275C11.9018 14.0667 12.3685 13.7834 12.8018 13.4584L14.8768 14.2917C14.9268 14.3084 14.9768 14.3167 15.0268 14.3167C15.1685 14.3167 15.3102 14.2417 15.3852 14.1084L17.0518 11.225C17.1518 11.0417 17.1102 10.8167 16.9519 10.6917L15.1935 9.31669ZM13.5435 7.89169C13.5769 8.15002 13.5852 8.32502 13.5852 8.50002C13.5852 8.67502 13.5685 8.85835 13.5435 9.10835L13.4268 10.05L14.1685 10.6334L15.0685 11.3334L14.4852 12.3417L13.4268 11.9167L12.5602 11.5667L11.8102 12.1334C11.4518 12.4 11.1102 12.6 10.7685 12.7417L9.88518 13.1L9.75185 14.0417L9.58518 15.1667H8.41852L8.12685 13.1L7.24352 12.7417C6.88518 12.5917 6.55185 12.4 6.21852 12.15L5.46018 11.5667L4.57685 11.925L3.51852 12.35L2.93518 11.3417L3.83518 10.6417L4.57685 10.0584L4.46018 9.11669C4.43518 8.85835 4.41852 8.66669 4.41852 8.50002C4.41852 8.33335 4.43518 8.14169 4.46018 7.89169L4.57685 6.95002L3.83518 6.36669L2.93518 5.66669L3.51852 4.65835L4.57685 5.08335L5.44352 5.43335L6.19352 4.86669C6.55185 4.60002 6.89352 4.40002 7.23518 4.25835L8.11852 3.90002L8.25185 2.95835L8.41852 1.83335H9.57685L9.86852 3.90002L10.7519 4.25835C11.1102 4.40835 11.4435 4.60002 11.7768 4.85002L12.5352 5.43335L13.4185 5.07502L14.4768 4.65002L15.0602 5.65835L14.1685 6.36669L13.4268 6.95002L13.5435 7.89169ZM9.00185 5.16669C7.16018 5.16669 5.66852 6.65835 5.66852 8.50002C5.66852 10.3417 7.16018 11.8334 9.00185 11.8334C10.8435 11.8334 12.3352 10.3417 12.3352 8.50002C12.3352 6.65835 10.8435 5.16669 9.00185 5.16669ZM9.00185 10.1667C8.08518 10.1667 7.33518 9.41669 7.33518 8.50002C7.33518 7.58335 8.08518 6.83335 9.00185 6.83335C9.91852 6.83335 10.6685 7.58335 10.6685 8.50002C10.6685 9.41669 9.91852 10.1667 9.00185 10.1667Z"
806
- fill="#1E1E1E"
807
- />
808
- </svg>
809
- );
810
- };
795
+ // export const SettingIcon = () => {
796
+ // return (
797
+ // <svg
798
+ // width="18"
799
+ // height="17"
800
+ // viewBox="0 0 18 17"
801
+ // fill="none"
802
+ // xmlns="http://www.w3.org/2000/svg"
803
+ // >
804
+ // <path
805
+ // d="M15.1935 9.31669C15.2269 9.05002 15.2519 8.78335 15.2519 8.50002C15.2519 8.21669 15.2269 7.95002 15.1935 7.68335L16.9519 6.30835C17.1102 6.18335 17.1518 5.95835 17.0518 5.77502L15.3852 2.89169C15.3102 2.75835 15.1685 2.68335 15.0185 2.68335C14.9685 2.68335 14.9185 2.69169 14.8768 2.70835L12.8018 3.54169C12.3685 3.20835 11.9018 2.93335 11.3935 2.72502L11.0768 0.516687C11.0518 0.316687 10.8769 0.166687 10.6685 0.166687H7.33518C7.12685 0.166687 6.95185 0.316687 6.92685 0.516687L6.61018 2.72502C6.10185 2.93335 5.63518 3.21669 5.20185 3.54169L3.12685 2.70835C3.07685 2.69169 3.02685 2.68335 2.97685 2.68335C2.83518 2.68335 2.69352 2.75835 2.61852 2.89169L0.95185 5.77502C0.843516 5.95835 0.893517 6.18335 1.05185 6.30835L2.81018 7.68335C2.77685 7.95002 2.75185 8.22502 2.75185 8.50002C2.75185 8.77502 2.77685 9.05002 2.81018 9.31669L1.05185 10.6917C0.893517 10.8167 0.85185 11.0417 0.95185 11.225L2.61852 14.1084C2.69352 14.2417 2.83518 14.3167 2.98518 14.3167C3.03518 14.3167 3.08518 14.3084 3.12685 14.2917L5.20185 13.4584C5.63518 13.7917 6.10185 14.0667 6.61018 14.275L6.92685 16.4834C6.95185 16.6834 7.12685 16.8334 7.33518 16.8334H10.6685C10.8769 16.8334 11.0518 16.6834 11.0768 16.4834L11.3935 14.275C11.9018 14.0667 12.3685 13.7834 12.8018 13.4584L14.8768 14.2917C14.9268 14.3084 14.9768 14.3167 15.0268 14.3167C15.1685 14.3167 15.3102 14.2417 15.3852 14.1084L17.0518 11.225C17.1518 11.0417 17.1102 10.8167 16.9519 10.6917L15.1935 9.31669ZM13.5435 7.89169C13.5769 8.15002 13.5852 8.32502 13.5852 8.50002C13.5852 8.67502 13.5685 8.85835 13.5435 9.10835L13.4268 10.05L14.1685 10.6334L15.0685 11.3334L14.4852 12.3417L13.4268 11.9167L12.5602 11.5667L11.8102 12.1334C11.4518 12.4 11.1102 12.6 10.7685 12.7417L9.88518 13.1L9.75185 14.0417L9.58518 15.1667H8.41852L8.12685 13.1L7.24352 12.7417C6.88518 12.5917 6.55185 12.4 6.21852 12.15L5.46018 11.5667L4.57685 11.925L3.51852 12.35L2.93518 11.3417L3.83518 10.6417L4.57685 10.0584L4.46018 9.11669C4.43518 8.85835 4.41852 8.66669 4.41852 8.50002C4.41852 8.33335 4.43518 8.14169 4.46018 7.89169L4.57685 6.95002L3.83518 6.36669L2.93518 5.66669L3.51852 4.65835L4.57685 5.08335L5.44352 5.43335L6.19352 4.86669C6.55185 4.60002 6.89352 4.40002 7.23518 4.25835L8.11852 3.90002L8.25185 2.95835L8.41852 1.83335H9.57685L9.86852 3.90002L10.7519 4.25835C11.1102 4.40835 11.4435 4.60002 11.7768 4.85002L12.5352 5.43335L13.4185 5.07502L14.4768 4.65002L15.0602 5.65835L14.1685 6.36669L13.4268 6.95002L13.5435 7.89169ZM9.00185 5.16669C7.16018 5.16669 5.66852 6.65835 5.66852 8.50002C5.66852 10.3417 7.16018 11.8334 9.00185 11.8334C10.8435 11.8334 12.3352 10.3417 12.3352 8.50002C12.3352 6.65835 10.8435 5.16669 9.00185 5.16669ZM9.00185 10.1667C8.08518 10.1667 7.33518 9.41669 7.33518 8.50002C7.33518 7.58335 8.08518 6.83335 9.00185 6.83335C9.91852 6.83335 10.6685 7.58335 10.6685 8.50002C10.6685 9.41669 9.91852 10.1667 9.00185 10.1667Z"
806
+ // fill="#1E1E1E"
807
+ // />
808
+ // </svg>
809
+ // );
810
+ // };
811
811
 
812
812
  export const DropDownIcon = () => {
813
813
  return (
@@ -954,3 +954,19 @@ export const ClosedEyeIcon = () => {
954
954
  </svg>
955
955
  );
956
956
  };
957
+
958
+ export const SettingIcon: React.FC = () => (
959
+ <svg
960
+ xmlns="http://www.w3.org/2000/svg"
961
+ width="20"
962
+ height="21"
963
+ viewBox="0 0 20 21"
964
+ fill="none"
965
+ >
966
+ <path
967
+ d="M11.3748 18.8346H8.62484C8.47206 18.8346 8.33664 18.786 8.21859 18.6888C8.10053 18.5916 8.02762 18.4666 7.99984 18.3138L7.6665 16.2096C7.40262 16.1124 7.12484 15.9805 6.83317 15.8138C6.5415 15.6471 6.28456 15.4735 6.06234 15.293L4.12484 16.1888C3.97206 16.2582 3.81928 16.2687 3.6665 16.2201C3.51373 16.1714 3.39567 16.0707 3.31234 15.918L1.93734 13.4805C1.854 13.3416 1.83317 13.1957 1.87484 13.043C1.9165 12.8902 1.99984 12.7652 2.12484 12.668L3.9165 11.3555C3.88873 11.2305 3.87137 11.0881 3.86442 10.9284C3.85748 10.7687 3.854 10.6263 3.854 10.5013C3.854 10.3763 3.85748 10.2339 3.86442 10.0742C3.87137 9.9145 3.88873 9.77214 3.9165 9.64714L2.12484 8.33464C1.99984 8.23741 1.9165 8.11241 1.87484 7.95964C1.83317 7.80686 1.854 7.66102 1.93734 7.52214L3.31234 5.08464C3.39567 4.93186 3.51373 4.83116 3.6665 4.78255C3.81928 4.73394 3.97206 4.74436 4.12484 4.8138L6.06234 5.70964C6.28456 5.52908 6.5415 5.35547 6.83317 5.1888C7.12484 5.02214 7.40262 4.89714 7.6665 4.8138L7.99984 2.6888C8.02762 2.53602 8.10053 2.41102 8.21859 2.3138C8.33664 2.21658 8.47206 2.16797 8.62484 2.16797H11.3748C11.5276 2.16797 11.663 2.21658 11.7811 2.3138C11.8991 2.41102 11.9721 2.53602 11.9998 2.6888L12.3332 4.79297C12.5971 4.89019 12.8783 5.01866 13.1769 5.17839C13.4755 5.33811 13.729 5.51519 13.9373 5.70964L15.8748 4.8138C16.0276 4.74436 16.1804 4.73394 16.3332 4.78255C16.4859 4.83116 16.604 4.93186 16.6873 5.08464L18.0623 7.5013C18.1457 7.64019 18.17 7.7895 18.1353 7.94922C18.1005 8.10894 18.0137 8.23741 17.8748 8.33464L16.0832 9.60547C16.1109 9.74436 16.1283 9.89366 16.1353 10.0534C16.1422 10.2131 16.1457 10.3624 16.1457 10.5013C16.1457 10.6402 16.1422 10.786 16.1353 10.9388C16.1283 11.0916 16.1109 11.2374 16.0832 11.3763L17.8748 12.668C17.9998 12.7652 18.0832 12.8902 18.1248 13.043C18.1665 13.1957 18.1457 13.3416 18.0623 13.4805L16.6873 15.918C16.604 16.0707 16.4859 16.1714 16.3332 16.2201C16.1804 16.2687 16.0276 16.2582 15.8748 16.1888L13.9373 15.293C13.7151 15.4735 13.4616 15.6506 13.1769 15.8242C12.8922 15.9978 12.6109 16.1263 12.3332 16.2096L11.9998 18.3138C11.9721 18.4666 11.8991 18.5916 11.7811 18.6888C11.663 18.786 11.5276 18.8346 11.3748 18.8346ZM9.99984 13.2096C10.7498 13.2096 11.3887 12.9457 11.9165 12.418C12.4443 11.8902 12.7082 11.2513 12.7082 10.5013C12.7082 9.7513 12.4443 9.11241 11.9165 8.58464C11.3887 8.05686 10.7498 7.79297 9.99984 7.79297C9.24984 7.79297 8.61095 8.05686 8.08317 8.58464C7.55539 9.11241 7.2915 9.7513 7.2915 10.5013C7.2915 11.2513 7.55539 11.8902 8.08317 12.418C8.61095 12.9457 9.24984 13.2096 9.99984 13.2096ZM9.99984 11.9596C9.59706 11.9596 9.25331 11.8173 8.96859 11.5326C8.68387 11.2478 8.5415 10.9041 8.5415 10.5013C8.5415 10.0985 8.68387 9.75477 8.96859 9.47005C9.25331 9.18533 9.59706 9.04297 9.99984 9.04297C10.4026 9.04297 10.7464 9.18533 11.0311 9.47005C11.3158 9.75477 11.4582 10.0985 11.4582 10.5013C11.4582 10.9041 11.3158 11.2478 11.0311 11.5326C10.7464 11.8173 10.4026 11.9596 9.99984 11.9596ZM9.08317 17.5846H10.9165L11.2082 15.2513C11.6665 15.1402 12.1005 14.9666 12.5103 14.7305C12.92 14.4944 13.2915 14.2096 13.6248 13.8763L15.8332 14.8346L16.6665 13.3346L14.7082 11.8971C14.7637 11.661 14.8089 11.4284 14.8436 11.1992C14.8783 10.9701 14.8957 10.7374 14.8957 10.5013C14.8957 10.2652 14.8818 10.0326 14.854 9.80339C14.8262 9.57422 14.7776 9.34158 14.7082 9.10547L16.6665 7.66797L15.8332 6.16797L13.6248 7.1263C13.3054 6.76519 12.9443 6.46311 12.5415 6.22005C12.1387 5.977 11.6943 5.82075 11.2082 5.7513L10.9165 3.41797H9.08317L8.7915 5.7513C8.31928 5.84852 7.87831 6.01519 7.46859 6.2513C7.05887 6.48741 6.69428 6.77908 6.37484 7.1263L4.1665 6.16797L3.33317 7.66797L5.2915 9.10547C5.23595 9.34158 5.19081 9.57422 5.15609 9.80339C5.12137 10.0326 5.104 10.2652 5.104 10.5013C5.104 10.7374 5.12137 10.9701 5.15609 11.1992C5.19081 11.4284 5.23595 11.661 5.2915 11.8971L3.33317 13.3346L4.1665 14.8346L6.37484 13.8763C6.70817 14.2096 7.0797 14.4944 7.48942 14.7305C7.89914 14.9666 8.33317 15.1402 8.7915 15.2513L9.08317 17.5846Z"
968
+ fill="#0E0C0B"
969
+ fill-opacity="0.7"
970
+ />
971
+ </svg>
972
+ );
@@ -116,7 +116,7 @@
116
116
 
117
117
  .ts__head {
118
118
  position: relative;
119
- box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05);
119
+ // box-shadow: 0 2px 2px rgba(0, 0, 0, 0.05); //removing shadow below table header
120
120
 
121
121
  .ts__head__tr {
122
122
  background-color: var(--white);
@@ -124,10 +124,11 @@
124
124
  .ts__head__th {
125
125
  position: relative;
126
126
  padding: 0.5rem 1rem;
127
- border: 1px solid var(--grey-300);
127
+ border: 1px solid var(--grey-500);
128
+ cursor: pointer;
128
129
 
129
130
  .ts__dnd__button {
130
- color: var(--grey-100);
131
+ color: var(--grey-300);
131
132
  // width: max-content;
132
133
  // height: max-content;
133
134
  // cursor: grabbing;
@@ -145,6 +146,7 @@
145
146
  display: flex;
146
147
  align-items: center;
147
148
  gap: 0.25rem;
149
+ min-height: 44px; // to give min height of 60 px
148
150
 
149
151
  .ts__content__sort {
150
152
  cursor: pointer;
@@ -28,7 +28,7 @@
28
28
 
29
29
  .pagination_btn_container {
30
30
  display: flex;
31
- gap: 0.5rem;
31
+ // gap: 0.3rem;
32
32
 
33
33
  .pagination_btn {
34
34
  position: relative;
@@ -71,3 +71,8 @@
71
71
  }
72
72
  }
73
73
  }
74
+
75
+ .rows_per_page_container select {
76
+ border-radius: 4px;
77
+ padding: 6px;
78
+ }
@@ -2,9 +2,11 @@ import { Table } from "@tanstack/react-table";
2
2
  import {
3
3
  TableFirstPageIcon,
4
4
  TableLastPageIcon,
5
- TableNextPageIcon,
6
- TablePreviousPageIcon,
5
+ // TableNextPageIcon,
6
+ // TablePreviousPageIcon,
7
7
  } from "../../../assets/svg";
8
+ import TablePreviousPageIcon from "@mui/icons-material/NavigateBeforeRounded";
9
+ import TableNextPageIcon from "@mui/icons-material/NavigateNextRounded";
8
10
  import "./index.scss";
9
11
  import { CraftTablePaginationProps } from "../../../types/table";
10
12
 
@@ -96,7 +98,7 @@ function DefaultPagination<T>({
96
98
  disabled={!table.getCanPreviousPage()}
97
99
  onClick={() => table.previousPage()}
98
100
  >
99
- <TablePreviousPageIcon />
101
+ <TablePreviousPageIcon fontSize="small" />
100
102
  </button>
101
103
  <button
102
104
  title="Next Page"
@@ -5,6 +5,7 @@ import SettingsOutlinedIcon from "@mui/icons-material/SettingsOutlined";
5
5
  import { settingsOptionsProps } from "../../types/table";
6
6
  import { tableTabsStyles } from "./styles";
7
7
  import { useMemo } from "react";
8
+ import { SettingIcon } from "../../assets/svg";
8
9
 
9
10
  interface TabDataProps {
10
11
  tab_value: string | null;
@@ -24,7 +25,7 @@ interface TableTabsProps {
24
25
  export function TableTabs({
25
26
  loading = false,
26
27
  tabsData = [],
27
- activeTab = "ALL",
28
+ activeTab = "All",
28
29
  onClick,
29
30
  tableStates,
30
31
  settingsOptions,
@@ -42,13 +43,13 @@ export function TableTabs({
42
43
  ?.filter((tab) => tab.tab_value !== null)
43
44
  ?.map((tab) => ({
44
45
  ...tab,
45
- tab_value: tab.tab_value?.toUpperCase(),
46
+ tab_value: tab.tab_value,
46
47
  }));
47
48
  }, [tabsData]);
48
49
 
49
50
  const defaultTab = useMemo(() => {
50
51
  return (
51
- normalizedTabs.find((t) => t.tab_value === "ALL")?.tab_value ||
52
+ normalizedTabs.find((t) => t.tab_value === "All")?.tab_value ||
52
53
  normalizedTabs[0]?.tab_value ||
53
54
  ""
54
55
  );
@@ -62,9 +63,9 @@ export function TableTabs({
62
63
  {settingsOptions?.showIcon && (
63
64
  <IconButton
64
65
  onClick={settingsOptions?.onClick}
65
- sx={{ zIndex: 1000, mx: 1 }}
66
+ sx={{ zIndex: 1000, mx: 0 }}
66
67
  >
67
- <SettingsOutlinedIcon />
68
+ <SettingIcon />
68
69
  </IconButton>
69
70
  )}
70
71
 
@@ -91,12 +92,17 @@ export function TableTabs({
91
92
  sx={{
92
93
  ...tableTabsStyles.tabCount,
93
94
  ...(isSelected && {
94
- backgroundColor: "#ced3da",
95
- borderColor: "#ced3da",
95
+ // backgroundColor: "#ced3da",
96
+ // borderColor: "#ced3da",
97
+ backgroundColor: "#000",
98
+ color: "#fff",
99
+ fontWeight: "500",
96
100
  }),
97
101
  }}
98
102
  >
99
- {tab_value_count}
103
+ {tab_value_count == 0
104
+ ? "0"
105
+ : String(tab_value_count).padStart(2, "0")}
100
106
  </Box>
101
107
  </Box>
102
108
  }
@@ -26,8 +26,9 @@ export const tableTabsStyles: TabStylesProps = {
26
26
  },
27
27
 
28
28
  tabCount: {
29
- padding: "2px 6px",
30
- borderRadius: "4px",
31
- border: "1px solid #888",
29
+ padding: "2px 3px",
30
+ borderRadius: "6px",
31
+ border: "1px solid #0E0C0BE6",
32
+ color: "#0E0C0B",
32
33
  },
33
34
  };
@@ -107,6 +107,62 @@ function Topbar<T>({
107
107
  handler: () => setShowSearchInput(false),
108
108
  });
109
109
 
110
+ useEffect(() => {
111
+ const handleExternalLayoutTrigger = (e: Event) => {
112
+ const target = (e as CustomEvent).detail?.target as HTMLElement;
113
+ setLayoutAnchorEl(target);
114
+ };
115
+
116
+ const handleExternalFilterTrigger = () => {
117
+ onFilterButtonClick?.();
118
+ };
119
+
120
+ const handleExternalViewMoreTrigger = (e: Event) => {
121
+ const target = (e as CustomEvent).detail?.target as HTMLElement;
122
+ if (target) setViewMoreAnchorEl(target);
123
+ };
124
+
125
+ const handleExternalSearchTrigger = () => {
126
+ setShowSearchInput(true);
127
+ setTimeout(() => {
128
+ searchContainerRef.current?.querySelector("input")?.focus();
129
+ }, 100);
130
+ };
131
+
132
+ window.addEventListener(
133
+ "triggerLayoutPopover",
134
+ handleExternalLayoutTrigger
135
+ );
136
+ window.addEventListener("triggerFilterButton", handleExternalFilterTrigger);
137
+ window.addEventListener("triggerViewMore", handleExternalViewMoreTrigger);
138
+ window.addEventListener("triggerSearchInput", handleExternalSearchTrigger); // ✅
139
+
140
+ return () => {
141
+ window.removeEventListener(
142
+ "triggerLayoutPopover",
143
+ handleExternalLayoutTrigger
144
+ );
145
+ window.removeEventListener(
146
+ "triggerFilterButton",
147
+ handleExternalFilterTrigger
148
+ );
149
+ window.removeEventListener(
150
+ "triggerViewMore",
151
+ handleExternalViewMoreTrigger
152
+ );
153
+ window.removeEventListener(
154
+ "triggerSearchInput",
155
+ handleExternalSearchTrigger
156
+ ); // ✅
157
+ };
158
+ }, [onFilterButtonClick]);
159
+
160
+ const [viewMoreAnchorEl, setViewMoreAnchorEl] = useState<HTMLElement | null>(
161
+ null
162
+ );
163
+
164
+ const isViewMoreOpen = Boolean(viewMoreAnchorEl);
165
+
110
166
  return (
111
167
  <div className="ts-topbar">
112
168
  <div className="tabs-section">
@@ -119,40 +175,66 @@ function Topbar<T>({
119
175
  {rightSideComponent}
120
176
  {paginationComponent}
121
177
 
122
- {showSearch && (
178
+ {/* {showSearch && (
123
179
  <div title="Search">
124
180
  <TableSearch
125
181
  value={searchValue ?? ""}
126
182
  onChange={onSearchChange ?? (() => {})}
127
183
  />
128
184
  </div>
185
+ )} */}
186
+ {showSearch && (
187
+ <div
188
+ title="Search"
189
+ className="external-search-trigger"
190
+ onClick={() => {
191
+ const customEvent = new CustomEvent("triggerSearchInput");
192
+ window.dispatchEvent(customEvent);
193
+ }}
194
+ ref={searchContainerRef}
195
+ >
196
+ <TableSearch
197
+ value={searchValue ?? ""}
198
+ onChange={onSearchChange ?? (() => {})}
199
+ />
200
+ </div>
129
201
  )}
130
202
 
131
203
  {showChangeLayoutToggle && (
132
204
  <>
133
205
  <div className="change-layout ts--button" title="Layout">
134
- <div onClick={handleLayoutIconClick}>
206
+ {/* <div onClick={handleLayoutIconClick}>
207
+ <ChangeLayoutIcon />
208
+ </div> */}
209
+ <div
210
+ onClick={(e) => {
211
+ const customEvent = new CustomEvent("triggerLayoutPopover", {
212
+ detail: { target: e.currentTarget },
213
+ });
214
+ window.dispatchEvent(customEvent);
215
+ }}
216
+ className="external-layout-trigger"
217
+ >
135
218
  <ChangeLayoutIcon />
136
219
  </div>
137
220
  </div>
138
- <Popover
139
- open={Boolean(layoutAnchorEl)}
140
- anchorEl={layoutAnchorEl}
141
- onClose={() => setLayoutAnchorEl(null)}
142
- anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
143
- container={fullscreenContainer}
144
- sx={{
145
- mt: 2.2,
146
- }}
147
- >
148
- <LayoutSelector
149
- onSelect={handleLayoutSelect}
150
- selectedLayout={selectedLayout}
151
- />
152
- </Popover>
153
221
  </>
154
222
  )}
155
-
223
+ <Popover
224
+ open={Boolean(layoutAnchorEl)}
225
+ anchorEl={layoutAnchorEl}
226
+ onClose={() => setLayoutAnchorEl(null)}
227
+ anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
228
+ container={fullscreenContainer}
229
+ sx={{
230
+ mt: 2.2,
231
+ }}
232
+ >
233
+ <LayoutSelector
234
+ onSelect={handleLayoutSelect}
235
+ selectedLayout={selectedLayout}
236
+ />
237
+ </Popover>
156
238
  {showColumnToggle && (
157
239
  <>
158
240
  <div
@@ -203,7 +285,7 @@ function Topbar<T>({
203
285
  </div>
204
286
  )}
205
287
 
206
- {viewMoreToggle && (
288
+ {/* {viewMoreToggle && (
207
289
  <div className="view-more ts--button" title="View More">
208
290
  <ViewMore
209
291
  compactMode={isCompactTable}
@@ -217,7 +299,54 @@ function Topbar<T>({
217
299
  tableStates={tableStates}
218
300
  />
219
301
  </div>
220
- )}
302
+ )} */}
303
+ {/* {viewMoreToggle && (
304
+ <div
305
+ className="view-more ts--button view-more-trigger"
306
+ title="View More"
307
+ >
308
+ <ViewMore
309
+ compactMode={isCompactTable}
310
+ onCompactToggle={(value: string) =>
311
+ setIsCompactTable(value === "Compact")
312
+ }
313
+ isFullscreen={isFullscreen}
314
+ onFullscreenToggle={fullscreenToggle}
315
+ groupBy={groupBy}
316
+ onGroupByChange={(value: string) => setGroupBy(value)}
317
+ tableStates={tableStates}
318
+ />
319
+ </div>
320
+ )} */}
321
+ <Popover
322
+ open={isViewMoreOpen}
323
+ anchorEl={viewMoreAnchorEl}
324
+ onClose={() => setViewMoreAnchorEl(null)}
325
+ anchorOrigin={{ vertical: "bottom", horizontal: "left" }}
326
+ transformOrigin={{ vertical: "top", horizontal: "left" }}
327
+ // PaperProps={{
328
+ // sx: {
329
+ // mt: 2,
330
+ // padding: 0,
331
+ // width: 380,
332
+ // borderRadius: 1,
333
+ // boxShadow: 4,
334
+ // },
335
+ // }}
336
+ >
337
+ <ViewMore
338
+ compactMode={isCompactTable}
339
+ onCompactToggle={(value: string) =>
340
+ setIsCompactTable(value === "Compact")
341
+ }
342
+ isFullscreen={isFullscreen}
343
+ onFullscreenToggle={fullscreenToggle}
344
+ groupBy={groupBy}
345
+ onGroupByChange={(value: string) => setGroupBy(value)}
346
+ tableStates={tableStates}
347
+ onClose={() => setViewMoreAnchorEl(null)}
348
+ />
349
+ </Popover>
221
350
  </div>
222
351
  </div>
223
352
  );