rez-table-listing-mui 1.2.1 → 1.2.3

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.1",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "description": "A rez table listing component built on TanStack Table",
6
6
  "main": "dist/index.js",
@@ -121,7 +121,7 @@ const AttributesFilter = ({
121
121
  };
122
122
 
123
123
  const selectedAttributeOptions = useMemo(() => {
124
- const selected = columnsData.column_list.find(
124
+ const selected = columnsData?.column_list?.find(
125
125
  (col) => col.datasource_list === selectedAttribute
126
126
  )?.attribute_key;
127
127
 
@@ -45,7 +45,8 @@ const FormMultiSelect = ({
45
45
  {...field}
46
46
  sx={{
47
47
  "& .MuiOutlinedInput-input": {
48
- padding: "12px 20px",
48
+ padding: "10px 20px",
49
+ height: "21px",
49
50
  },
50
51
  }}
51
52
  multiple
@@ -9,9 +9,9 @@ const LoginButton = () => {
9
9
  setLoading(true);
10
10
  try {
11
11
  const response = await axios.post(
12
- "http://localhost:6010/api/auth/login",
12
+ "http://localhost:4010/api/auth/login",
13
13
  {
14
- email_id: "darshil@rezolut.in",
14
+ email_id: "admin@rezolut.in",
15
15
  password: "Admin@123",
16
16
  }
17
17
  );
@@ -2,13 +2,16 @@ import React, { useState, useRef, useEffect, useCallback } from "react";
2
2
  import { SearchIcon } from "../../assets/svg";
3
3
  import useOutsideClick from "../../libs/hooks/useOutsideClick";
4
4
  import { customDebounce } from "../../libs/utils/debounce";
5
+ import { Box, IconButton, InputAdornment, TextField } from "@mui/material";
6
+ import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
7
+ import { searchStyles } from "./style";
5
8
 
6
9
  interface TableSearchProps {
7
10
  value: string;
8
11
  onChange: (value: string) => void;
9
12
  }
10
13
 
11
- const TableSearch: React.FC<TableSearchProps> = ({ value, onChange }) => {
14
+ const TableSearch = ({ value, onChange }: TableSearchProps): JSX.Element => {
12
15
  const [showSearchInput, setShowSearchInput] = useState(false);
13
16
  const [localValue, setLocalValue] = useState(value);
14
17
  const searchContainerRef = useRef<HTMLDivElement>(null);
@@ -49,8 +52,16 @@ const TableSearch: React.FC<TableSearchProps> = ({ value, onChange }) => {
49
52
  };
50
53
 
51
54
  return (
52
- <div className="search-wrapper" ref={searchContainerRef}>
53
- <div
55
+ <Box
56
+ ref={searchContainerRef}
57
+ className="search-container"
58
+ sx={{
59
+ display: "flex",
60
+ position: "relative",
61
+ top: "10px",
62
+ }}
63
+ >
64
+ {/* <Box
54
65
  className="search-icon ts--button"
55
66
  onClick={() => {
56
67
  setShowSearchInput((prev) => !prev);
@@ -63,16 +74,60 @@ const TableSearch: React.FC<TableSearchProps> = ({ value, onChange }) => {
63
74
  }}
64
75
  >
65
76
  <SearchIcon />
66
- </div>
67
- <input
77
+ </Box> */}
78
+
79
+ <TextField
68
80
  type="text"
69
- className={`search-input ${showSearchInput ? "expanded" : ""}`}
70
- placeholder="Type to search"
81
+ placeholder="Search"
71
82
  value={localValue}
72
83
  onChange={handleChange}
73
84
  onKeyDown={handleKeyDown}
85
+ className={`search-input ${showSearchInput ? "expanded" : ""}`}
86
+ sx={searchStyles.searchField(showSearchInput)}
87
+ InputProps={{
88
+ startAdornment: (
89
+ <InputAdornment position="start">
90
+ <IconButton
91
+ size="small"
92
+ onClick={() => {
93
+ setShowSearchInput((prev) => !prev);
94
+ if (!showSearchInput) {
95
+ setTimeout(() => {
96
+ searchContainerRef.current
97
+ ?.querySelector("input")
98
+ ?.focus();
99
+ }, 100);
100
+ }
101
+ }}
102
+ sx={{ color: "black", fontSize: "14px" }}
103
+ edge="start"
104
+ >
105
+ <SearchIcon />
106
+ </IconButton>
107
+ </InputAdornment>
108
+ ),
109
+ endAdornment:
110
+ showSearchInput && localValue !== "" ? (
111
+ <InputAdornment position="end">
112
+ <IconButton
113
+ size="small"
114
+ onClick={() => {
115
+ setLocalValue("");
116
+ handleChange({ target: { value: "" } } as any);
117
+ }}
118
+ sx={{ color: "black", fontSize: "14px" }}
119
+ edge="end"
120
+ >
121
+ <CloseRoundedIcon
122
+ fontSize="small"
123
+ sx={{ color: "black", fontSize: "14px" }}
124
+ />
125
+ </IconButton>
126
+ </InputAdornment>
127
+ ) : null,
128
+ }}
74
129
  />
75
- </div>
130
+ </Box>
76
131
  );
77
132
  };
78
133
 
@@ -0,0 +1,40 @@
1
+ import { Theme } from "@emotion/react";
2
+ import { SxProps } from "@mui/material";
3
+
4
+ export interface StyleProps {
5
+ searchField: (showSearchInput: boolean) => SxProps<Theme>;
6
+ }
7
+
8
+ export const searchStyles: StyleProps = {
9
+ searchField: (showSearchInput: boolean): SxProps<Theme> => ({
10
+ width: showSearchInput ? "180px" : "40px",
11
+ transition: "all 0.3s ease",
12
+ opacity: showSearchInput ? 1 : 0.8,
13
+ marginRight: "0.5rem",
14
+
15
+ "& .MuiOutlinedInput-root": {
16
+ paddingRight: "4px",
17
+ height: "32px",
18
+ borderRadius: "6px",
19
+ backgroundColor: "#fff",
20
+ border: showSearchInput ? "1px solid #ccc" : "none",
21
+ },
22
+
23
+ "& .MuiOutlinedInput-notchedOutline": {
24
+ border: "none",
25
+ },
26
+
27
+ "&:hover .MuiOutlinedInput-notchedOutline": {
28
+ border: "none",
29
+ },
30
+
31
+ "&.Mui-focused .MuiOutlinedInput-notchedOutline": {},
32
+
33
+ " & .css-4bojcr-MuiInputBase-root-MuiOutlinedInput-root ": {
34
+ paddingLeft: "6px !important",
35
+ },
36
+ "& .css-1mnoz6i-MuiInputBase-root-MuiOutlinedInput-root": {
37
+ paddingLeft: "6px !important",
38
+ },
39
+ }),
40
+ };
@@ -27,32 +27,32 @@
27
27
  margin-bottom: 1.2rem;
28
28
  }
29
29
 
30
- .search-input {
31
- width: 0;
32
- opacity: 0;
33
- margin-left: 8px;
34
- padding: 6px 8px;
35
- font-size: 0.875rem;
36
- border: 1px solid #ccc;
37
- border-radius: 4px;
38
- background-color: #f5f5f5;
39
- color: #000;
40
- transition: width 0.3s ease, opacity 0.3s ease;
41
- // position: absolute;
42
- // right: 40px;
43
- // top: 50%;
44
- // transform: translateY(-50%);
45
-
46
- &:focus {
47
- outline: none;
48
- border-color: #000;
49
- }
50
- }
51
-
52
- .search-input.expanded {
53
- width: 200px;
54
- opacity: 1;
55
- }
30
+ // .search-input {
31
+ // width: 0;
32
+ // opacity: 0;
33
+ // margin-left: 8px;
34
+ // padding: 6px 8px;
35
+ // font-size: 0.875rem;
36
+ // border: 1px solid #ccc;
37
+ // border-radius: 4px;
38
+ // background-color: #f5f5f5;
39
+ // color: #000;
40
+ // transition: width 0.3s ease, opacity 0.3s ease;
41
+ // // position: absolute;
42
+ // // right: 40px;
43
+ // // top: 50%;
44
+ // // transform: translateY(-50%);
45
+
46
+ // &:focus {
47
+ // outline: none;
48
+ // border-color: #000;
49
+ // }
50
+ // }
51
+
52
+ // .search-input.expanded {
53
+ // width: 200px;
54
+ // opacity: 1;
55
+ // }
56
56
  }
57
57
 
58
58
  .ts--button {
@@ -77,14 +77,14 @@ export function customDebounce<T extends (...args: any[]) => any>(
77
77
  }
78
78
 
79
79
  //ENTITY TYPE
80
- export const ENTITY_TYPE = "NTM";
80
+ export const ENTITY_TYPE = "ROL";
81
81
 
82
82
  // uat http://13.200.182.92:4010/api
83
83
  // local http://localhost:4010/api
84
84
 
85
85
  // API INTEGRATION
86
86
  export const api = axios.create({
87
- baseURL: "http://localhost:6010/api",
87
+ baseURL: "http://localhost:4010/api",
88
88
  timeout: 10000,
89
89
  headers: {
90
90
  "Content-Type": "application/json",