pixel-react 1.4.7 → 1.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/lib/components/Form/Forms.d.ts +3 -1
  3. package/lib/components/Input/Input.d.ts +1 -1
  4. package/lib/components/Input/types.d.ts +4 -0
  5. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +0 -2
  6. package/lib/components/MultiSelect/MultiSelect.stories.d.ts +0 -1
  7. package/lib/components/Select/Select.stories.d.ts +0 -1
  8. package/lib/components/TableTree/TableTree.d.ts +2 -1
  9. package/lib/index.d.ts +10 -3
  10. package/lib/index.esm.js +131 -93
  11. package/lib/index.esm.js.map +1 -1
  12. package/lib/index.js +131 -93
  13. package/lib/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/assets/Themes/BaseTheme.scss +2 -0
  16. package/src/assets/fonts/Poppins-Bold.woff2 +0 -0
  17. package/src/assets/fonts/Poppins-Medium.woff2 +0 -0
  18. package/src/assets/fonts/Poppins-Regular.woff2 +0 -0
  19. package/src/assets/fonts/Poppins-SemiBold.woff2 +0 -0
  20. package/src/assets/icons/Header_preset.svg +13 -0
  21. package/src/assets/icons/add_file.svg +16 -4
  22. package/src/assets/icons/eye_open_icon.svg +2 -9
  23. package/src/assets/icons/replace_icon.svg +6 -0
  24. package/src/assets/styles/_fonts.scss +7 -4
  25. package/src/components/AppHeader/AppHeader.tsx +1 -0
  26. package/src/components/AttachmentButton/AttachmentButton.tsx +10 -5
  27. package/src/components/Form/Form.stories.tsx +4 -8
  28. package/src/components/Form/Forms.tsx +11 -4
  29. package/src/components/Icon/iconList.ts +7 -1
  30. package/src/components/Input/Input.scss +5 -0
  31. package/src/components/Input/Input.stories.tsx +44 -0
  32. package/src/components/Input/Input.tsx +24 -19
  33. package/src/components/Input/types.ts +4 -0
  34. package/src/components/MenuOption/MenuOption.tsx +5 -5
  35. package/src/components/TableTree/TableTree.scss +22 -7
  36. package/src/components/TableTree/TableTree.stories.tsx +41 -0
  37. package/src/components/TableTree/TableTree.tsx +55 -18
  38. package/src/components/Typography/Typography.scss +4 -4
  39. package/lib/assets/fonts/Poppins-Bold.ttf +0 -0
  40. package/lib/assets/fonts/Poppins-Medium.ttf +0 -0
  41. package/lib/assets/fonts/Poppins-Regular.ttf +0 -0
  42. package/lib/assets/fonts/Poppins-SemiBold.ttf +0 -0
  43. package/lib/components/AddButton/AddButton.d.ts +0 -5
  44. package/lib/components/AddButton/AddButton.stories.d.ts +0 -6
  45. package/lib/components/AddButton/index.d.ts +0 -1
  46. package/lib/components/AddButton/types.d.ts +0 -4
  47. package/lib/components/AttachImage/AttachImage.stories.d.ts +0 -7
  48. package/lib/components/Charts/BarChart/BarChart.stories.d.ts +0 -6
  49. package/lib/components/Charts/IconRadialChart/IconRadialChart.stories.d.ts +0 -8
  50. package/lib/components/Charts/LineChart/LineChart.stories.d.ts +0 -7
  51. package/lib/components/Charts/MultiRadialChart/MultiRadialChart.stories.d.ts +0 -8
  52. package/lib/components/ConnectingBranch/ConnectingBranch.stories.d.ts +0 -6
  53. package/lib/components/EditTextField/EditTextField.stories.d.ts +0 -10
  54. package/lib/components/Editor/Editor.stories.d.ts +0 -6
  55. package/lib/components/Excel/ContextMenu/ContextMenu.d.ts +0 -4
  56. package/lib/components/Excel/ExcelFile.stories.d.ts +0 -6
  57. package/lib/components/ExcelFile/ChangeExcelStyles.d.ts +0 -14
  58. package/lib/components/ExcelFile/ImportExcelStyles.d.ts +0 -24
  59. package/lib/components/StatusCard/StatusCard.stories.d.ts +0 -11
  60. package/lib/utils/getSequentialPayload/getSequentialPayload.stories.d.ts +0 -10
  61. /package/lib/components/ExcelFile/{ColorBarSelector → ColorBarselector}/ColorBarSelector.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable */
2
2
  // @ts-nocheck
