react-core-ts 1.0.23 → 1.0.24

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/AutoCompleteWithTreeStructure.d.ts +4 -0
  2. package/dist/AutoCompleteWithTreeStructure.js +453 -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 +3 -2
  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/filterSuggestions.d.ts +1 -1
  27. package/dist/utilities/filterSuggestions.js +4 -3
  28. package/dist/utilities/filterSuggestions.js.map +1 -1
  29. package/docs/App.tsx +64 -36
  30. package/docs/store.ts +76 -0
  31. package/package.json +6 -5
  32. package/postcss.config.js +4 -5
  33. package/src/AutoCompleteWithTreeStructure.tsx +638 -0
  34. package/src/ExpandableAutoComplete.tsx +83 -144
  35. package/src/commontypes.ts +6 -5
  36. package/src/components/DropdownList.tsx +70 -0
  37. package/src/components/Icons.tsx +38 -0
  38. package/src/components/InputActions.tsx +63 -0
  39. package/src/components/TreeNode.tsx +79 -0
  40. package/src/index.tsx +11 -8
  41. package/src/styles/global.css +4 -0
  42. package/src/utilities/filterSuggestions.ts +5 -3
  43. package/tailwind.config.js +15 -0
  44. package/webpack.config.js +17 -3
@@ -0,0 +1,79 @@
1
+ import React from "react";
2
+ import { DropSideIcon } from "./Icons";
3
+
4
+ const TreeNode: React.FC<any> = ({
5
+ node,
6
+ isMultiple,
7
+ singleSelect,
8
+ idx,
9
+ desc,
10
+ toggleExpand,
11
+ updateNode,
12
+ children,
13
+ descId,
14
+ }) => {
15
+ // Toggle the expanded state when clicking on the node
16
+ const handleToggle = (node?: any) => {
17
+ console.log(node, "node");
18
+ toggleExpand(node[descId]);
19
+ };
20
+
21
+ const handleCheckbox = (e: any, dataItem: any) => {
22
+ const { checked } = e.target;
23
+ updateNode(dataItem[descId], checked);
24
+ };
25
+ return (
26
+ <div>
27
+ <li className="flex flex-col">
28
+ <div
29
+ style={{ display: "flex" }}
30
+ className={`items-start gap-4 flex-row ${
31
+ node?.children?.length > 0 ? "" : "ml-5"
32
+ }`}
33
+ >
34
+ {/* Show an icon based on the expanded/collapsed state */}
35
+
36
+ {node?.children && node?.children?.length > 0 && (
37
+ <span
38
+ onClick={() => handleToggle(node)}
39
+ className={`mt-1 cursor-pointer ${
40
+ node.expanded ? " rotate-90" : ""
41
+ }`}
42
+ >
43
+ <DropSideIcon />
44
+ </span>
45
+ )}
46
+ {(isMultiple || singleSelect) && (
47
+ <div className="qbs-autocomplete-checkbox">
48
+ <input
49
+ onChange={(e) => handleCheckbox(e, node)} // Pass correct node to the handler
50
+ type="checkbox"
51
+ checked={node.checked}
52
+ id={`qbs-checkbox-${idx.toString()}`}
53
+ />
54
+ <label htmlFor={`qbs-checkbox-${idx.toString()}`}>
55
+ <svg
56
+ width="8"
57
+ height="6"
58
+ viewBox="0 0 8 6"
59
+ fill="none"
60
+ xmlns="http://www.w3.org/2000/svg"
61
+ >
62
+ <path
63
+ d="M0 3.21739L2.89883 6L8 1.06994L6.89494 0L2.89883 3.86768L1.09728 2.14745L0 3.21739Z"
64
+ fill="white"
65
+ />
66
+ </svg>
67
+ </label>
68
+ </div>
69
+ )}
70
+ <span className=" leading-[18px]">{node[desc]}</span>
71
+ </div>
72
+ </li>
73
+
74
+ {children}
75
+ </div>
76
+ );
77
+ };
78
+
79
+ export default TreeNode;
package/src/index.tsx CHANGED
@@ -1,9 +1,12 @@
1
- import './styles/global.css';
1
+ import "./styles/global.css";
2
2
 
