pixel-react 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/lib/components/AppHeader/types.d.ts +7 -7
  2. package/lib/components/Drawer/Drawer.stories.d.ts +2 -0
  3. package/lib/components/Drawer/Types.d.ts +11 -0
  4. package/lib/components/Icon/Icon.stories.d.ts +1 -0
  5. package/lib/components/Icon/types.d.ts +1 -0
  6. package/lib/components/Table/Table.d.ts +1 -1
  7. package/lib/components/Table/Table.stories.d.ts +2 -0
  8. package/lib/components/Table/Types.d.ts +16 -0
  9. package/lib/index.d.ts +36 -8
  10. package/lib/index.esm.js +88 -35
  11. package/lib/index.esm.js.map +1 -1
  12. package/lib/index.js +88 -35
  13. package/lib/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/assets/Themes/BaseTheme.scss +3 -0
  16. package/src/assets/Themes/DarkTheme.scss +3 -0
  17. package/src/assets/icons/eye_closed.svg +3 -0
  18. package/src/components/AppHeader/AppHeader.scss +9 -1
  19. package/src/components/AppHeader/AppHeader.stories.tsx +28 -28
  20. package/src/components/AppHeader/AppHeader.tsx +11 -11
  21. package/src/components/AppHeader/types.ts +7 -7
  22. package/src/components/Button/Button.scss +1 -0
  23. package/src/components/Checkbox/Checkbox.tsx +1 -1
  24. package/src/components/Drawer/Drawer.scss +13 -9
  25. package/src/components/Drawer/Drawer.stories.tsx +28 -0
  26. package/src/components/Drawer/Drawer.tsx +29 -6
  27. package/src/components/Drawer/Types.ts +11 -0
  28. package/src/components/Icon/Icon.stories.tsx +27 -0
  29. package/src/components/Icon/Icon.tsx +5 -1
  30. package/src/components/Icon/Icons.scss +13 -2
  31. package/src/components/Icon/iconList.ts +2 -0
  32. package/src/components/Icon/types.ts +1 -0
  33. package/src/components/Modal/Modal.tsx +8 -1
  34. package/src/components/Modal/modal.scss +10 -2
  35. package/src/components/Table/Table.scss +16 -4
  36. package/src/components/Table/Table.stories.tsx +36 -12
  37. package/src/components/Table/Table.tsx +33 -16
  38. package/src/components/Table/Types.ts +121 -105
@@ -3,7 +3,14 @@
3
3
  .ff-fixed-header-table {
4
4
  overflow-y: auto;
5
5
  }