3
- import React, { ReactNode, useLayoutEffect, useRef, useState } from 'react';
3
+ import React, { ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react';
4
4
  import { prepareData } from '../../utils/TableCell/TableCell';
5
5
  import Icon from '../Icon';
6
6
  import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
@@ -36,6 +36,7 @@ interface TableTreeProps {
36
36
  ) => void;
37
37
  onChange?: (e: any, node: any) => void;
38
38
  selected: Array<string>;
39
+ onPagination?: (node: ObjectProps) => void; // New prop for pagination
39
40
  }
40
41
 
41
42
  const TableTree = ({
@@ -45,10 +46,12 @@ const TableTree = ({
45
46
  onClick = () => {},
46
47
  onChange,
47
48
  selected,
49
+ onPagination,
48
50
  }: TableTreeProps) => {
49
51
  const [expandedNodes, setExpandedNodes] = useState<Set<ObjectProps>>(
50
52
  new Set()
51
53
  );
54
+ const triggeredPaginationNodes = useRef(new Set()); // Tracks nodes for which pagination is triggered
52
55
 
53
56
  useLayoutEffect(() => {
54
57
  const defaultExpanded: Set<ObjectProps> = new Set();
@@ -56,10 +59,8 @@ const TableTree = ({
56
59
  // Recursive function to add nodes and their children to the expanded set
57
60
  const expandNodeRecursively = (node: ObjectProps) => {
58
61
  if (node.expanded) {
59
- // Add the node to the expanded set
60
62
  defaultExpanded.add(node);
61
63
 
62
- // If the node has children, recursively expand them as well
63
64
  if (node.children) {
64
65
  node.children.forEach((child: ObjectProps) =>
65
66
  expandNodeRecursively(child)
@@ -68,20 +69,18 @@ const TableTree = ({
68
69
  }
69
70
  };
70
71
 
71
- // Iterate over the treeData to check which nodes should be expanded
72
72
  treeData.forEach((node) => {
73
73
  expandNodeRecursively(node);
74
74
  });
75
75
 
76
- // Set the expanded nodes state
77
76
  setExpandedNodes(defaultExpanded);
78
77
  }, [treeData]);
78
+
79
79
  // Function to calculate total children height
80
80
  const calculateTotalChildrenHeight = (node: any): number => {
81
81
  if (!node.children || node.children.length === 0) {
82
82
  return 1;
83
83
  }
84
- // Start with 1 for the current node and node itself is included in the height calculation before considering its children.
85
84
  let totalHeight = 1;
86
85
  if (expandedNodes.has(node)) {
87
86
  node.children.forEach((child: any) => {
@@ -93,30 +92,22 @@ const TableTree = ({
93
92
 
94
93
  const TreeNode = ({ node, level, isLast }: any) => {
95
94
  const nodeRef = useRef<HTMLTableRowElement | null>(null);
95
+ const lastChildRef = useRef<HTMLTableRowElement | null>(null); // Ref for pagination
96
96
  const [nodeHeight, setNodeHeight] = useState<number>(0);
97
97
  const [totalChildrenHeight, setTotalChildrenHeight] = useState<number>(0);
98
98
 
99
99
  const isExpanded = expandedNodes.has(node);
100
100
 
101
- const handleCheckBoxChange = (e, node) => {
102
- if (onChange) {
103
- onChange(e, node);
104
- }
105
- };
106
-
107
101
  useLayoutEffect(() => {
108
102
  if (nodeRef.current) {
109
103
  const observer = new ResizeObserver(() => {
110
- // Update nodeHeight when the size of the element changes
111
104
  const currentHeight = nodeRef.current?.offsetHeight || 0;
112
105
  setNodeHeight(currentHeight);
113
106
 
114
- // Calculate total children height
115
107
  const childrenHeight = calculateTotalChildrenHeight(node);
116
108
  setTotalChildrenHeight(childrenHeight);
117
109
  });
118
110
 
119
- // Start observing the current node
120
111
  observer.observe(nodeRef.current);
121
112
 
122
113
  return () => {
@@ -125,6 +116,30 @@ const TableTree = ({
125
116
  }
126
117
  }, [isExpanded, node]);
127
118
 
119
+ useEffect(() => {
120
+ if (!isExpanded || !lastChildRef.current || !onPagination) return;
121
+
122
+ const observer = new IntersectionObserver(
123
+ (entries) => {
124
+ if (
125
+ entries[0].isIntersecting &&
126
+ !triggeredPaginationNodes.current.has(node.key)
127
+ ) {
128
+ triggeredPaginationNodes.current.add(node.key); // Mark node as paginated
129
+ onPagination(node); // Trigger the pagination callback
130
+ }
131
+ },
132
+ {
133
+ root: null, // Use the viewport as the root
134
+ threshold: 1.0, // Trigger when fully visible
135
+ }
136
+ );
137
+
138
+ observer.observe(lastChildRef.current);
139
+
140
+ return () => observer.disconnect();
141
+ }, [isExpanded, onPagination, node]);
142
+
128
143
  const handleToggleExpand = () => {
129
144
  setExpandedNodes((prev) => {
130
145
  const newExpandedNodes = new Set(prev);
@@ -136,6 +151,13 @@ const TableTree = ({
136
151
  return newExpandedNodes;
137
152
  });
138
153
  };
154
+
155
+ const handleCheckBoxChange = (e, node) => {
156
+ if (onChange) {
157
+ onChange(e, node);
158
+ }
159
+ };
160
+
139
161
  const renderRowData = (columnsData: any) => {
140
162
  return columnsData.map((column: any) => {
141
163
  if (column.accessor === 'title') {
@@ -166,7 +188,6 @@ const TableTree = ({
166
188
  )}
167
189
  {select === 'radio' && (
168
190
  <RadioButton
169
- // checked={selected.includes(node.key)}
170
191
  name={node.title}
171
192
  value={node.key}
172
193
  onChange={(e) => handleCheckBoxChange(e, node)}
@@ -194,6 +215,23 @@ const TableTree = ({
194
215
  }
195
216
  });
196
217
  };
218
+
219
+ const renderTree = (nodes: any, level = 0) => {
220
+ return nodes.map((childNode: any, index: number) => {
221
+ const isChildLast = index === nodes.length - 1;
222
+ const ref = isChildLast ? lastChildRef : null;
223
+ return (
224
+ <TreeNode
225
+ key={childNode.key || index}
226
+ node={childNode}
227
+ level={level}
228
+ isLast={isChildLast}
229
+ ref={ref}
230
+ />
231
+ );
232
+ });
233
+ };
234
+
197
235
  return (
198
236
  <>
199
237
  <tr
@@ -214,7 +252,6 @@ const TableTree = ({
214
252
  {renderRowData(columnsData)}
215
253
  </tr>
216
254
 
217
- {/* Render children only if the node is expanded */}
218
255
  {isExpanded &&
219
256
  !checkEmpty(node?.children) &&
220
257
  renderTree(node.children, level + 1)}
@@ -225,7 +262,7 @@ const TableTree = ({
225
262
  const renderTree = (nodes: any, level = 0) => {
226
263
  return nodes.map((node: any, index: number) => {
227
264
  const isLast = index === nodes.length - 1;
228
- return <TreeNode key={index} node={node} level={level} isLast={isLast} />;
265
+ return <TreeNode key={node.key || index} node={node} level={level} isLast={isLast} />;
229
266
  });
230
267
  };
231
268
 
@@ -8,7 +8,7 @@
8
8
  font-weight: 400;
9
9
  src:
10
10
  local('Poppins-Regular'),
11
- url(../../fonts/Poppins/Poppins-Regular.ttf) format('truetype');
11
+ url(../../fonts/Poppins/Poppins-Regular.woff2) format('woff2');
12
12
  }
13
13
 
14
14
  @font-face {
@@ -16,7 +16,7 @@
16
16
  font-weight: 500;
17
17
  src:
18
18
  local('Poppins-Medium'),
19
- url(../../fonts/Poppins/Poppins-Medium.ttf) format('truetype');
19
+ url(../../fonts/Poppins/Poppins-Medium.woff2) format('woff2');
20
20
  }
21
21
 
22
22
  @font-face {
@@ -24,7 +24,7 @@
24
24
  font-weight: 600;
25
25
  src:
26
26
  local('Poppins-SemiBold'),
27
- url(../../fonts/Poppins/Poppins-SemiBold.ttf) format('truetype');
27
+ url(../../fonts/Poppins/Poppins-SemiBold.woff2) format('woff2');
28
28
  }
29
29
 
30
30
  @font-face {
@@ -32,7 +32,7 @@
32
32
  font-weight: 700;
33
33
  src:
34
34
  local('Poppins-Bold'),
35
- url(../../fonts/Poppins/Poppins-Bold.ttf) format('truetype');
35
+ url(../../fonts/Poppins/Poppins-Bold.woff2) format('woff2');
36
36
  }
37
37
 
38
38
  .ff-text {
Binary file
Binary file
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import './AddButton.scss';
3
- import { AddButtonProps } from './types';
4
- declare const AddButton: React.FC<AddButtonProps>;
5
- export default AddButton;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import AddButton from './AddButton';
3
- declare const meta: Meta<typeof AddButton>;
4
- type Story = StoryObj<typeof AddButton>;
5
- export declare const PrimaryAddButton: Story;
6
- export default meta;
@@ -1 +0,0 @@
1
- export { default } from './AddButton';
@@ -1,4 +0,0 @@
1
- export interface AddButtonProps {
2
- name: string;
3
- onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
4
- }
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import AttachImage from './AttachImage';
3
- import { AttachImageProps } from './types';
4
- declare const meta: Meta<typeof AttachImage>;
5
- export default meta;
6
- type Story = StoryObj<AttachImageProps>;
7
- export declare const Default: Story;
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import BarChart from './BarChart';
3
- declare const meta: Meta<typeof BarChart>;
4
- export default meta;
5
- type Story = StoryObj<typeof BarChart>;
6
- export declare const BarChartDashboard: Story;
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import IconRadialChart from './IconRadialChart';
3
- declare const meta: Meta<typeof IconRadialChart>;
4
- export default meta;
5
- type Story = StoryObj<typeof IconRadialChart>;
6
- export declare const Default: Story;
7
- export declare const Mobile: Story;
8
- export declare const WithoutIcon: Story;
@@ -1,7 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import LineChart from './LineChart';
3
- import { LineChartProps } from './types';
4
- declare const meta: Meta<typeof LineChart>;
5
- export default meta;
6
- export declare const DefaultLineChart: StoryObj<LineChartProps>;
7
- export declare const StatusLineChart: StoryObj<LineChartProps>;
@@ -1,8 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import MultiRadialChart from './MultiRadialChart';
3
- declare const meta: Meta<typeof MultiRadialChart>;
4
- export default meta;
5
- type Story = StoryObj<typeof MultiRadialChart>;
6
- export declare const Default: Story;
7
- export declare const numberLegend: Story;
8
- export declare const PillLegend: Story;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import ConnectingBranch from './ConnectingBranch';
3
- declare const meta: Meta<typeof ConnectingBranch>;
4
- export default meta;
5
- type Story = StoryObj<typeof ConnectingBranch>;
6
- export declare const Default: Story;
@@ -1,10 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import EditTextField from './EditTextField';
3
- import '../../assets/styles/_colors.scss';
4
- import './EditTextField.scss';
5
- declare const meta: Meta<typeof EditTextField>;
6
- type Story = StoryObj<typeof EditTextField>;
7
- export declare const textFieldWithLabel: Story;
8
- export declare const textFieldWithOutLabel: Story;
9
- export declare const openTextField: Story;
10
- export default meta;
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { EditorProps } from './types';
3
- declare const meta: Meta<EditorProps>;
4
- export default meta;
5
- type Story = StoryObj<EditorProps>;
6
- export declare const Default: Story;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import './ContextMenu.scss';
3
- declare const ContextMenu: React.FC<ContextMenuProps>;
4
- export default ContextMenu;
@@ -1,6 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import ExcelFile from './ExcelFile/ExcelFile';
3
- declare const meta: Meta<typeof ExcelFile>;
4
- type Story = StoryObj<typeof ExcelFile>;
5
- export declare const Default: Story;
6
- export default meta;
@@ -1,14 +0,0 @@
1
- import { CellBase } from "./ExcelFile/Excel";
2
- interface ChangeExcelStylesOptions {
3
- sheetName: string;
4
- styleType: string;
5
- value: string;
6
- selectedCell: {
7
- row: number;
8
- column: number;
9
- }[];
10
- }
11
- export default function ChangeExcelStyles(setWorksheetsData: React.Dispatch<React.SetStateAction<{
12
- [key: string]: Matrix<CellBase>;
13
- }>>, options: ChangeExcelStylesOptions): void;
14
- export {};
@@ -1,24 +0,0 @@
1
- interface CellStyle {
2
- color?: string;
3
- backgroundColor?: string;
4
- bold?: boolean;
5
- italic?: boolean;
6
- name?: string;
7
- border: {
8
- top: string;
9
- bottom: string;
10
- left: string;
11
- right: string;
12
- };
13
- alignment: {
14
- horizontal?: string;
15
- vertical?: string;
16
- wrapText?: boolean;
17
- };
18
- }
19
- interface CellData {
20
- style?: CellStyle;
21
- }
22
- type ImportExcelStylesData = Array<Array<CellData>>;
23
- export default function ImportExcelStyles(data: ImportExcelStylesData | null): void;
24
- export {};
@@ -1,11 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import Card from './StatusCard';
3
- import { CardProps } from './types';
4
- declare const meta: Meta<typeof Card>;
5
- export default meta;
6
- type Story = StoryObj<CardProps>;
7
- export declare const Passed: Story;
8
- export declare const Failed: Story;
9
- export declare const Warning: Story;
10
- export declare const Skipped: Story;
11
- export declare const Flaky: Story;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import { MachineExecutionInstanceDataSet } from './types';
4
- declare const SequentialPayloadComponent: React.FC<{
5
- machineInstances: MachineExecutionInstanceDataSet[];
6
- }>;
7
- declare const meta: Meta<typeof SequentialPayloadComponent>;
8
- type Story = StoryObj<typeof SequentialPayloadComponent>;
9
- export declare const Primary: Story;
10
- export default meta;