pixel-react 1.1.9 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/AppHeader/types.d.ts +7 -7
- package/lib/components/Drawer/Drawer.stories.d.ts +2 -0
- package/lib/components/Drawer/Types.d.ts +11 -0
- package/lib/components/Icon/Icon.stories.d.ts +1 -0
- package/lib/components/Icon/types.d.ts +1 -0
- package/lib/components/InputWithDropdown/types.d.ts +1 -1
- package/lib/components/LabelEditTextField/LabelEditTextField.d.ts +5 -0
- package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
- package/lib/components/LabelEditTextField/index.d.ts +1 -0
- package/lib/components/LabelEditTextField/types.d.ts +38 -0
- package/lib/components/Select/Select.d.ts +1 -1
- package/lib/components/Select/components/Dropdown/Dropdown.d.ts +1 -1
- package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +2 -0
- package/lib/components/Select/types.d.ts +11 -4
- package/lib/components/Table/Table.d.ts +1 -1
- package/lib/components/Table/Table.stories.d.ts +2 -0
- package/lib/components/Table/Types.d.ts +16 -0
- package/lib/index.d.ts +92 -16
- package/lib/index.esm.js +399 -152
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +399 -151
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/getSelectOptionValue/getSelectOptionValue.d.ts +8 -0
- package/package.json +1 -1
- package/src/assets/Themes/BaseTheme.scss +10 -0
- package/src/assets/Themes/DarkTheme.scss +19 -7
- package/src/assets/icons/eye_closed.svg +3 -0
- package/src/components/AppHeader/AppHeader.scss +14 -3
- package/src/components/AppHeader/AppHeader.stories.tsx +28 -28
- package/src/components/AppHeader/AppHeader.tsx +11 -11
- package/src/components/AppHeader/types.ts +7 -7
- package/src/components/Button/Button.scss +1 -0
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/Drawer/Drawer.scss +13 -10
- package/src/components/Drawer/Drawer.stories.tsx +28 -0
- package/src/components/Drawer/Drawer.tsx +30 -7
- package/src/components/Drawer/Types.ts +11 -0
- package/src/components/Icon/Icon.stories.tsx +27 -0
- package/src/components/Icon/Icon.tsx +5 -1
- package/src/components/Icon/Icons.scss +14 -2
- package/src/components/Icon/iconList.ts +2 -0
- package/src/components/Icon/types.ts +1 -0
- package/src/components/InputWithDropdown/types.ts +1 -1
- package/src/components/LabelEditTextField/LabelEditTextField.scss +85 -0
- package/src/components/LabelEditTextField/LabelEditTextField.stories.tsx +136 -0
- package/src/components/LabelEditTextField/LabelEditTextField.tsx +207 -0
- package/src/components/LabelEditTextField/index.ts +1 -0
- package/src/components/LabelEditTextField/types.ts +38 -0
- package/src/components/Modal/Modal.tsx +8 -1
- package/src/components/Modal/modal.scss +10 -2
- package/src/components/Select/Select.stories.tsx +5 -3
- package/src/components/Select/Select.tsx +13 -5
- package/src/components/Select/components/Dropdown/Dropdown.tsx +3 -1
- package/src/components/Select/components/Dropdown/dropdownTypes.ts +3 -0
- package/src/components/Select/types.ts +12 -5
- package/src/components/Table/Table.scss +16 -4
- package/src/components/Table/Table.stories.tsx +36 -12
- package/src/components/Table/Table.tsx +33 -16
- package/src/components/Table/Types.ts +121 -105
- package/src/index.ts +2 -0
- package/src/utils/getSelectOptionValue/getSelectOptionValue.ts +31 -0
@@ -1,108 +1,124 @@
|
|
1
1
|
import { ReactNode } from 'react';
|
2
2
|
|
3
3
|
export interface ColumnsProps {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
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
|
+
}
|
package/src/index.ts
CHANGED
@@ -50,6 +50,7 @@ import IconRadioGroup from './components/IconRadioGroup';
|
|
50
50
|
import MachineInputField from './components/MachineInputField';
|
51
51
|
import SequentialConnectingBranch from './components/SequentialConnectingBranch';
|
52
52
|
import AttachmentButton from './components/AttachmentButton';
|
53
|
+
import LabelEditTextField from './components/LabelEditTextField';
|
53
54
|
|
54
55
|
// Utils imports
|
55
56
|
import { checkEmpty } from './utils/checkEmpty/checkEmpty';
|
@@ -120,6 +121,7 @@ export {
|
|
120
121
|
MachineInputField,
|
121
122
|
SequentialConnectingBranch,
|
122
123
|
AttachmentButton,
|
124
|
+
LabelEditTextField,
|
123
125
|
IconRadioGroup,
|
124
126
|
|
125
127
|
// utils exports
|
@@ -0,0 +1,31 @@
|
|
1
|
+
type DynamicValues = any;
|
2
|
+
|
3
|
+
interface dynamicObject {
|
4
|
+
[key: string]: DynamicValues;
|
5
|
+
}
|
6
|
+
|
7
|
+
type accessorType = string | undefined;
|
8
|
+
|
9
|
+
export const getLabel = (
|
10
|
+
option: dynamicObject,
|
11
|
+
accessor: accessorType = ''
|
12
|
+
) => {
|
13
|
+
if (!accessor) {
|
14
|
+
if (option.hasOwnProperty('label')) {
|
15
|
+
return option.label;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
return option[accessor];
|
19
|
+
};
|
20
|
+
|
21
|
+
export const getValue = (
|
22
|
+
option: dynamicObject,
|
23
|
+
accessor: accessorType = ''
|
24
|
+
) => {
|
25
|
+
if (!accessor) {
|
26
|
+
if (option.hasOwnProperty('value')) {
|
27
|
+
return option.label;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
return option[accessor];
|
31
|
+
};
|