pixel-react-excel-sheet 1.0.29 → 1.0.31

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 (29) hide show
  1. package/lib/components/Charts/BarChart/BarChart.d.ts +1 -0
  2. package/lib/components/MenuOption/types.d.ts +1 -1
  3. package/lib/components/PopUpModal/types.d.ts +2 -1
  4. package/lib/components/StatusCard/types.d.ts +7 -1
  5. package/lib/index.d.ts +11 -3
  6. package/lib/index.esm.js +87 -74
  7. package/lib/index.esm.js.map +1 -1
  8. package/lib/index.js +87 -74
  9. package/lib/index.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/components/Charts/BarChart/BarChart.stories.tsx +3 -0
  12. package/src/components/Charts/BarChart/BarChart.tsx +7 -0
  13. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.scss +4 -0
  14. package/src/components/Charts/DashboardDonutChart/DashboardDonutChart.tsx +1 -1
  15. package/src/components/Excel/ExcelFile/ExcelFileComponents/ColumnIndicator.tsx +10 -27
  16. package/src/components/Excel/ExcelFile/ExcelFileComponents/RowIndicator.tsx +1 -5
  17. package/src/components/Excel/ExcelFile/ExcelFileComponents/Spreadsheet.scss +4 -3
  18. package/src/components/Excel/ExcelToolBar/ExcelToolBar.tsx +35 -27
  19. package/src/components/MenuOption/MenuOption.stories.tsx +2 -3
  20. package/src/components/MenuOption/MenuOption.tsx +9 -2
  21. package/src/components/MenuOption/types.ts +1 -1
  22. package/src/components/PopUpModal/types.ts +4 -3
  23. package/src/components/Search/Search.stories.tsx +1 -2
  24. package/src/components/Search/Search.tsx +1 -3
  25. package/src/components/StatusCard/StatusCard.scss +47 -4
  26. package/src/components/StatusCard/StatusCard.stories.tsx +1 -0
  27. package/src/components/StatusCard/StatusCard.tsx +28 -5
  28. package/src/components/StatusCard/types.ts +15 -10
  29. package/src/components/Toastify/Toastify.tsx +1 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pixel-react-excel-sheet",
3
3
  "description": "Great for pixel-perfect, design-focused components in React",
4
- "version": "1.0.29",
4
+ "version": "1.0.31",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.esm.js",
7
7
  "types": "lib/index.d.ts",
@@ -63,5 +63,8 @@ export const BarChartDashboard: Story = {
63
63
  'opera',
64
64
  ],
65
65
  iconSize: 20,
66
+ onSelectedBar: (label) => {
67
+ console.log(label);
68
+ },
66
69
  },
67
70
  };
@@ -22,6 +22,7 @@ type BarChartProps = {
22
22
  backgroundColor?: string;
23
23
  legendPosition?: 'top' | 'bottom';
24
24
  legendGap?: number;
25
+ onSelectedBar?: (_label: string) => void;
25
26
  };
26
27
 
