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.
Files changed (62) 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/InputWithDropdown/types.d.ts +1 -1
  7. package/lib/components/LabelEditTextField/LabelEditTextField.d.ts +5 -0
  8. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
  9. package/lib/components/LabelEditTextField/index.d.ts +1 -0
  10. package/lib/components/LabelEditTextField/types.d.ts +38 -0
  11. package/lib/components/Select/Select.d.ts +1 -1
  12. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +1 -1
  13. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +2 -0
  14. package/lib/components/Select/types.d.ts +11 -4
  15. package/lib/components/Table/Table.d.ts +1 -1
  16. package/lib/components/Table/Table.stories.d.ts +2 -0
  17. package/lib/components/Table/Types.d.ts +16 -0
  18. package/lib/index.d.ts +92 -16
  19. package/lib/index.esm.js +399 -152
  20. package/lib/index.esm.js.map +1 -1
  21. package/lib/index.js +399 -151
  22. package/lib/index.js.map +1 -1
  23. package/lib/tsconfig.tsbuildinfo +1 -1
  24. package/lib/utils/getSelectOptionValue/getSelectOptionValue.d.ts +8 -0
  25. package/package.json +1 -1
  26. package/src/assets/Themes/BaseTheme.scss +10 -0
  27. package/src/assets/Themes/DarkTheme.scss +19 -7
  28. package/src/assets/icons/eye_closed.svg +3 -0
  29. package/src/components/AppHeader/AppHeader.scss +14 -3
  30. package/src/components/AppHeader/AppHeader.stories.tsx +28 -28
  31. package/src/components/AppHeader/AppHeader.tsx +11 -11
  32. package/src/components/AppHeader/types.ts +7 -7
  33. package/src/components/Button/Button.scss +1 -0
  34. package/src/components/Checkbox/Checkbox.tsx +1 -1
  35. package/src/components/Drawer/Drawer.scss +13 -10
  36. package/src/components/Drawer/Drawer.stories.tsx +28 -0
  37. package/src/components/Drawer/Drawer.tsx +30 -7
  38. package/src/components/Drawer/Types.ts +11 -0
  39. package/src/components/Icon/Icon.stories.tsx +27 -0
  40. package/src/components/Icon/Icon.tsx +5 -1
  41. package/src/components/Icon/Icons.scss +14 -2
  42. package/src/components/Icon/iconList.ts +2 -0
  43. package/src/components/Icon/types.ts +1 -0
  44. package/src/components/InputWithDropdown/types.ts +1 -1
  45. package/src/components/LabelEditTextField/LabelEditTextField.scss +85 -0
  46. package/src/components/LabelEditTextField/LabelEditTextField.stories.tsx +136 -0
  47. package/src/components/LabelEditTextField/LabelEditTextField.tsx +207 -0
  48. package/src/components/LabelEditTextField/index.ts +1 -0
  49. package/src/components/LabelEditTextField/types.ts +38 -0
  50. package/src/components/Modal/Modal.tsx +8 -1
  51. package/src/components/Modal/modal.scss +10 -2
  52. package/src/components/Select/Select.stories.tsx +5 -3
  53. package/src/components/Select/Select.tsx +13 -5
  54. package/src/components/Select/components/Dropdown/Dropdown.tsx +3 -1
  55. package/src/components/Select/components/Dropdown/dropdownTypes.ts +3 -0
  56. package/src/components/Select/types.ts +12 -5
  57. package/src/components/Table/Table.scss +16 -4
  58. package/src/components/Table/Table.stories.tsx +36 -12
  59. package/src/components/Table/Table.tsx +33 -16
  60. package/src/components/Table/Types.ts +121 -105
  61. package/src/index.ts +2 -0
  62. 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
- * 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
+ }
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
+ };