react-core-ts 1.0.23 → 1.0.25

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 (48) hide show
  1. package/dist/AutoCompleteWithTreeStructure.d.ts +4 -0
  2. package/dist/AutoCompleteWithTreeStructure.js +415 -0
  3. package/dist/AutoCompleteWithTreeStructure.js.map +1 -0
  4. package/dist/ExpandableAutoComplete.d.ts +2 -2
  5. package/dist/ExpandableAutoComplete.js +54 -71
  6. package/dist/ExpandableAutoComplete.js.map +1 -1
  7. package/dist/commontypes.d.ts +4 -1
  8. package/dist/components/DropdownList.d.ts +14 -0
  9. package/dist/components/DropdownList.js +18 -0
  10. package/dist/components/DropdownList.js.map +1 -0
  11. package/dist/components/Icons.d.ts +3 -0
  12. package/dist/components/Icons.js +18 -0
  13. package/dist/components/Icons.js.map +1 -0
  14. package/dist/components/InputActions.d.ts +14 -0
  15. package/dist/components/InputActions.js +18 -0
  16. package/dist/components/InputActions.js.map +1 -0
  17. package/dist/components/TreeNode.d.ts +3 -0
  18. package/dist/components/TreeNode.js +34 -0
  19. package/dist/components/TreeNode.js.map +1 -0
  20. package/dist/index.d.ts +8 -8
  21. package/dist/index.js +6 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/styles/global.css +4 -0
  24. package/dist/styles/styles/components/autocomplete.css +585 -0
  25. package/dist/styles/styles/global.css +5 -0
  26. package/dist/utilities/convertFlatArraytoTreeStructure.d.ts +1 -0
  27. package/dist/utilities/convertFlatArraytoTreeStructure.js +29 -0
  28. package/dist/utilities/convertFlatArraytoTreeStructure.js.map +1 -0
  29. package/dist/utilities/filterSuggestions.d.ts +1 -1
  30. package/dist/utilities/filterSuggestions.js +4 -3
  31. package/dist/utilities/filterSuggestions.js.map +1 -1
  32. package/docs/App.tsx +65 -36
  33. package/docs/store.ts +67 -0
  34. package/package.json +6 -5
  35. package/postcss.config.js +4 -5
  36. package/src/AutoCompleteWithTreeStructure.tsx +611 -0
  37. package/src/ExpandableAutoComplete.tsx +83 -144
  38. package/src/commontypes.ts +4 -1
  39. package/src/components/DropdownList.tsx +70 -0
  40. package/src/components/Icons.tsx +38 -0
  41. package/src/components/InputActions.tsx +63 -0
  42. package/src/components/TreeNode.tsx +80 -0
  43. package/src/index.tsx +11 -8
  44. package/src/styles/global.css +4 -0
  45. package/src/utilities/convertFlatArraytoTreeStructure.ts +27 -0
  46. package/src/utilities/filterSuggestions.ts +5 -3
  47. package/tailwind.config.js +15 -0
  48. package/webpack.config.js +17 -3
package/docs/App.tsx CHANGED
@@ -1,8 +1,13 @@
1
- import React, { useState } from 'react';
1
+ import React, { useState } from "react";
2
2
 
3
- import { AutoComplete, ExpandableAutoComplete } from '../src/index';
3
+ import {
4
+ AutoComplete,
5
+ AutoCompleteWithTreeStructure,
6
+ ExpandableAutoComplete,
7
+ } from "../src/index";
4
8
 
5
- import '../src/styles/global.css';
9
+ import "../src/styles/global.css";
10
+ import { treeDropData } from "./store";
6
11
 