27
28
  const BarChart: React.FC<BarChartProps> = ({
@@ -41,6 +42,7 @@ const BarChart: React.FC<BarChartProps> = ({
41
42
  iconSize,
42
43
  legendPosition = 'bottom',
43
44
  legendGap = 5,
45
+ onSelectedBar = (_label) => {},
44
46
  }) => {
45
47
  const [tooltip, setTooltip] = useState<{
46
48
  visible: boolean;
@@ -120,6 +122,10 @@ const BarChart: React.FC<BarChartProps> = ({
120
122
  });
121
123
  };
122
124
 
125
+ const handleSelectLabel = (label: string) => {
126
+ onSelectedBar(label);
127
+ };
128
+
123
129
  return (
124
130
  <div className="ff-bar-chart-container" style={{ width: chartWidth }}>
125
131
  {legend && legendPosition === 'top' && (
@@ -232,6 +238,7 @@ const BarChart: React.FC<BarChartProps> = ({
232
238
  }
233
239
  onMouseMove={handleMouseMove}
234
240
  onMouseLeave={handleMouseLeave}
241
+ onClick={() => handleSelectLabel(item.label)}
235
242
  ></rect>
236
243
 
237
244
  {showXAxisLabels && (
@@ -111,6 +111,10 @@
111
111
  border-collapse: collapse;
112
112
  text-align: left;
113
113
 
114
+ .ff-legend-table-thead {
115
+ position: static;
116
+ top: auto;
117
+ }
114
118
  .ff-table-header {
115
119
  @extend .fontXs;
116
120
  font-weight: bold;
@@ -314,7 +314,7 @@ const DashboardDonutChart: React.FC<DashboardDonutChartProps> = ({
314
314
  return (
315
315
  <div className="ff-legend-table-wrapper">
316
316
  <table className="ff-legend-table">
317
- <thead>
317
+ <thead className='ff-legend-table-thead'>
318
318
  <tr>
319
319
  <th className="ff-table-header" style={{ width: tableWidth }}>
320
320
  Name
@@ -5,6 +5,7 @@ import * as Point from './point';
5
5
  import * as Actions from './actions';
6
6
  import useDispatch from './use-dispatch';
7
7
  import useSelector from './use-selector';
8
+ import Typography from '../../../Typography';
8
9
 
9
10
  const ColumnIndicator: Types.ColumnIndicatorComponent = ({
10
11
  column,
@@ -104,15 +105,22 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
104
105
 
105
106
  return (
106
107
  <th
107
- style={{ minWidth: `${columnWidth}px`}} //Dynamic value, Inline Styling required
108
108
  className={classNames('ff-spreadsheet-header', {
109
109
  'ff-spreadsheet-header--selected': selected,
110
110
  })}
111
+ style={{ minWidth: `${columnWidth}px` }} //Dynamic value, Inline Styling required
111
112
  onClick={handleClick}
112
113
  onContextMenu={contextClick}
113
114
  tabIndex={0}
114
115
  >
115
- {label !== undefined ? label : columnIndexToLabel(column)}
116
+ <div
117
+ onClick={handleClick}
118
+ onContextMenu={contextClick}
119
+ tabIndex={0}
120
+ ></div>
121
+ <Typography fontWeight="medium">
122
+ {label !== undefined ? label : columnIndexToLabel(column)}
123
+ </Typography>
116
124
  <div
117
125
  onMouseDown={onMouseDown}
118
126
  onClick={() => activate({ row: -1, column })}
@@ -127,31 +135,6 @@ const ColumnIndicator: Types.ColumnIndicatorComponent = ({
127
135
  }}
128
136
  />
129
137
  </th>
130
-
131
- // <th
132
- // style={{ minWidth: `${columnWidth}px`}} //Dynamic value, Inline Styling required
133
- // className={classNames('ff-spreadsheet-header', {
134
- // 'ff-spreadsheet-header--selected': selected,
135
- // })}
136
- // onClick={handleClick}
137
- // onContextMenu={contextClick}
138
- // tabIndex={0}
139
- // >
140
- // {label !== undefined ? label : columnIndexToLabel(column)}
141
- // <div
142
- // onMouseDown={onMouseDown}
143
- // onClick={() => activate({ row: -1, column })}
144
- // style={{
145
- // zIndex: 'inherit',
146
- // width: '2px',
147
- // position: 'absolute',
148
- // right: 0,
149
- // top: 0,
150
- // height: '100%',
151
- // cursor: 'ew-resize',
152
- // }}
153
- // />
154
- // </th>
155
138
  );
156
139
  };
157
140
 
@@ -103,14 +103,10 @@ const RowIndicator: Types.RowIndicatorComponent = ({
103
103
 
104
104
  return (
105
105
  <th
106
- style={{
107
- height: `${rowHeight}px`,
108
- minWidth: '60px',
109
- position: 'relative',
110
- }} //Dynamic value, Inline Styling required
111
106
  className={classNames('ff-spreadsheet-header', {
112
107
  'ff-spreadsheet-header--selected': selected,
113
108
  })}
109
+ style={{ height: `${rowHeight}px`, minWidth: '60px' }} //Dynamic value, Inline Styling required
114
110
  onClick={handleClick}
115
111
  onContextMenu={contextClick}
116
112
  tabIndex={0}
@@ -93,20 +93,21 @@
93
93
  text-align: center;
94
94
  z-index: 1000;
95
95
  position: sticky;
96
+ top: 0;
97
+ left: 0;
96
98
  }
97
99
 
98
100
  .ff-spreadsheet-corner-header {
99
101
  position: fixed;
100
- z-index: 2000;
102
+ z-index: 3000;
101
103
  }
102
104
 
103
105
  .ff-spreadsheet-row-header {
104
- // position: relative;
105
106
  height: 34px;
106
107
  }
107
108
 
108
109
  .corner-header {
109
- border: 0.1px solid var(--border-color);
110
+ border: 1px solid var(--border-color);
110
111
  background-color: var(--header-background-color);
111
112
  position: absolute;
112
113
  display: flex;
@@ -1,4 +1,4 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useEffect, useRef, useState } from 'react';
2
2
  import './ExcelToolBar.scss';
3
3
  import MenuOption from '../../MenuOption';
4
4
  import Tooltip from '../../Tooltip';
@@ -69,6 +69,8 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
69
69
  };
70
70
 
71
71
  const [cellStyle, setCellStyle] = useState(cell?.style || basicStyle);
72
+ const underLineMenuRef = useRef<HTMLSpanElement>(null);
73
+ const borderMenuRef = useRef<HTMLSpanElement>(null);
72
74
 
73
75
  useEffect(() => {
74
76
  setCellStyle(cell?.style || basicStyle);
@@ -315,19 +317,22 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
315
317
  onClick={() => setUnderlineType(data, underLine, true)}
316
318
  name={getUnderlineIcon()}
317
319
  />
318
- <MenuOption
319
- iconName="arrow_down"
320
- zIndex={1000}
321
- iconSize={12}
322
- options={underlineTypeIcon}
323
- tooltipPlacement="top"
324
- variant="light"
325
- onOptionClick={(e) => {
326
- let selectedValue = e.value as string;
327
- setUnderlineType(data, selectedValue, true);
328
- setUnderLine(selectedValue);
329
- }}
330
- />
320
+ <span ref={underLineMenuRef}>
321
+ <MenuOption
322
+ targetRef={underLineMenuRef}
323
+ iconName="arrow_down"
324
+ zIndex={1000}
325
+ iconSize={12}
326
+ options={underlineTypeIcon}
327
+ tooltipPlacement="top"
328
+ variant="light"
329
+ onOptionClick={(e) => {
330
+ let selectedValue = e.value as string;
331
+ setUnderlineType(data, selectedValue, true);
332
+ setUnderLine(selectedValue);
333
+ }}
334
+ />
335
+ </span>
331
336
  </div>
332
337
  </Tooltip>
333
338
  </div>
@@ -391,19 +396,22 @@ const ExcelToolBar: React.FC<ExcelToolBarProps> = ({
391
396
  onClick={() => setBorderType(data, border, 'black')}
392
397
  name={getBorderIcon()}
393
398
  />
394
- <MenuOption
395
- iconName="arrow_down"
396
- iconSize={12}
397
- zIndex={1000}
398
- options={borderTypeIcon}
399
- tooltipPlacement="top"
400
- variant="light"
401
- onOptionClick={(e) => {
402
- let selectedValue = e.value as string;
403
- setBorderType(data, selectedValue, 'black');
404
- setBorder(selectedValue);
405
- }}
406
- />
399
+ <span ref={borderMenuRef}>
400
+ <MenuOption
401
+ iconName="arrow_down"
402
+ targetRef={borderMenuRef}
403
+ iconSize={12}
404
+ zIndex={1000}
405
+ options={borderTypeIcon}
406
+ tooltipPlacement="top"
407
+ variant="light"
408
+ onOptionClick={(e) => {
409
+ let selectedValue = e.value as string;
410
+ setBorderType(data, selectedValue, 'black');
411
+ setBorder(selectedValue);
412
+ }}
413
+ />
414
+ </span>
407
415
  </div>
408
416
  </Tooltip>
409
417
  </div>
@@ -135,13 +135,12 @@ export const MenuOptionBottom: Story = {
135
135
  dropdownPlacement: 'down',
136
136
  },
137
137
  render: (args) => {
138
- const moreRef = useRef<HTMLDivElement>(null);
139
138
  return (
140
- <div ref={moreRef}>
139
+ <div id="more">
141
140
  <MenuOption
142
141
  {...args}
143
142
  options={options}
144
- targetRef={moreRef}
143
+ targetRef={'more'}
145
144
  onOptionClick={handleOptionClick}
146
145
  />
147
146
  </div>
@@ -153,9 +153,15 @@ const MenuOption = ({
153
153
  };
154
154
 
155
155
  const calculateDims = () => {
156
- if (targetRef?.current) {
157
- const rect = targetRef.current.getBoundingClientRect();
156
+ let targetElement: HTMLElement | null = null;
157
+ if (typeof targetRef === 'string') {
158
+ targetElement = document.getElementById(targetRef);
159
+ } else if (targetRef && targetRef.current) {
160
+ targetElement = targetRef.current;
161
+ }
158
162
 
163
+ if (targetElement) {
164
+ const rect = targetElement.getBoundingClientRect();
159
165
  setMenuPosition({
160
166
  top: rect.top + window.scrollY,
161
167
  left: rect.left + window.scrollX,
@@ -164,6 +170,7 @@ const MenuOption = ({
164
170
  });
165
171
  }
166
172
  };
173
+
167
174
  return (
168
175
  <div className="ff-menu-option-container" ref={menuRef}>
169
176
  <Tooltip title={tooltipTitle} placement={tooltipPlacement}>
@@ -208,7 +208,7 @@ interface MenuOptionProps {
208
208
  * @optional
209
209
  */
210
210
  optionCardVariant?: 'primary';
211
- targetRef?: React.RefObject<HTMLElement>;
211
+ targetRef?: string | React.RefObject<HTMLElement>;
212
212
  }
213
213
 
214
214
  interface OptionProps {
@@ -5,12 +5,13 @@ export interface PopUpModalProps {
5
5
  titleMessage: string;
6
6
  subTitleMessage?: string;
7
7
  iconName: string;
8
- modalMessage: string;
8
+ modalMessage: string | React.ReactNode;
9
+ secondaryMessage?: string | React.ReactNode;
9
10
  firstButtonLabel?: string;
10
11
  secondButtonLabel: string;
11
12
  buttonVariant: any;
12
13
  border: string;
13
- popupWidth?:string,
14
+ popupWidth?: string;
14
15
  colorForTitleMessage?: string;
15
- footerContent?:React.ReactNode;
16
+ footerContent?: React.ReactNode;
16
17
  }
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import Search from './Search';
3
- import React,{ useState } from 'react';
3
+ import React, { useState } from 'react';
4
4
  const meta: Meta<typeof Search> = {
5
5
  title: 'Components/Search',
6
6
  component: Search,
@@ -17,7 +17,6 @@ export const Default: Story = {
17
17
  const [searchValue, setSearchValue] = useState('');
18
18
 
19
19
  const handleSearch = (value: string) => {
20
- alert(`Searching for: ${value}`);
21
20
  setSearchValue(value);
22
21
  };
23
22
 
@@ -57,9 +57,7 @@ const Search = ({
57
57
  };
58
58
  const handleChange = (data: string) => {
59
59
  setSearchValue(data);
60
- if (data === '') {
61
- onSearch('');
62
- }
60
+ onSearch(data);
63
61
  };
64
62
 
65
63
  return (
@@ -1,6 +1,5 @@
1
1
  .ff-card-container {
2
- width: 120px;
3
- height: 93px;
2
+ height: 78px;
4
3
  display: flex;
5
4
  align-items: center;
6
5
  border: 1px solid var(--border-color);
@@ -31,14 +30,14 @@
31
30
  }
32
31
 
33
32
  .ff-status-bar {
34
- width: 24px;
33
+ width: 12%;
35
34
  height: 100%;
36
35
  display: flex;
37
36
  flex-direction: column;
38
37
  justify-content: start;
39
38
  align-items: center;
40
39
  border-right: 1px solid var(--border-color);
41
- gap: 30px;
40
+ gap: 17px;
42
41
 
43
42
  .ff-status-text {
44
43
  transform: rotate(-90deg);
@@ -49,18 +48,23 @@
49
48
 
50
49
  &.passed .ff-status-bar {
51
50
  background-color: var(--ff-card-passed-status-bg-color);
51
+ color: var(--base-bg-color);
52
52
  }
53
53
  &.failed .ff-status-bar {
54
54
  background-color: var(--ff-card-failed-status-bg-color);
55
+ color: var(--base-bg-color);
55
56
  }
56
57
  &.warning .ff-status-bar {
57
58
  background-color: var(--ff-card-warning-status-bg-color);
59
+ color: var(--base-bg-color);
58
60
  }
59
61
  &.skipped .ff-status-bar {
60
62
  background-color: var(--ff-card-skipped-status-bg-color);
63
+ color: var(--base-bg-color);
61
64
  }
62
65
  &.flaky .ff-status-bar {
63
66
  background-color: var(--ff-card-flaky-status-bg-color);
67
+ color: var(--base-bg-color);
64
68
  }
65
69
 
66
70
  .ff-content {
@@ -91,4 +95,43 @@
91
95
  &.flaky .ff-number {
92
96
  color: var(--ff-card-flaky-status-bg-color);
93
97
  }
98
+
99
+ &.toggled {
100
+ &.passed .ff-status-bar {
101
+ background-color: var(--base-bg-color);
102
+ color: var(--ff-card-passed-status-bg-color);
103
+ }
104
+ &.failed .ff-status-bar {
105
+ background-color: var(--base-bg-color);
106
+ color: var(--ff-card-failed-status-bg-color);
107
+ }
108
+ &.warning .ff-status-bar {
109
+ background-color: var(--base-bg-color);
110
+ color: var(--ff-card-warning-status-bg-color);
111
+ }
112
+ &.skipped .ff-status-bar {
113
+ background-color: var(--base-bg-color);
114
+ color: var(--ff-card-skipped-status-bg-color);
115
+ }
116
+ &.flaky .ff-status-bar {
117
+ background-color: var(--base-bg-color);
118
+ color: var(--ff-card-flaky-status-bg-color);
119
+ }
120
+
121
+ &.passed .ff-content {
122
+ background-color: var(--ff-card-passed-status-bg-color);
123
+ }
124
+ &.failed .ff-content {
125
+ background-color: var(--ff-card-failed-status-bg-color);
126
+ }
127
+ &.warning .ff-content {
128
+ background-color: var(--ff-card-warning-status-bg-color);
129
+ }
130
+ &.skipped .ff-content {
131
+ background-color: var(--ff-card-skipped-status-bg-color);
132
+ }
133
+ &.flaky .ff-content {
134
+ background-color: var(--ff-card-flaky-status-bg-color);
135
+ }
136
+ }
94
137
  }
@@ -18,6 +18,7 @@ export const Passed: Story = {
18
18
  status: 'Passed',
19
19
  count: 66,
20
20
  text: 'Scripts were passed all the time.',
21
+ style:{width:'200px'},
21
22
  },
22
23
  };
23
24
 
@@ -1,12 +1,31 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import './StatusCard.scss';
3
3
  import { CardProps } from './types';
4
4
  import Typography from '../Typography';
5
5
  import Icon from '../Icon';
6
6
 
7
- const StatusCard: React.FC<CardProps> = ({ icon, status, count, text }) => {
7
+ const StatusCard: React.FC<CardProps> = ({
8
+ icon,
9
+ status,
10
+ count,
11
+ text,
12
+ style = { width: '196.4px' },
13
+ onSelectedStatus = (_status) => {},
14
+ }) => {
15
+ const [isToggled, setIsToggled] = useState<boolean>(false);
16
+
17
+ const handleSelectStatus = (status: string) => {
18
+ setIsToggled(true);
19
+ onSelectedStatus(status);
20
+ };
8
21
  return (
9
- <div className={`ff-card-container ${status.toLowerCase()}`}>
22
+ <div
23
+ className={`ff-card-container ${status.toLowerCase()} ${
24
+ isToggled ? 'toggled' : ''
25
+ }`}
26
+ style={style}
27
+ onClick={() => handleSelectStatus(status)}
28
+ >
10
29
  <div className="ff-status-bar">
11
30
  <div>
12
31
  <Icon name={icon} height={20} width={20} hoverEffect={false} />
@@ -14,7 +33,6 @@ const StatusCard: React.FC<CardProps> = ({ icon, status, count, text }) => {
14
33
  <Typography
15
34
  fontWeight="semi-bold"
16
35
  fontSize="10px"
17
- color="var(--ff-status-card-text-color)"
18
36
  textAlign="center"
19
37
  lineHeight="15px"
20
38
  className="ff-status-text"
@@ -29,6 +47,7 @@ const StatusCard: React.FC<CardProps> = ({ icon, status, count, text }) => {
29
47
  fontSize="24px"
30
48
  className="ff-number"
31
49
  lineHeight="36px"
50
+ color={isToggled ? 'var(--base-bg-color)' : ''}
32
51
  >
33
52
  {count}
34
53
  </Typography>
@@ -37,7 +56,11 @@ const StatusCard: React.FC<CardProps> = ({ icon, status, count, text }) => {
37
56
  fontSize="10px"
38
57
  className="ff-text"
39
58
  lineHeight="15px"
40
- color="var(--ff-card-status-text-color)"
59
+ color={
60
+ isToggled
61
+ ? 'var(--base-bg-color)'
62
+ : 'var(--ff-card-status-text-color)'
63
+ }
41
64
  >
42
65
  {text}
43
66
  </Typography>
@@ -1,11 +1,16 @@
1
1
  export interface CardProps {
2
- /** The icon to display in the card */
3
- icon: string;
4
- /** The status of the card (Passed, Failed, Warning, Skipped, Flaky) */
5
- status: 'Passed' | 'Failed' | 'Warning' | 'Skipped' | 'Flaky';
6
- /** The number displayed in the card */
7
- count: number | string;
8
- /** The description text displayed at the bottom of the card */
9
- text: string;
10
- }
11
-
2
+ /** The icon to display in the card */
3
+ icon: string;
4
+ /** The status of the card (Passed, Failed, Warning, Skipped, Flaky) */
5
+ status: 'Passed' | 'Failed' | 'Warning' | 'Skipped' | 'Flaky' | 'PASSED' | 'FAIL' | 'WARNING' | 'SKIPPED' | 'FLAKY';
6
+ /** The number displayed in the card */
7
+ count: number | string;
8
+ /** The description text displayed at the bottom of the card */
9
+ text: string;
10
+ /** Inline Styling */
11
+ style?: React.CSSProperties;
12
+ /** toggle update */
13
+ handleToggleStatus?: (_status: boolean) => void;
14
+ /** call back */
15
+ onSelectedStatus?: (_status: string) => void;
16
+ }
@@ -73,6 +73,7 @@ export const Toastify = () => {
73
73
  variant={toastProps.variant}
74
74
  toastTitle={toastProps.toastTitle}
75
75
  toastMessage={toastProps.toastMessage}
76
+ zIndex={1000000000}
76
77
  />
77
78
  );
78
79
  };