rez-table-listing-mui 1.0.37 → 1.0.39

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.
Files changed (44) hide show
  1. package/dist/index.d.ts +100 -3
  2. package/dist/index.js +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/package.json +1 -1
  5. package/src/App.tsx +82 -27
  6. package/src/components/common/confirm-modal/index.tsx +8 -3
  7. package/src/components/filter/components/forms/components/Date.tsx +109 -161
  8. package/src/components/filter/components/forms/components/Filter-criteria.tsx +12 -55
  9. package/src/components/filter/components/forms/index.tsx +1 -1
  10. package/src/components/filter/components/saved-filter.tsx +6 -3
  11. package/src/components/filter/index.tsx +1 -1
  12. package/src/components/filter/style.ts +0 -1
  13. package/src/components/index-table.tsx +5 -2
  14. package/src/components/index.scss +2 -0
  15. package/src/components/login/index.tsx +1 -1
  16. package/src/components/search/index.tsx +31 -6
  17. package/src/components/table-head-popover.tsx +1 -1
  18. package/src/components/table-settings/common/draggable-listitem.tsx +66 -0
  19. package/src/components/table-settings/common/listing-values.tsx +117 -0
  20. package/src/components/table-settings/components/column.tsx +332 -0
  21. package/src/components/table-settings/components/custom-button.tsx +15 -0
  22. package/src/components/table-settings/components/custom-dialog.tsx +27 -0
  23. package/src/components/table-settings/components/quick-tab.tsx +335 -0
  24. package/src/components/table-settings/components/sorting.tsx +619 -0
  25. package/src/components/table-settings/components/toggle-button-switch.tsx +45 -0
  26. package/src/components/table-settings/constants.ts +12 -0
  27. package/src/components/table-settings/index.tsx +133 -0
  28. package/src/components/table-settings/style.ts +115 -0
  29. package/src/components/table-settings/tabs/horizontal/index.tsx +21 -0
  30. package/src/components/table-settings/tabs/styles.ts +67 -0
  31. package/src/components/table-settings/tabs/vertical/custom-tab-panel.tsx +29 -0
  32. package/src/components/table-settings/tabs/vertical/index.tsx +38 -0
  33. package/src/components/tabs/index.tsx +30 -36
  34. package/src/index.ts +1 -0
  35. package/src/libs/hooks/useCraftTableFilterSettings.tsx +176 -0
  36. package/src/libs/hooks/useEntityTableAPI.tsx +82 -1
  37. package/src/libs/utils/apiColumn.ts +25 -0
  38. package/src/libs/utils/common.ts +2 -2
  39. package/src/types/common.ts +6 -0
  40. package/src/types/filter-settings.ts +97 -0
  41. package/src/types/filter.ts +6 -0
  42. package/src/types/table-options.ts +19 -0
  43. package/src/types/table.ts +10 -1
  44. package/.env.uat +0 -1