6
-
6
+ .ff-table-icon {
7
+ position: absolute;
8
+ top: 10px;
9
+ right: 0;
10
+ margin-right: 10px;
11
+ z-index: 100;
12
+ cursor: pointer;
13
+ }
7
14
  .ff-table {
8
15
  width: 100%;
9
16
  th,
@@ -16,7 +23,6 @@
16
23
  tr {
17
24
  th {
18
25
  @extend .fontMd;
19
- color: var(--text-color);
20
26
  border-bottom: 1px solid var(--slider-table-color);
21
27
  text-transform: uppercase;
22
28
  }
@@ -54,7 +60,7 @@
54
60
  }
55
61
  td {
56
62
  position: relative;
57
- color: var(--text-color);
63
+ color: var(--table-column-text-color);
58
64
  @extend .fontSm;
59
65
 
60
66
  &.clickable-cell {
@@ -81,6 +87,12 @@
81
87
  .default-bg {
82
88
  background-color: transparent;
83
89
  }
90
+ .default-color {
91
+ color: var(--table-header-text-color);
92
+ }
93
+ .primary-color {
94
+ color: var(--brand-color);
95
+ }
84
96
  }
85
97
  .border-borderRadius {
86
98
  border: 1px solid var(--slider-table-color);
@@ -104,4 +116,4 @@
104
116
  tbody tr.disabled-row {
105
117
  opacity: 0.5;
106
118
  cursor: not-allowed;
107
- }
119
+ }
@@ -26,7 +26,7 @@ const sampleData = [
26
26
  type: 'Web',
27
27
  status: 'Open',
28
28
  checked: false,
29
- disabled:true
29
+ disabled: true,
30
30
  },
31
31
  },
32
32
  {
@@ -37,7 +37,7 @@ const sampleData = [
37
37
  type: 'Mobile',
38
38
  status: 'Close',
39
39
  checked: true,
40
- disabled:true
40
+ disabled: true,
41
41
  },
42
42
  },
43
43
  {
@@ -48,7 +48,7 @@ const sampleData = [
48
48
  type: 'Web',
49
49
  status: 'Close',
50
50
  checked: true,
51
- disabled:true
51
+ disabled: true,
52
52
  },
53
53
  },
54
54
  {
@@ -59,7 +59,7 @@ const sampleData = [
59
59
  type: 'Web & Mobile',
60
60
  status: 'Open',
61
61
  checked: false,
62
- disabled:false
62
+ disabled: false,
63
63
  },
64
64
  },
65
65
  {
@@ -70,7 +70,7 @@ const sampleData = [
70
70
  type: 'Web',
71
71
  status: 'Open',
72
72
  checked: false,
73
- disabled:true
73
+ disabled: true,
74
74
  },
75
75
  },
76
76
  {
@@ -81,7 +81,7 @@ const sampleData = [
81
81
  type: 'Mobile',
82
82
  status: 'Close',
83
83
  checked: true,
84
- disabled:true
84
+ disabled: true,
85
85
  },
86
86
  },
87
87
  {
@@ -92,7 +92,7 @@ const sampleData = [
92
92
  type: 'Web',
93
93
  status: 'Close',
94
94
  checked: true,
95
- disabled:true
95
+ disabled: true,
96
96
  },
97
97
  },
98
98
  {
@@ -103,7 +103,7 @@ const sampleData = [
103
103
  type: 'Web & Mobile',
104
104
  status: 'Open',
105
105
  checked: false,
106
- disabled:false
106
+ disabled: false,
107
107
  },
108
108
  },
109
109
  {
@@ -114,7 +114,7 @@ const sampleData = [
114
114
  type: 'Web',
115
115
  status: 'Open',
116
116
  checked: false,
117
- disabled:false
117
+ disabled: false,
118
118
  },
119
119
  },
120
120
  {
@@ -125,7 +125,7 @@ const sampleData = [
125
125
  type: 'Mobile',
126
126
  status: 'Close',
127
127
  checked: true,
128
- disabled:false
128
+ disabled: false,
129
129
  },
130
130
  },
131
131
  {
@@ -136,7 +136,7 @@ const sampleData = [
136
136
  type: 'Web',
137
137
  status: 'Close',
138
138
  checked: true,
139
- disabled:false
139
+ disabled: false,
140
140
  },
141
141
  },
142
142
  {
@@ -147,7 +147,7 @@ const sampleData = [
147
147
  type: 'Web & Mobile',
148
148
  status: 'Open',
149
149
  checked: false,
150
- disabled:false
150
+ disabled: false,
151
151
  },
152
152
  },
153
153
  ];
@@ -202,6 +202,27 @@ export const Default: Story = {
202
202
  columns: columnsData,
203
203
  },
204
204
  };
205
+
206
+ export const PrimaryHeaderTextColor: Story = {
207
+ args: {
208
+ ...defaultArgs,
209
+ data: sampleData.map((x) => x.project),
210
+
211
+ columns: columnsData,
212
+ headerTextColor: 'primary',
213
+ },
214
+ };
215
+
216
+ export const TableDataTextColor: Story = {
217
+ args: {
218
+ ...defaultArgs,
219
+ data: sampleData.map((x) => x.project),
220
+
221
+ columns: columnsData,
222
+ tableDataTextColor: 'var(--brand-color)',
223
+ },
224
+ };
225
+
205
226
  export const PageTable: Story = {
206
227
  args: {
207
228
  ...defaultArgs,
@@ -217,6 +238,7 @@ export const PageTable: Story = {
217
238
  });
218
239
  setTableData(sampleArray);
219
240
  }, []);