3
- export { default as AutoComplete } from './AutoComplete';
4
- export { default as CustomAutoComplete } from './AutoComplete';
5
- export { default as ExpandableAutoComplete } from './ExpandableAutoComplete';
6
- export { default as ExpandableToolTip } from './utilities/expandableTootltip';
7
- export { default as ToolTip } from './utilities/tooltip';
8
- export { deepEqual } from './utilities/deepEqual';
9
- export type { AutoSuggestionInputProps } from './commontypes';
3
+ export {
4
+ default as AutoComplete,
5
+ default as CustomAutoComplete,
6
+ } from "./AutoComplete";
7
+ export { default as AutoCompleteWithTreeStructure } from "./AutoCompleteWithTreeStructure";
8
+ export type { AutoSuggestionInputProps } from "./commontypes";
9
+ export { default as ExpandableAutoComplete } from "./ExpandableAutoComplete";
10
+ export { deepEqual } from "./utilities/deepEqual";
11
+ export { default as ExpandableToolTip } from "./utilities/expandableTootltip";
12
+ export { default as ToolTip } from "./utilities/tooltip";
@@ -1 +1,5 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
1
5
  @import './components/autocomplete.css';
@@ -8,20 +8,22 @@ export const filterSuggestions = (
8
8
  type: string,
9
9
  desc: string,
10
10
  inputValue?: string,
11
- async?: boolean
11
+ async?: boolean,
12
+ isTreeDropdown?: boolean
12
13
  ): Item[] => {
13
14
  if (
14
15
  (type === 'custom_search_select' ||
15
16
  type === 'auto_complete' ||
16
17
  type === 'auto_suggestion') &&
17
18
  !async &&
18
- query
19
+ query &&
20
+ !isTreeDropdown
19
21
  ) {
20
22
  return data?.filter((item) =>
21
23
  item[desc].toLowerCase().includes(query.toLowerCase())
22
24
  );
23
25
  }
24
- return sortedArrayData(data, inputValue, desc);
26
+ return isTreeDropdown ? data : sortedArrayData(data, inputValue, desc);
25
27
  };
26
28
 
27
29
  const sortedArrayData = (
@@ -0,0 +1,15 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ content: [],
4
+ purge: ['./src/**/*.{js,jsx,ts,tsx}', './docs/**/*.{html,js}'],
5
+ theme: {
6
+ extend: {
7
+ colors: {
8
+ 'blue-navy': '#001f3f',
9
+ 'table-hover': '#f8f8f8',
10
+ 'neutrals-grey-20': '#f4f4f4',
11
+ },
12
+ },
13
+ },
14
+ plugins: [],
15
+ };
package/webpack.config.js CHANGED
@@ -4,7 +4,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
4
4
 
5
5
  module.exports = {
6
6
  //...
7
- entry: './docs',
7
+ entry: ['./docs', './src/styles/global.css'],
8
8
  devtool: 'source-map',
9
9
  devServer: {
10
10
  contentBase: './docs',
@@ -15,11 +15,25 @@ module.exports = {
15
15
  },
16
16
  module: {
17
17
  rules: [
18
+ // {
19
+ // test: /\.css$/i,
20
+ // use: [MiniCssExtractPlugin.loader, 'css-loader'],
21
+ // },
18
22
  {
19
23
  test: /\.css$/i,
20
- use: [MiniCssExtractPlugin.loader, 'css-loader'],
24
+ use: [
25
+ MiniCssExtractPlugin.loader,
26
+ 'css-loader',
27
+ {
28
+ loader: 'postcss-loader',
29
+ options: {
30
+ postcssOptions: {
31
+ plugins: ['tailwindcss', 'autoprefixer'],
32
+ },
33
+ },
34
+ },
35
+ ],
21
36
  },
22
-
23
37
  {
24
38
  test: /\.tsx?$/,
25
39
  exclude: (file) =>