@@ -0,0 +1,619 @@
1
+ import React, { useEffect, useMemo, useState } from "react";
2
+ import {
3
+ Box,
4
+ Button,
5
+ IconButton,
6
+ MenuItem,
7
+ Select,
8
+ Tab,
9
+ Typography,
10
+ } from "@mui/material";
11
+ import {
12
+ SettingsSortingProps,
13
+ SortingConfigProps,
14
+ SortingConfigSortByProps,
15
+ } from "../../../types/filter-settings";
16
+ import CustomToggleSwitchButton from "./toggle-button-switch";
17
+ import CustomTabs from "../tabs/horizontal";
18
+ import {
19
+ closestCenter,
20
+ DndContext,
21
+ PointerSensor,
22
+ useSensor,
23
+ useSensors,
24
+ } from "@dnd-kit/core";
25
+ import SortableItem from "../../sorting-modal.tsx/sorting-item";
26
+ import {
27
+ arrayMove,
28
+ SortableContext,
29
+ verticalListSortingStrategy,
30
+ } from "@dnd-kit/sortable";
31
+ import { AddIcon, CloseIcon } from "../../../assets/svg";
32
+ import { TOGGLE_BUTTON_TABS } from "../constants";
33
+
34
+ const Sorting = ({
35
+ filterSettingStates,
36
+ columnsData,
37
+ }: SettingsSortingProps) => {
38
+ const { quickTabStates, sortingTabState, setSortingTabState } =
39
+ filterSettingStates;
40
+
41
+ const [activeTab, setActiveTab] = useState<string | undefined>(
42
+ quickTabStates?.show_list?.[0]
43
+ );
44
+
45
+ useEffect(() => {
46
+ if (!Object.entries(sortingTabState)?.length) {
47
+ // Render empty columns
48
+ const emptySortBy: SortingConfigSortByProps[] = [
49
+ { column: "", order: "asc" },
50
+ ];
51
+
52
+ // Create a new default sorting state
53
+ const newSortingState: SortingConfigProps = {
54
+ isDefault: true,
55
+ sortby: emptySortBy,
56
+ tabs: quickTabStates?.show_list?.map((tab) => ({
57
+ tab_name: tab,
58
+ sortby: emptySortBy,
59
+ })),
60
+ };
61
+
62
+ setActiveTab(newSortingState?.tabs?.[0]?.tab_name);
63
+ setSortingTabState(newSortingState);
64
+ }
65
+ }, []);
66
+
67
+ const isDefault = sortingTabState?.isDefault;
68
+ const sensors = useSensors(useSensor(PointerSensor));
69
+
70
+ const activeTabIndex = sortingTabState?.tabs?.findIndex(
71
+ (tab) => tab?.tab_name === activeTab
72
+ );
73
+
74
+ /**
75
+ * * What is happening here?
76
+ *
77
+ * * If isDefault is true
78
+ * * - Return the sortby array from the state
79
+ *
80
+ * * If isDefault is false
81
+ * * - Filter tabs array from sortingTabState according to activeTab index
82
+ *
83
+ * * If activeTab is undefined
84
+ * * - Return an empty array
85
+ */
86
+ const tabSortedList = useMemo(() => {
87
+ return isDefault
88
+ ? sortingTabState?.sortby
89
+ : activeTab !== undefined
90
+ ? sortingTabState?.tabs?.[activeTabIndex || 0]?.sortby
91
+ : [];
92
+ }, [sortingTabState, activeTab]);
93
+
94
+ const updateSortList = (updated: SortingConfigSortByProps[]) => {
95
+ setSortingTabState((prev) => {
96
+ if (prev.isDefault) {
97
+ return { ...prev, sortby: updated };
98
+ } else {
99
+ const tabs = [...(prev.tabs || [])];
100
+ tabs[activeTabIndex || 0] = {
101
+ ...tabs[activeTabIndex || 0],
102
+ sortby: updated,
103
+ };
104
+ return { ...prev, tabs };
105
+ }
106
+ });
107
+ };
108
+
109
+ const handleDNDDropdownChange = (
110
+ key: "column" | "order",
111
+ value: string,
112
+ index: number
113
+ ) => {
114
+ if (!tabSortedList) return;
115
+
116
+ const updated = [...tabSortedList];
117
+ updated[index] = { ...updated[index], [key]: value };
118
+ updateSortList(updated);
119
+ };
120
+
121
+ const handleAddSort = () => {
122
+ if (!tabSortedList) return;
123
+
124
+ const newItem: SortingConfigSortByProps = {
125
+ column: columnsData?.column_list?.[0]?.attribute_key || "",
126
+ order: "asc",
127
+ };
128
+ updateSortList([...tabSortedList, newItem]);
129
+ };
130
+
131
+ const handleRemove = (columnKey: string) => {
132
+ if (!tabSortedList) return;
133
+
134
+ const updated = tabSortedList.filter((item) => item.column !== columnKey);
135
+ updateSortList(updated);
136
+ };
137
+
138
+ const handleModeChange = (
139
+ _: React.MouseEvent<HTMLElement>,
140
+ value: boolean
141
+ ) => {
142
+ if (value !== null) {
143
+ setSortingTabState((prev) => ({ ...prev, isDefault: value }));
144
+ }
145
+ };
146
+
147
+ const handleDragEnd = (event: any) => {
148
+ if (!tabSortedList) return;
149
+
150
+ const { active, over } = event;
151
+ if (!over || active.id === over.id) return;
152
+
153
+ const oldIndex = tabSortedList.findIndex((i) => i.column === active.id);
154
+ const newIndex = tabSortedList.findIndex((i) => i.column === over.id);
155
+
156
+ if (oldIndex !== -1 && newIndex !== -1) {
157
+ const reordered = arrayMove(tabSortedList, oldIndex, newIndex);
158
+ updateSortList(reordered);
159
+ }
160
+ };
161
+
162
+ return (
163
+ <Box sx={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}>
164
+ <Typography>Select attribute(s) you want to sort by</Typography>
165
+
166
+ <CustomToggleSwitchButton
167
+ buttons={TOGGLE_BUTTON_TABS}
168
+ value={isDefault}
169
+ onChange={handleModeChange}
170
+ />
171
+
172
+ <Box>
173
+ {!isDefault && (
174
+ <CustomTabs
175
+ value={activeTab}
176
+ onChange={(_, tab) => setActiveTab(tab)}
177
+ >
178
+ {quickTabStates?.show_list?.map((tab) => (
179
+ <Tab key={tab} label={tab} value={tab} />
180
+ ))}
181
+ </CustomTabs>
182
+ )}
183
+ </Box>
184
+
185
+ <DndContext
186
+ sensors={sensors}
187
+ collisionDetection={closestCenter}
188
+ onDragEnd={handleDragEnd}
189
+ >
190
+ <SortableContext
191
+ items={tabSortedList?.map((s) => s.column) || []}
192
+ strategy={verticalListSortingStrategy}
193
+ >
194
+ {tabSortedList?.map((sort, index) => (
195
+ <SortableItem key={sort.column} id={sort.column}>
196
+ <Box display="flex" gap={1} alignItems="center" mb={1}>
197
+ <Select
198
+ value={sort.column}
199
+ onChange={(e) =>
200
+ handleDNDDropdownChange("column", e.target.value, index)
201
+ }
202
+ size="small"
203
+ fullWidth
204
+ >
205
+ {columnsData?.column_list?.map((column) => (
206
+ <MenuItem
207
+ key={column?.attribute_key}
208
+ value={column?.attribute_key}
209
+ >
210
+ {column?.name}
211
+ </MenuItem>
212
+ ))}
213
+ </Select>
214
+ <Select
215
+ value={sort.order}
216
+ onChange={(e) =>
217
+ handleDNDDropdownChange("order", e.target.value, index)
218
+ }
219
+ size="small"
220
+ fullWidth
221
+ >
222
+ <MenuItem value="asc">Ascending</MenuItem>
223
+ <MenuItem value="desc">Descending</MenuItem>
224
+ </Select>
225
+ <IconButton
226
+ size="small"
227
+ onClick={() => handleRemove(sort.column)}
228
+ >
229
+ <CloseIcon />
230
+ </IconButton>
231
+ </Box>
232
+ </SortableItem>
233
+ ))}
234
+ </SortableContext>
235
+ </DndContext>
236
+
237
+ <Button
238
+ onClick={handleAddSort}
239
+ startIcon={<AddIcon />}
240
+ variant="text"
241
+ sx={{
242
+ fontSize: 13,
243
+ color: "#7A5AF8",
244
+ }}
245
+ >
246
+ Add Sort
247
+ </Button>
248
+ </Box>
249
+
250
+ // <Box sx={{ display: "flex", flexDirection: "column", gap: "0.75rem" }}>
251
+ // <Typography>Select attribute(s) you want to sort by</Typography>
252
+
253
+ // <CustomToggleSwitchButton value={isDefault} onChange={handleModeChange} />
254
+
255
+ // <Box>
256
+ // {!isDefault && (
257
+ // <Tabs
258
+ // value={tab}
259
+ // onChange={(_, v) => setTab(v as TabKey)}
260
+ // sx={{
261
+ // mb: 2,
262
+ // "& .MuiTab-root": {
263
+ // color: "#0E0C0BE5",
264
+ // textTransform: "none",
265
+ // fontWeight: 500,
266
+ // },
267
+ // "& .Mui-selected": {
268
+ // color: "#7A5AF8",
269
+ // },
270
+ // "& .MuiTabs-indicator": {
271
+ // backgroundColor: "#7A5AF8",
272
+ // height: 3,
273
+ // },
274
+ // }}
275
+ // >
276
+ // {tabs.map((t) => (
277
+ // <Tab key={t} label={t} value={t} />
278
+ // ))}
279
+ // </Tabs>
280
+ // )}
281
+
282
+ // <DndContext
283
+ // sensors={sensors}
284
+ // collisionDetection={closestCenter}
285
+ // onDragEnd={handleDragEnd}
286
+ // >
287
+ // <SortableContext
288
+ // items={currentSortList?.map((s) => s.id)}
289
+ // strategy={verticalListSortingStrategy}
290
+ // >
291
+ // {currentSortList?.map((sort) => (
292
+ // <SortableItem key={sort.id} id={sort.id}>
293
+ // <Box display="flex" gap={1} alignItems="center" mb={1}>
294
+ // <Select
295
+ // value={sort.field}
296
+ // onChange={(e) =>
297
+ // handleChange(sort.id, "field", e.target.value)
298
+ // }
299
+ // size="small"
300
+ // fullWidth
301
+ // >
302
+ // {attributes.map((attr) => (
303
+ // <MenuItem key={attr} value={attr}>
304
+ // {attr}
305
+ // </MenuItem>
306
+ // ))}
307
+ // </Select>
308
+ // <Select
309
+ // value={sort.direction}
310
+ // onChange={(e) =>
311
+ // handleChange(sort.id, "direction", e.target.value)
312
+ // }
313
+ // size="small"
314
+ // fullWidth
315
+ // >
316
+ // <MenuItem value="asc">Ascending</MenuItem>
317
+ // <MenuItem value="desc">Descending</MenuItem>
318
+ // </Select>
319
+ // <IconButton
320
+ // size="small"
321
+ // onClick={() => handleRemove(sort.id)}
322
+ // >
323
+ // <CloseIcon />
324
+ // </IconButton>
325
+ // </Box>
326
+ // </SortableItem>
327
+ // ))}
328
+ // </SortableContext>
329
+ // </DndContext>
330
+
331
+ // <Button
332
+ // onClick={handleAddSort}
333
+ // startIcon={<AddIcon />}
334
+ // sx={{
335
+ // fontSize: 13,
336
+ // color: "#7A5AF8",
337
+ // textTransform: "uppercase",
338
+ // }}
339
+ // >
340
+ // Add Sort
341
+ // </Button>
342
+ // </Box>
343
+
344
+ // <Box>
345
+ // <Button
346
+ // onClick={handleSave}
347
+ // sx={{
348
+ // backgroundColor: "#7A5AF8",
349
+ // color: "#fff",
350
+ // textTransform: "none",
351
+ // }}
352
+ // >
353
+ // Save Sorting
354
+ // </Button>
355
+ // </Box>
356
+ // </Box>
357
+ );
358
+ };
359
+
360
+ export default Sorting;
361
+
362
+ // import React, { useEffect, useState } from "react";
363
+ // import {
364
+ // Box,
365
+ // Tabs,
366
+ // Tab,
367
+ // Button,
368
+ // Select,
369
+ // MenuItem,
370
+ // IconButton,
371
+ // Typography,
372
+ // } from "@mui/material";
373
+ // import {
374
+ // DndContext,
375
+ // closestCenter,
376
+ // useSensors,
377
+ // useSensor,
378
+ // PointerSensor,
379
+ // } from "@dnd-kit/core";
380
+ // import {
381
+ // SortableContext,
382
+ // arrayMove,
383
+ // verticalListSortingStrategy,
384
+ // } from "@dnd-kit/sortable";
385
+ // import SortableItem from "../../sorting-modal.tsx/sorting-item";
386
+ // import { AddIcon, CloseIcon } from "../../../assets/svg";
387
+ // import CustomToggleSwitchButton from "./toggle-button-switch";
388
+ // import { SettingsSortingProps } from "../../../types/filter-settings";
389
+
390
+ // const tabs = ["Active", "Reject"];
391
+ // type TabKey = (typeof tabs)[number];
392
+
393
+ // interface SortItem {
394
+ // id: string;
395
+ // field: string;
396
+ // direction: "asc" | "desc";
397
+ // }
398
+
399
+ // interface sortingTabState {
400
+ // isDefault: boolean;
401
+ // default: SortItem[];
402
+ // tabs: Record<TabKey, SortItem[]>;
403
+ // }
404
+
405
+ // const Sorting = ({ columnsData }: SettingsSortingProps) => {
406
+ // const [tab, setTab] = useState<TabKey>("Active");
407
+ // const [sortingTabState, setSortingTabState] = useState<sortingTabState>({
408
+ // isDefault: true,
409
+ // default: [],
410
+ // tabs: {
411
+ // Active: [],
412
+ // Reject: [],
413
+ // },
414
+ // });
415
+
416
+ // const isDefault = sortingTabState?.isDefault;
417
+
418
+ // const attributes = ["Id", "Status", "Name", "Date"];
419
+ // const sensors = useSensors(useSensor(PointerSensor));
420
+
421
+ // const currentSortList = isDefault ? sortingTabState.default : sortingTabState.tabs[tab];
422
+
423
+ // const updateSortList = (updated: SortItem[]) => {
424
+ // setSortingTabState((prev) =>
425
+ // isDefault
426
+ // ? { ...prev, default: updated }
427
+ // : { ...prev, tabs: { ...prev.tabs, [tab]: updated } }
428
+ // );
429
+ // };
430
+
431
+ // const handleDragEnd = (event: any) => {
432
+ // const { active, over } = event;
433
+ // if (!over || active.id === over.id) return;
434
+
435
+ // const list = currentSortList;
436
+ // const oldIndex = list.findIndex((i) => i.id === active.id);
437
+ // const newIndex = list.findIndex((i) => i.id === over.id);
438
+ // const reordered = arrayMove(list, oldIndex, newIndex);
439
+ // updateSortList(reordered);
440
+ // };
441
+
442
+ // const handleChange = (id: string, key: keyof SortItem, value: any) => {
443
+ // const updated = currentSortList.map((item) =>
444
+ // item.id === id ? { ...item, [key]: value } : item
445
+ // );
446
+ // updateSortList(updated);
447
+ // };
448
+
449
+ // const handleAddSort = () => {
450
+ // const newItem: SortItem = {
451
+ // id: Date.now().toString(),
452
+ // field: attributes[0],
453
+ // direction: "asc",
454
+ // };
455
+ // updateSortList([...currentSortList, newItem]);
456
+ // };
457
+
458
+ // const handleRemove = (id: string) => {
459
+ // const updated = currentSortList.filter((item) => item.id !== id);
460
+ // updateSortList(updated);
461
+ // };
462
+
463
+ // const handleModeChange = (
464
+ // _: React.MouseEvent<HTMLElement>,
465
+ // value: boolean
466
+ // ) => {
467
+ // if (value !== null) {
468
+ // setSortingTabState((prev) => ({ ...prev, isDefault: value }));
469
+ // }
470
+ // };
471
+
472
+ // const handleSave = () => {
473
+ // const payload: any = {
474
+ // isDefault: sortingTabState.isDefault,
475
+ // };
476
+
477
+ // if (sortingTabState.isDefault) {
478
+ // payload.sortby = sortingTabState.default.map((s) => ({
479
+ // column: s.field.toLowerCase(),
480
+ // order: s.direction,
481
+ // }));
482
+ // } else {
483
+ // payload.tabs = Object.entries(sortingTabState.tabs).map(
484
+ // ([tabName, sortby]) => ({
485
+ // tab_name: tabName.toLowerCase(),
486
+ // sortby: sortby.map((s) => ({
487
+ // column: s.field.toLowerCase(),
488
+ // order: s.direction,
489
+ // })),
490
+ // })
491
+ // );
492
+ // }
493
+ // };
494
+
495
+ // return (
496
+ // <Box p={2}>
497
+ // <Typography
498
+ // variant="h6"
499
+ // mb={2}
500
+ // sx={{ color: "#0E0C0BE5", fontWeight: "500", fontSize: "16px" }}
501
+ // >
502
+ // Select attribute(s) you want to sort by
503
+ // </Typography>
504
+
505
+ // <Box
506
+ // display="flex"
507
+ // flexDirection="column"
508
+ // alignItems="flex-start"
509
+ // gap={1}
510
+ // mb={2}
511
+ // >
512
+ // <CustomToggleSwitchButton value={isDefault} onChange={handleModeChange} />
513
+
514
+ // <Button
515
+ // onClick={handleAddSort}
516
+ // startIcon={<AddIcon />}
517
+ // sx={{
518
+ // fontSize: 13,
519
+ // padding: 0,
520
+ // color: "#7A5AF8",
521
+ // textTransform: "uppercase",
522
+ // fontWeight: 500,
523
+ // minHeight: 0,
524
+ // minWidth: 0,
525
+ // }}
526
+ // >
527
+ // Add Sort
528
+ // </Button>
529
+ // </Box>
530
+
531
+ // {!isDefault && (
532
+ // <Tabs
533
+ // value={tab}
534
+ // onChange={(_, v) => setTab(v as TabKey)}
535
+ // sx={{
536
+ // mb: 2,
537
+ // "& .MuiTab-root": {
538
+ // color: "#0E0C0BE5",
539
+ // textTransform: "none",
540
+ // fontWeight: 500,
541
+ // },
542
+ // "& .Mui-selected": {
543
+ // color: "#7A5AF8",
544
+ // },
545
+ // "& .MuiTabs-indicator": {
546
+ // backgroundColor: "#7A5AF8",
547
+ // height: 3,
548
+ // },
549
+ // }}
550
+ // >
551
+ // {tabs.map((t) => (
552
+ // <Tab key={t} label={t} value={t} />
553
+ // ))}
554
+ // </Tabs>
555
+ // )}
556
+
557
+ // <DndContext
558
+ // sensors={sensors}
559
+ // collisionDetection={closestCenter}
560
+ // onDragEnd={handleDragEnd}
561
+ // >
562
+ // <SortableContext
563
+ // items={currentSortList.map((s) => s.id)}
564
+ // strategy={verticalListSortingStrategy}
565
+ // >
566
+ // {currentSortList.map((sort) => (
567
+ // <SortableItem key={sort.id} id={sort.id}>
568
+ // <Box display="flex" gap={1} alignItems="center" mb={1}>
569
+ // <Select
570
+ // value={sort.field}
571
+ // onChange={(e) =>
572
+ // handleChange(sort.id, "field", e.target.value)
573
+ // }
574
+ // size="small"
575
+ // sx={{ minWidth: 450 }}
576
+ // >
577
+ // {attributes.map((attr) => (
578
+ // <MenuItem key={attr} value={attr}>
579
+ // {attr}
580
+ // </MenuItem>
581
+ // ))}
582
+ // </Select>
583
+ // <Select
584
+ // value={sort.direction}
585
+ // onChange={(e) =>
586
+ // handleChange(sort.id, "direction", e.target.value)
587
+ // }
588
+ // size="small"
589
+ // sx={{ minWidth: 450 }}
590
+ // >
591
+ // <MenuItem value="asc">Ascending</MenuItem>
592
+ // <MenuItem value="desc">Descending</MenuItem>
593
+ // </Select>
594
+ // <IconButton size="small" onClick={() => handleRemove(sort.id)}>
595
+ // <CloseIcon />
596
+ // </IconButton>
597
+ // </Box>
598
+ // </SortableItem>
599
+ // ))}
600
+ // </SortableContext>
601
+ // </DndContext>
602
+
603
+ // <Box sx={{ mt: 20, marginLeft: "700px" }}>
604
+ // <Button
605
+ // onClick={handleSave}
606
+ // sx={{
607
+ // backgroundColor: "#7A5AF8",
608
+ // color: "#fff",
609
+ // textTransform: "none",
610
+ // }}
611
+ // >
612
+ // Save Sorting
613
+ // </Button>
614
+ // </Box>
615
+ // </Box>
616
+ // );
617
+ // };
618
+
619
+ // export default Sorting;
@@ -0,0 +1,45 @@
1
+ import {
2
+ SxProps,
3
+ ToggleButton,
4
+ ToggleButtonGroup,
5
+ ToggleButtonGroupProps,
6
+ } from "@mui/material";
7
+ import { ToggleButtonTabsProps } from "../../../types/filter-settings";
8
+
9
+ const selectedTabStyle: SxProps = {
10
+ textTransform: "initial",
11
+ minWidth: "5rem",
12
+ minHeight: "1.875rem",
13
+ color: "#7A5AF8",
14
+ fontWeight: 500,
15
+ fontSize: "0.813rem",
16
+ borderColor: "#7A5AF8",
17
+
18
+ "&.Mui-selected": {
19
+ backgroundColor: "#7A5AF8",
20
+ color: "#fff",
21
+ fontWeight: 600,
22
+ "&:hover": {
23
+ backgroundColor: "#6346e2",
24
+ },
25
+ },
26
+ };
27
+
28
+ export default function CustomToggleSwitchButton({
29
+ buttons,
30
+ ...props
31
+ }: { buttons: ToggleButtonTabsProps[] } & ToggleButtonGroupProps) {
32
+ return (
33
+ <ToggleButtonGroup exclusive size="small" color="primary" {...props}>
34
+ {buttons.map((button) => (
35
+ <ToggleButton
36
+ value={button?.value}
37
+ disabled={button?.isDisabled}
38
+ sx={selectedTabStyle}
39
+ >
40
+ {button.label}
41
+ </ToggleButton>
42
+ ))}
43
+ </ToggleButtonGroup>
44
+ );
45
+ }
@@ -0,0 +1,12 @@
1
+ import { ToggleButtonTabsProps } from "../../types/filter-settings";
2
+
3
+ export const SETTINGS_TABS: { label: string }[] = [
4
+ { label: "Quick Tab" },
5
+ { label: "Column" },
6
+ { label: "Sorting" },
7
+ ];
8
+
9
+ export const TOGGLE_BUTTON_TABS: ToggleButtonTabsProps[] = [
10
+ { label: "Default", value: true, isDisabled: false },
11
+ { label: "Tab Wise", value: false, isDisabled: false },
12
+ ];