241
+ const handleIconClick = () => {};
220
242
 
221
243
  return (
222
244
  <>
@@ -226,6 +248,8 @@ export const PageTable: Story = {
226
248
  columns={columnsData}
227
249
  headerType="secondary"
228
250
  noDataContent="No data found"
251
+ headerIconName={'expand_icon'}
252
+ headerIconOnClick={handleIconClick}
229
253
  />
230
254
  </>
231
255
  );
@@ -1,5 +1,4 @@
1
1
  import './Table.scss';
2
- // import Checkbox from '../Checkbox';
3
2
  import { isFunction } from '../../assets/utils/functionUtils';
4
3
  import classNames from 'classnames';
5
4
  import {
@@ -11,6 +10,8 @@ import {
11
10
  import { prepareData } from '../../utils/TableCell/TableCell';
12
11
  import Checkbox from '../Checkbox';
13
12
  import { checkEmpty } from '../../utils/checkEmpty/checkEmpty';
13
+ import Typography from '../Typography';
14
+ import Icon from '../Icon';
14
15
 
15
16
  // import NoData from '../NoData/NoData';
16
17
 
@@ -25,13 +26,17 @@ const Table = ({
25
26
  withFixedHeader = true,
26
27
  borderWithRadius = false,
27
28
  headerCheckboxDisabled = false,
28
- // noDataContent,
29
+ noDataContent,
29
30
  // noDataImage,
30
31
  // noDataImageSize,
31
32
  height = '100%',
32
33
  className = '',
33
34
  tableHeadClass = '',
34
35
  tableBodyRowClass = '',
36
+ headerTextColor,
37
+ tableDataTextColor,
38
+ headerIconName = '',
39
+ headerIconOnClick = () => {},
35
40
  }: TableProps) => {
36
41
  const hanleOnclick = (column: ColumnsProps, row: DataProps) => {
37
42
  let { onClick, accessor } = column;
@@ -48,12 +53,22 @@ const Table = ({
48
53
 
49
54
  return (
50
55
  <div
51
- style={{ height: height }}
56
+ style={{ height: height, position: 'relative' }}
52
57
  className={classNames(className, {
53
58
  'ff-fixed-header-table': withFixedHeader,
54
59
  'border-borderRadius': borderWithRadius,
55
60
  })}
56
61
  >
62
+ {/* {iconContainer ? iconContainer : ''} */}
63
+ <div className="ff-table-icon">
64
+ <Icon
65
+ height={14}
66
+ width={14}
67
+ name={headerIconName}
68
+ onClick={headerIconOnClick}
69
+ ></Icon>
70
+ </div>
71
+
57
72
  <table className={classNames(`ff-table`)} cellSpacing={0}>
58
73
  <thead
59
74
  className={classNames(
@@ -67,7 +82,10 @@ const Table = ({
67
82
  {/* columns.map((column, index) */}
68
83
  {columns.map((column, index) => (
69
84
  <th
70
- className={headerType && `${headerType}-bg`}
85
+ className={classNames(
86
+ `${headerType && `${headerType}-bg`}`,
87
+ `${headerTextColor && `${headerTextColor}-color`}`
88
+ )}
71
89
  key={column.header}
72
90
  style={{ width: column?.width }}
73
91
  >
@@ -98,12 +116,9 @@ const Table = ({
98
116
  data.map((row: any, index: number) => (
99
117
  <tr
100
118
  key={row.id || index}
101
- className={classNames(
102
- tableBodyRowClass,
103
- {
104
- 'disabled-row': row.disabled,
105
- },
106
- )}
119
+ className={classNames(tableBodyRowClass, {
120
+ 'disabled-row': row.disabled,
121
+ })}
107
122
  >
108
123
  {columns.map((column, i) => {
109
124
  return (
@@ -114,7 +129,7 @@ const Table = ({
114
129
  'clickable-cell': column.onClick,
115
130
  })}
116
131
  >
117
- <div>
132
+ <Typography as="div" color={tableDataTextColor}>
118
133
  {i === 0 && withCheckbox && (
119
134
  <span className="ff-table-checkbox">
120
135
  <Checkbox
@@ -127,7 +142,7 @@ const Table = ({
127
142
  </span>
128
143
  )}
129
144
  {prepareData(row, column)}
130
- </div>
145
+ </Typography>
131
146
  </td>
132
147
  );
133
148
  })}
@@ -135,18 +150,20 @@ const Table = ({
135
150
  ))}
136
151
  </tbody>
137
152
  </table>
138
- {/* {data.length <= 0 && (
153
+ {data.length <= 0 && (
139
154
  <div
140
155
  className="no-data-content"
141
156
  style={{ height: `calc(${height} - 50px)` }}
142
157
  >
143
- <NoData
158
+ {/* commented for future requirement for adding image when the data will not be present*/}
159
+ {/* <NoData
144
160
  image={noDataImage ? noDataImage : 'no_data_found'}
145
161
  content={noDataContent}
146
162
  size={noDataImageSize}
147
- />
163
+ /> */}
164
+ {noDataContent}
148
165
  </div>
149
- )} */}
166
+ )}
150
167
  </div>
151
168
  );
152
169
  };
@@ -1,108 +1,124 @@
1
1
  import { ReactNode } from 'react';
2
2
 
3
3
  export interface ColumnsProps {
4
- /**
5
- * column name
6
- */
7
- header: string;
8
- /**
9
- * data key for particular column
10
- */
11
- accessor: string;
12
- /**
13
- * className for a column
14
- */
15
- className?: string;
16
- /**
17
- * width of a column
18
- */
19
- width?: number;
20
- /**
21
- * data for the column
22
- */
23
- cell?: (e: any) => JSX.Element | string | ReactNode;
24
-
25
- onClick?: (colum: string, row: DataProps) => void;
26
- }
27
- export interface DataProps {
28
- /**
29
- * data for each row
30
- */
31
- [key: string]: any;
32
- }
33
- export interface SelectedItemProps {
34
- /**
35
- * selected row object | All selected flag
36
- */
37
- [key: string]: string | number | boolean;
38
- }
39
- export interface TableProps {
40
- /**
41
- * Data for table
42
- */
43
- data: Array<number | string | DataProps>;
44
- /**
45
- * Column details for table
46
- */
47
- columns: Array<any>;
48
- /**
49
- * Header type to have different background color
50
- */
51
- headerType: 'default' | 'primary' | 'secondary';
52
- /**
53
- * withFixedHeader prop to have non-scrollable fixed table header
54
- */
55
- withFixedHeader?: boolean;
56
- /**
57
- * borderWithRadius prop to have table with border 1px and borderRadius 5px
58
- */
59
- borderWithRadius?: boolean;
60
- /**
61
- * Check box feature to select the row
62
- */
63
- withCheckbox?: boolean;
64
- /**
65
- * Event for checkbox onClick
66
- */
67
- onSelect?: (e: object, arg: SelectedItemProps) => void;
68
- /**
69
- * Check box feature to select the row
70
- */
71
- allSelected?: boolean;
72
- /**
73
- * send true to show partial checkbox in the header
74
- */
75
- partialSelected?: boolean;
76
- /**
77
- * send true to disable the checkbox in the header
78
- */
79
- headerCheckboxDisabled?: boolean;
80
- /**
81
- * The content that to be displayed if no data not found
82
- */
83
- noDataContent: string | ReactNode;
84
- /**
85
- * Image that to be displayed if you don't have data
86
- */
87
- noDataImage?: string;
88
- /**
89
- * Size of the image that to be displayed if you don't have data
90
- */
91
- noDataImageSize?: 'x-large' | 'large' | 'medium' | 'small' | 'x-small';
92
- /**
93
- * Height of the table in string
94
- */
95
- height?: string;
96
- /**
97
- * classNames for the table container
98
- */
99
- className?: string;
100
- /**
101
- * classNames for the table Header container
102
- */
103
- tableHeadClass?:string;
104
- /**
105
- * classNames for the table Row container
106
- */
107
- tableBodyRowClass?:string;
108
- }
4
+ /**
5
+ * column name
6
+ */
7
+ header: string;
8
+ /**
9
+ * data key for particular column
10
+ */
11
+ accessor: string;
12
+ /**
13
+ * className for a column
14
+ */
15
+ className?: string;
16
+ /**
17
+ * width of a column
18
+ */
19
+ width?: number;
20
+ /**
21
+ * data for the column
22
+ */
23
+ cell?: (e: any) => JSX.Element | string | ReactNode;
24
+
25
+ onClick?: (colum: string, row: DataProps) => void;
26
+ }
27
+ export interface DataProps {
28
+ /**
29
+ * data for each row
30
+ */
31
+ [key: string]: any;
32
+ }
33
+ export interface SelectedItemProps {
34
+ /**
35
+ * selected row object | All selected flag
36
+ */
37
+ [key: string]: string | number | boolean;
38
+ }
39
+ export interface TableProps {
40
+ /**
41
+ * Data for table
42
+ */
43
+ data: Array<number | string | DataProps>;
44
+ /**
45
+ * Column details for table
46
+ */
47
+ columns: Array<any>;
48
+ /**
49
+ * Header type to have different background color
50
+ */
51
+ headerType: 'default' | 'primary' | 'secondary';
52
+ /**
53
+ * withFixedHeader prop to have non-scrollable fixed table header
54
+ */
55
+ withFixedHeader?: boolean;
56
+ /**
57
+ * borderWithRadius prop to have table with border 1px and borderRadius 5px
58
+ */
59
+ borderWithRadius?: boolean;
60
+ /**
61
+ * Check box feature to select the row
62
+ */
63
+ withCheckbox?: boolean;
64
+ /**
65
+ * Event for checkbox onClick
66
+ */
67
+ onSelect?: (e: object, arg: SelectedItemProps) => void;
68
+ /**
69
+ * Check box feature to select the row
70
+ */
71
+ allSelected?: boolean;
72
+ /**
73
+ * send true to show partial checkbox in the header
74
+ */
75
+ partialSelected?: boolean;
76
+ /**
77
+ * send true to disable the checkbox in the header
78
+ */
79
+ headerCheckboxDisabled?: boolean;
80
+ /**
81
+ * The content that to be displayed if no data not found
82
+ */
83
+ noDataContent: string | ReactNode;
84
+ /**
85
+ * Image that to be displayed if you don't have data
86
+ */
87
+ noDataImage?: string;
88
+ /**
89
+ * Size of the image that to be displayed if you don't have data
90
+ */
91
+ noDataImageSize?: 'x-large' | 'large' | 'medium' | 'small' | 'x-small';
92
+ /**
93
+ * Height of the table in string
94
+ */
95
+ height?: string;
96
+ /**
97
+ * classNames for the table container
98
+ */
99
+ className?: string;
100
+ /**
101
+ * classNames for the table Header container
102
+ */
103
+ tableHeadClass?: string;
104
+ /**
105
+ * classNames for the table Row container
106
+ */
107
+ tableBodyRowClass?: string;
108
+ /**
109
+ * custom color for the column text
110
+ */
111
+ headerTextColor?: 'default' | 'primary';
112
+ /**
113
+ * custom color for the row text
114
+ */
115
+ tableDataTextColor?: string;
116
+ /**
117
+ * icon for the table header, for expand or other purposes
118
+ */
119
+ headerIconName?: string;
120
+ /**
121
+ * handle function for the table header icon
122
+ */
123
+ headerIconOnClick?: () => void;
124
+ }