7
12
  export default function App() {
8
13
  const [dropData, setDropData] = useState();
@@ -19,7 +24,7 @@ export default function App() {
19
24
  .then((res) => {
20
25
  setNexBlock(nexBlock + 1);
21
26
  const result = res.map((item: any) => {
22
- return { ...item, ['name']: item?.title, id: item?.id.toString() };
27
+ return { ...item, ["name"]: item?.title, id: item?.id.toString() };
23
28
  });
24
29
  return result;
25
30
  });
@@ -34,7 +39,7 @@ export default function App() {
34
39
  .then((res) => {
35
40
  setPrev(prev + 1);
36
41
  const result = res.map((item: any) => {
37
- return { ...item, ['name']: item?.title, id: item?.id.toString() };
42
+ return { ...item, ["name"]: item?.title, id: item?.id.toString() };
38
43
  });
39
44
  return result;
40
45
  });
@@ -43,12 +48,12 @@ export default function App() {
43
48
  <React.Fragment>
44
49
  <div
45
50
  style={{
46
- display: 'flex',
47
- flexDirection: 'column',
51
+ display: "flex",
52
+ flexDirection: "column",
48
53
  gap: 20,
49
54
  padding: 20,
50
55
 
51
- overflowY: 'scroll',
56
+ overflowY: "scroll",
52
57
  }}
53
58
  >
54
59
  <div className="autocomplete-section">
@@ -60,7 +65,7 @@ export default function App() {
60
65
  input while still offering assistance.
61
66
  </p>
62
67
  </div>
63
- <div style={{ width: 300 }}>
68
+ <div style={{ width: 800 }}>
64
69
  <ExpandableAutoComplete
65
70
  label="Auto Suggestion"
66
71
  name="sample"
@@ -75,9 +80,33 @@ export default function App() {
75
80
  itemCount={5}
76
81
  // nextBlock={nexBlock}
77
82
  placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
78
- selectedItems={[{ name: 'test', id: '1' }]}
83
+ selectedItems={[{ name: "test", id: "1" }]}
79
84
  getData={getData}
80
- onChange={(e) => console.log(e, 'onchange')}
85
+ onChange={(e) => console.log(e, "onchange")}
86
+ />
87
+ </div>
88
+ <div style={{ width: 800 }}>
89
+ <AutoCompleteWithTreeStructure
90
+ label="Auto Suggestion"
91
+ name="sample"
92
+ type="custom_select"
93
+ // async
94
+ desc="name"
95
+ isMultiple={true}
96
+ flatArray={true}
97
+ singleSelect={false}
98
+ expandable={true}
99
+ isTreeDropdown={true}
100
+ descId="id"
101
+ data={treeDropData}
102
+ paginationEnabled={false}
103
+ initialLoad={false}
104
+ itemCount={5}
105
+ // nextBlock={nexBlock}
106
+ placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
107
+ selectedItems={[{ name: "test", id: "1" }]}
108
+ // getData={getData}
109
+ onChange={(e) => console.log(e, "onchange")}
81
110
  />
82
111
  </div>
83
112
  <div className="autocomplete-section">
@@ -96,15 +125,15 @@ export default function App() {
96
125
  descId="id"
97
126
  type="custom_select"
98
127
  data={[
99
- { name: 'test', id: '1' },
100
- { name: 'test1', id: '2' },
128
+ { name: "test", id: "1" },
129
+ { name: "test1", id: "2" },
101
130
 
102
- { name: 'test2', id: '3' },
131
+ { name: "test2", id: "3" },
103
132
 
104
- { name: 'test3', id: '4' },
133
+ { name: "test3", id: "4" },
105
134
  ]}
106
135
  // getData={getData}
107
- onChange={() => console.log('onchange')}
136
+ onChange={() => console.log("onchange")}
108
137
  />
109
138
  </div>
110
139
  <div className="autocomplete-section">
@@ -128,7 +157,7 @@ export default function App() {
128
157
  placeholder="Auto Complete"
129
158
  // data={[{ name: 'test', id: '1' }]}
130
159
  getData={getData}
131
- onChange={() => console.log('onchange')}
160
+ onChange={() => console.log("onchange")}
132
161
  />
133
162
  </div>
134
163
  <div style={{ width: 300 }}>
@@ -142,7 +171,7 @@ export default function App() {
142
171
  placeholder="Auto Complete"
143
172
  // data={[{ name: 'test', id: '1' }]}
144
173
  getData={getDatas}
145
- onChange={() => console.log('onchange')}
174
+ onChange={() => console.log("onchange")}
146
175
  />
147
176
  </div>
148
177
  <div className="autocomplete-section">
@@ -164,18 +193,18 @@ export default function App() {
164
193
  descId="id"
165
194
  type="custom_search_select"
166
195
  data={[
167
- { name: 'Apple', id: '1' },
168
- { name: 'Banana', id: '2' },
169
- { name: 'Cherry', id: '3' },
170
- { name: 'Date', id: '4' },
171
- { name: 'Fig', id: '5' },
172
- { name: 'Grape', id: '6' },
173
- { name: 'Honeydew', id: '7' },
174
- { name: 'Kiwi', id: '8' },
175
- { name: 'Lemon', id: '9' },
176
- { name: 'Mango', id: '10' },
196
+ { name: "Apple", id: "1" },
197
+ { name: "Banana", id: "2" },
198
+ { name: "Cherry", id: "3" },
199
+ { name: "Date", id: "4" },
200
+ { name: "Fig", id: "5" },
201
+ { name: "Grape", id: "6" },
202
+ { name: "Honeydew", id: "7" },
203
+ { name: "Kiwi", id: "8" },
204
+ { name: "Lemon", id: "9" },
205
+ { name: "Mango", id: "10" },
177
206
  ]}
178
- onChange={() => console.log('onchange')}
207
+ onChange={() => console.log("onchange")}
179
208
  />
180
209
  </div>
181
210
  <div className="autocomplete-section">
@@ -198,7 +227,7 @@ export default function App() {
198
227
  placeholder="Auto Suggestion"
199
228
  // data={[{ name: 'test', id: '1' }]}
200
229
  getData={getData}
201
- onChange={() => console.log('onchange')}
230
+ onChange={() => console.log("onchange")}
202
231
  />
203
232
  </div>
204
233
  <div style={{ width: 300 }}>
@@ -212,10 +241,10 @@ export default function App() {
212
241
  isMultiple
213
242
  descId="id"
214
243
  placeholder="Auto Suggestion"
215
- selectedItems={[{ name: 'test', id: '1' }]}
244
+ selectedItems={[{ name: "test", id: "1" }]}
216
245
  // data={[{ name: 'test', id: '1' }]}
217
246
  getData={getData}
218
- onChange={(value) => console.log(value, 'onchange')}
247
+ onChange={(value) => console.log(value, "onchange")}
219
248
  />
220
249
  </div>
221
250
  <div style={{ width: 300 }}>
@@ -231,9 +260,9 @@ export default function App() {
231
260
  initialLoad={true}
232
261
  // nextBlock={nexBlock}
233
262
  placeholder="Auto Suggestion"
234
- selectedItems={[{ name: 'test', id: '1' }]}
263
+ selectedItems={[{ name: "test", id: "1" }]}
235
264
  getData={getData}
236
- onChange={(e) => console.log(e, 'onchange')}
265
+ onChange={(e) => console.log(e, "onchange")}
237
266
  />
238
267
  </div>
239
268
 
@@ -261,9 +290,9 @@ export default function App() {
261
290
  itemCount={5}
262
291
  // nextBlock={nexBlock}
263
292
  placeholder="Auto Suggestion Suggestion Suggestion Suggestion"
264
- selectedItems={[{ name: 'test', id: '1' }]}
293
+ selectedItems={[{ name: "test", id: "1" }]}
265
294
  getData={getData}
266
- onChange={(e) => console.log(e, 'onchange')}
295
+ onChange={(e) => console.log(e, "onchange")}
267
296
  />
268
297
  </div>
269
298
  </div>
package/docs/store.ts ADDED
@@ -0,0 +1,67 @@
1
+ export const treeDropData = [
2
+ {
3
+ name: 'Port A - This is the main port in the northern region with significant traffic and operations',
4
+ id: 22,
5
+ parentId: null,
6
+ },
7
+ {
8
+ name: 'Port C - A key sub-port with heavy container traffic in the southern bay area',
9
+ id: 1,
10
+ parentId: 22,
11
+ },
12
+ {
13
+ name: 'Port G - A small port used for local shipments and fishing operations',
14
+ id: 2,
15
+ parentId: 1,
16
+ },
17
+ {
18
+ name: 'Port H - A minor local port focusing on fisheries and small-scale cargo',
19
+ id: 3,
20
+ parentId: 2,
21
+ },
22
+ {
23
+ name: 'Port I - A coastal port for regional trade and tourism operations',
24
+ id: 4,
25
+ parentId: 1,
26
+ },
27
+ {
28
+ name: 'Port J - A harbor for tourist cruises and commercial boats',
29
+ id: 5,
30
+ parentId: 4,
31
+ },
32
+ {
33
+ name: 'Port D - An industrial port dealing with large-scale cargo and ship repair services',
34
+ id: 6,
35
+ parentId: 22,
36
+ },
37
+ {
38
+ name: 'Port K - A dock specializing in shipbuilding and marine repairs',
39
+ id: 7,
40
+ parentId: 6,
41
+ },
42
+ {
43
+ name: 'Port L - A repair facility for both military and commercial vessels',
44
+ id: 8,
45
+ parentId: 7,
46
+ },
47
+ {
48
+ name: 'Port B - This is the largest port in the central region, supporting international trade',
49
+ id: 9,
50
+ parentId: null,
51
+ },
52
+ {
53
+ name: 'Port E - A primary export port dealing with raw materials and heavy goods',
54
+ id: 10,
55
+ parentId: 9,
56
+ },
57
+ {
58
+ name: 'Port M - A small export hub for agricultural and mining products',
59
+ id: 11,
60
+ parentId: 10,
61
+ },
62
+ {
63
+ name: 'Port N - A warehouse and storage center for exported goods',
64
+ id: 12,
65
+ parentId: 11,
66
+ },
67
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-core-ts",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "React Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,13 +38,17 @@
38
38
  "@svgr/webpack": "^8.1.0",
39
39
  "@types/react": "^18.2.24",
40
40
  "@types/react-dom": "^18.2.9",
41
+ "autoprefixer": "^10.4.20",
41
42
  "babel-loader": "^8.3.0",
42
43
  "copy-webpack-plugin": "^11.0.0",
43
44
  "css-loader": "^6.8.1",
44
45
  "file-loader": "^6.2.0",
45
46
  "html-webpack-plugin": "^4.5.2",
46
47
  "mini-css-extract-plugin": "^2.7.6",
48
+ "postcss": "^8.4.47",
49
+ "postcss-loader": "^8.1.1",
47
50
  "style-loader": "^3.3.3",
51
+ "tailwindcss": "^3.4.13",
48
52
  "ts-loader": "^9.4.4",
49
53
  "typescript": "^4.0.0",
50
54
  "webpack": "^5.88.2",
@@ -53,9 +57,6 @@
53
57
  },
54
58
  "dependencies": {
55
59
  "@babel/plugin-transform-typescript": "^7.22.15",
56
- "autoprefixer": "^10.4.16",
57
- "postcss": "^8.4.31",
58
- "source-map-loader": "^4.0.1",
59
- "tailwindcss": "^3.3.3"
60
+ "source-map-loader": "^4.0.1"
60
61
  }
61
62
  }
package/postcss.config.js CHANGED
@@ -1,7 +1,6 @@
1
- // postcss.config.js
2
1
  module.exports = {
3
- plugins: {
4
- tailwindcss: {},
5
- autoprefixer: {},
6
- },
2
+ plugins: [
3
+ require('tailwindcss'),
4
+ require('autoprefixer'),
5
+ ],
7
6
  };