pixel-react 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. package/lib/components/AppHeader/types.d.ts +11 -2
  2. package/lib/components/Avatar/Avatar.d.ts +5 -0
  3. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  4. package/lib/components/Avatar/index.d.ts +1 -0
  5. package/lib/components/Avatar/types.d.ts +26 -0
  6. package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
  7. package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
  8. package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
  9. package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
  10. package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
  11. package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
  12. package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
  13. package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
  14. package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
  15. package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
  16. package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
  17. package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +6 -7
  18. package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
  19. package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
  20. package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
  21. package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
  22. package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
  23. package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
  24. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
  25. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
  26. package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
  27. package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
  28. package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
  29. package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
  30. package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
  31. package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
  32. package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +11 -48
  33. package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
  34. package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
  35. package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +11 -12
  36. package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +16 -0
  37. package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
  38. package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
  39. package/lib/components/ExcelFile/Types.d.ts +2 -49
  40. package/lib/components/Form/Form.d.ts +1 -15
  41. package/lib/components/Form/Form.stories.d.ts +6 -5
  42. package/lib/components/Form/Forms.d.ts +8 -0
  43. package/lib/components/Form/index.d.ts +1 -1
  44. package/lib/components/InputWithDropdown/types.d.ts +1 -1
  45. package/lib/components/LabelEditTextField/LabelEditTextField.d.ts +5 -0
  46. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
  47. package/lib/components/LabelEditTextField/index.d.ts +1 -0
  48. package/lib/components/LabelEditTextField/types.d.ts +38 -0
  49. package/lib/components/MenuOption/types.d.ts +7 -7
  50. package/lib/components/ModulesChip/ModuleChip.d.ts +4 -0
  51. package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
  52. package/lib/components/ModulesChip/index.d.ts +1 -0
  53. package/lib/components/ModulesChip/types.d.ts +14 -0
  54. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
  55. package/lib/components/Select/Select.d.ts +1 -1
  56. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +1 -1
  57. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +2 -0
  58. package/lib/components/Select/types.d.ts +11 -4
  59. package/lib/components/Toastify/Toastify.d.ts +8 -0
  60. package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
  61. package/lib/components/Toastify/index.d.ts +1 -0
  62. package/lib/components/Toastify/types.d.ts +7 -0
  63. package/lib/components/Tooltip/types.d.ts +6 -0
  64. package/lib/components/Typography/types.d.ts +1 -0
  65. package/lib/index.d.ts +130 -29
  66. package/lib/index.esm.js +26882 -872
  67. package/lib/index.esm.js.map +1 -1
  68. package/lib/index.js +26881 -866
  69. package/lib/index.js.map +1 -1
  70. package/lib/tsconfig.tsbuildinfo +1 -1
  71. package/lib/utils/getSelectOptionValue/getSelectOptionValue.d.ts +8 -0
  72. package/package.json +1 -1
  73. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
  74. package/src/assets/Themes/BaseTheme.scss +10 -1
  75. package/src/assets/Themes/DarkTheme.scss +19 -8
  76. package/src/assets/icons/client_profile.svg +4 -0
  77. package/src/assets/icons/fireflink_finder_logo.svg +7 -0
  78. package/src/assets/icons/fireflink_platform.svg +4 -0
  79. package/src/assets/icons/license_expired.svg +20 -0
  80. package/src/components/AppHeader/AppHeader.scss +5 -2
  81. package/src/components/AppHeader/AppHeader.stories.tsx +24 -3
  82. package/src/components/AppHeader/AppHeader.tsx +29 -11
  83. package/src/components/AppHeader/types.ts +11 -3
  84. package/src/components/Avatar/Avatar.scss +24 -0
  85. package/src/components/Avatar/Avatar.stories.tsx +56 -0
  86. package/src/components/Avatar/Avatar.tsx +25 -0
  87. package/src/components/Avatar/index.ts +1 -0
  88. package/src/components/Avatar/types.ts +27 -0
  89. package/src/components/Drawer/Drawer.scss +0 -1
  90. package/src/components/Drawer/Drawer.tsx +1 -1
  91. package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +0 -2
  92. package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +1 -4
  93. package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +0 -1
  94. package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
  95. package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +13 -12
  96. package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
  97. package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
  98. package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
  99. package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
  100. package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
  101. package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
  102. package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
  103. package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
  104. package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
  105. package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
  106. package/src/components/ExcelFile/ExcelFile/Excel/{Spreadsheet.css → Spreadsheet.scss} +21 -37
  107. package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -78
  108. package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
  109. package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
  110. package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
  111. package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
  112. package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
  113. package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
  114. package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
  115. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
  116. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
  117. package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
  118. package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
  119. package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
  120. package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
  121. package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
  122. package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
  123. package/src/components/ExcelFile/ExcelFile/Excel/types.ts +14 -66
  124. package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
  125. package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
  126. package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
  127. package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
  128. package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -3
  129. package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +45 -403
  130. package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -29
  131. package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +1 -12
  132. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -3
  133. package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +147 -127
  134. package/src/components/ExcelFile/Types.ts +3 -70
  135. package/src/components/ExcelFile/index.ts +1 -1
  136. package/src/components/Form/Form.d.ts +3 -0
  137. package/src/components/Form/Form.scss +31 -4
  138. package/src/components/Form/Form.stories.tsx +172 -138
  139. package/src/components/Form/Form.ts +2 -0
  140. package/src/components/Form/Forms.tsx +25 -0
  141. package/src/components/Form/index.ts +1 -1
  142. package/src/components/Icon/Icons.scss +1 -0
  143. package/src/components/Icon/iconList.ts +8 -0
  144. package/src/components/IconButton/IconButton.scss +1 -1
  145. package/src/components/InputWithDropdown/types.ts +1 -1
  146. package/src/components/LabelEditTextField/LabelEditTextField.scss +85 -0
  147. package/src/components/LabelEditTextField/LabelEditTextField.stories.tsx +136 -0
  148. package/src/components/LabelEditTextField/LabelEditTextField.tsx +207 -0
  149. package/src/components/LabelEditTextField/index.ts +1 -0
  150. package/src/components/LabelEditTextField/types.ts +38 -0
  151. package/src/components/MenuOption/types.ts +7 -6
  152. package/src/components/ModulesChip/ModuleChip.scss +20 -0
  153. package/src/components/ModulesChip/ModuleChip.stories.tsx +41 -0
  154. package/src/components/ModulesChip/ModuleChip.tsx +31 -0
  155. package/src/components/ModulesChip/index.ts +1 -0
  156. package/src/components/ModulesChip/types.ts +14 -0
  157. package/src/components/MultiSelect/Dropdown.tsx +6 -1
  158. package/src/components/MultiSelect/MultiSelect.scss +17 -10
  159. package/src/components/MultiSelect/MultiSelect.stories.tsx +16 -4
  160. package/src/components/MultiSelect/MultiSelect.tsx +11 -4
  161. package/src/components/MultiSelect/MultiSelectTypes.ts +4 -3
  162. package/src/components/Select/Select.scss +4 -0
  163. package/src/components/Select/Select.stories.tsx +5 -3
  164. package/src/components/Select/Select.tsx +15 -7
  165. package/src/components/Select/components/Dropdown/Dropdown.tsx +3 -1
  166. package/src/components/Select/components/Dropdown/dropdownTypes.ts +3 -0
  167. package/src/components/Select/types.ts +12 -5
  168. package/src/components/Toastify/Toastify.stories.tsx +52 -0
  169. package/src/components/Toastify/Toastify.tsx +66 -0
  170. package/src/components/Toastify/index.ts +1 -0
  171. package/src/components/Toastify/types.ts +8 -0
  172. package/src/components/Tooltip/Tooltip.tsx +2 -1
  173. package/src/components/Tooltip/types.ts +6 -0
  174. package/src/components/Typography/Typography.scss +12 -4
  175. package/src/components/Typography/Typography.stories.tsx +2 -0
  176. package/src/components/Typography/Typography.tsx +2 -0
  177. package/src/components/Typography/types.ts +1 -0
  178. package/src/index.ts +12 -2
  179. package/src/utils/getSelectOptionValue/getSelectOptionValue.ts +31 -0
  180. package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -78
  181. package/src/components/ExcelFile/ImportExcelStyles.tsx +0 -86
  182. package/src/components/Form/Form.tsx +0 -57
@@ -7,6 +7,7 @@ import Typography from '../../../Typography';
7
7
  import { ffid } from '../../../../utils/ffID/ffid';
8
8
  import { ThemeContext } from '../../../ThemeProvider/ThemeProvider';
9
9
  import classNames from 'classnames';
10
+ import { getLabel } from '../../../../utils/getSelectOptionValue/getSelectOptionValue';
10
11
 
11
12
  const Dropdown = ({
12
13
  onSelectBlur,
@@ -15,6 +16,7 @@ const Dropdown = ({
15
16
  options = [],
16
17
  optionZIndex = 100,
17
18
  inputRef,
19
+ labelAccessor,
18
20
  }: DropDownListProps) => {
19
21
  const themeContext = useContext(ThemeContext);
20
22
  const currentTheme = themeContext?.currentTheme;
@@ -71,7 +73,7 @@ const Dropdown = ({
71
73
  color="var(--ff-select-text-color)"
72
74
  onClick={() => onSelectOptionSelector(option)}
73
75
  >
74
- {option.label}
76
+ {getLabel(option, labelAccessor)}
75
77
  </Typography>
76
78
  ))
77
79
  ) : (
@@ -7,6 +7,8 @@ export interface DropDownListProps {
7
7
  options?: Option[];
8
8
  optionZIndex?: number;
9
9
  inputRef?: React.RefObject<HTMLInputElement>;
10
+ labelAccessor?: string;
11
+ valueAccessor?: string;
10
12
  }
11
13
 
12
14
  export const dropdownDefaultCSSData = {
@@ -17,3 +19,4 @@ export const dropdownDefaultCSSData = {
17
19
  // Future use case if we provide padding-top, padding-bottom for option wrapper
18
20
  dropDownWrapperPadding: 0,
19
21
  };
22
+
@@ -1,5 +1,3 @@
1
- import { ReactNode } from 'react';
2
-
3
1
  export interface SelectProps {
4
2
  /*
5
3
  * Label for the select dropdown
@@ -69,6 +67,15 @@ export interface SelectProps {
69
67
  * selectedOptionColor prop provides the custom color for the selected option
70
68
  */
71
69
  selectedOptionColor?: string;
70
+
71
+ /**
72
+ * Label accessor
73
+ */
74
+ labelAccessor?: string;
75
+ /**
76
+ * Value accessor
77
+ */
78
+ valueAccessor?: string;
72
79
  }
73
80
 
74
81
  export interface DrowdownPosition {
@@ -124,8 +131,8 @@ export type SelectAction =
124
131
  };
125
132
  };
126
133
 
134
+ type OptionValue = any;
135
+
127
136
  export interface Option {
128
- label: string | ReactNode;
129
- value: string;
130
- disabled?: boolean;
137
+ [key: string]: OptionValue;
131
138
  }
@@ -0,0 +1,52 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Toastify, toast } from './Toastify';
3
+ import Button from '../Button';
4
+
5
+ const meta: Meta<typeof Toastify> = {
6
+ title: 'Components/Toastify',
7
+ component: Toastify,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ tags: ['autodocs'],
12
+ };
13
+
14
+ type Story = StoryObj<typeof Toastify>;
15
+
16
+ const defaultArgs = {
17
+ isOpen: false,
18
+ toastTitle: 'Success',
19
+ toastMessage: 'Variable name Requested for Review successfully',
20
+ closeButtonLabel: 'x',
21
+ displayDuration: 3000,
22
+ };
23
+
24
+ export const Controlled: Story = {
25
+ args: {
26
+ ...defaultArgs,
27
+ },
28
+ // import { Toastify, toast } from 'pixel-react';
29
+ render: () => (
30
+ <>
31
+ {/* Render Toastify to allow toast notifications */}
32
+ <Toastify />
33
+
34
+ {/* Button to trigger a toast notification */}
35
+ <Button
36
+ variant="primary"
37
+ onClick={() => toast.success('Your request was successful!')}
38
+ >
39
+ Show Success Toast
40
+ </Button>
41
+ <br/>
42
+ <Button
43
+ variant="delete"
44
+ onClick={() => toast.error('Something went wrong!')}
45
+ >
46
+ Show Error Toast
47
+ </Button>
48
+ </>
49
+ ),
50
+ };
51
+
52
+ export default meta;
@@ -0,0 +1,66 @@
1
+ import { useState, useRef } from 'react';
2
+ import Toaster from '../Toast/Toast';
3
+ import { Variant, ToastProps } from './types';
4
+
5
+ let openToast: (variant: Variant, message: string) => void;
6
+
7
+ export const Toastify = () => {
8
+ const [toastProps, setToastProps] = useState<ToastProps>({
9
+ isOpen: false,
10
+ variant: 'info',
11
+ toastTitle: '',
12
+ toastMessage: '',
13
+ });
14
+
15
+ const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
16
+
17
+ openToast = (variant: Variant, message: string) => {
18
+ // Clear the previous timeout if it exists
19
+ if (timeoutRef.current) {
20
+ clearTimeout(timeoutRef.current);
21
+ timeoutRef.current = null;
22
+ }
23
+
24
+ const title =
25
+ variant === 'danger'
26
+ ? 'Error!'
27
+ : variant.charAt(0).toUpperCase() + variant.slice(1);
28
+ // Close the existing toast if open, and then immediately show the new one
29
+ setToastProps((prev) => ({
30
+ ...prev,
31
+ isOpen: false,
32
+ }));
33
+
34
+ setTimeout(() => {
35
+ setToastProps({
36
+ isOpen: true,
37
+ variant,
38
+ toastTitle: `${title}!`,
39
+ toastMessage: message,
40
+ });
41
+ }, 10);
42
+
43
+ timeoutRef.current = setTimeout(() => {
44
+ setToastProps((prev) => ({ ...prev, isOpen: false }));
45
+ }, 3000);
46
+ };
47
+
48
+ return (
49
+ <Toaster
50
+ isOpen={toastProps.isOpen}
51
+ variant={toastProps.variant}
52
+ toastTitle={toastProps.toastTitle}
53
+ toastMessage={toastProps.toastMessage}
54
+ />
55
+ );
56
+ };
57
+
58
+ export default Toastify;
59
+
60
+ // Utility to trigger toast messages outside of the Toastify component
61
+ export const toast = {
62
+ success: (message: string) => openToast('success', message),
63
+ error: (message: string) => openToast('danger', message),
64
+ warning: (message: string) => openToast('warning', message),
65
+ info: (message: string) => openToast('info', message),
66
+ };
@@ -0,0 +1 @@
1
+ export { default } from './Toastify';
@@ -0,0 +1,8 @@
1
+ export type Variant = 'success' | 'warning' | 'danger' | 'info' | 'confirm';
2
+
3
+ export interface ToastProps {
4
+ isOpen: boolean;
5
+ variant: Variant;
6
+ toastTitle: string;
7
+ toastMessage: string;
8
+ }
@@ -17,6 +17,7 @@ const Tooltip: React.FC<TooltipProps> = ({
17
17
  children,
18
18
  placement = 'bottom',
19
19
  disabled = false,
20
+ zIndex = 99,
20
21
  }) => {
21
22
  const [isVisible, setIsVisible] = useState(false);
22
23
  const titleRef: TitleRef = useRef(null);
@@ -178,7 +179,7 @@ const Tooltip: React.FC<TooltipProps> = ({
178
179
  createPortal(
179
180
  <div
180
181
  ref={titleRef}
181
- style={styles[placement]}
182
+ style={{ ...styles[placement], zIndex }}
182
183
  className={classNames('ff-tooltip', currentTheme, {
183
184
  'ff-tooltip--visible': isVisible,
184
185
  })}
@@ -46,6 +46,12 @@ interface TooltipProps {
46
46
  * @default false
47
47
  */
48
48
  disabled?: boolean;
49
+ /**.
50
+ * Z-Index is by default 99
51
+ *
52
+ * @default 99
53
+ */
54
+ zIndex?: number | string ;
49
55
  }
50
56
 
51
57
 
@@ -6,28 +6,32 @@
6
6
  @font-face {
7
7
  font-family: 'Poppins';
8
8
  font-weight: 400;
9
- src: local('Poppins-Regular'),
9
+ src:
10
+ local('Poppins-Regular'),
10
11
  url(../../fonts/Poppins/Poppins-Regular.ttf) format('truetype');
11
12
  }
12
13
 
13
14
  @font-face {
14
15
  font-family: 'Poppins';
15
16
  font-weight: 500;
16
- src: local('Poppins-Medium'),
17
+ src:
18
+ local('Poppins-Medium'),
17
19
  url(../../fonts/Poppins/Poppins-Medium.ttf) format('truetype');
18
20
  }
19
21
 
20
22
  @font-face {
21
23
  font-family: 'Poppins';
22
24
  font-weight: 600;
23
- src: local('Poppins-SemiBold'),
25
+ src:
26
+ local('Poppins-SemiBold'),
24
27
  url(../../fonts/Poppins/Poppins-SemiBold.ttf) format('truetype');
25
28
  }
26
29
 
27
30
  @font-face {
28
31
  font-family: 'Poppins';
29
32
  font-weight: 700;
30
- src: local('Poppins-Bold'),
33
+ src:
34
+ local('Poppins-Bold'),
31
35
  url(../../fonts/Poppins/Poppins-Bold.ttf) format('truetype');
32
36
  }
33
37
 
@@ -46,4 +50,8 @@
46
50
  &--bold {
47
51
  font-weight: 700;
48
52
  }
53
+ .required-asterisk {
54
+ color: var(--input-error-text-color);
55
+ padding-right: 4px;
56
+ }
49
57
  }
@@ -14,6 +14,7 @@ type Story = StoryObj<typeof Typography>;
14
14
 
15
15
  export const Docs: Story = {
16
16
  args: {
17
+ required: false,
17
18
  children: 'Typography',
18
19
  },
19
20
  };
@@ -51,6 +52,7 @@ export const Bold14px: Story = {
51
52
  fontSize: '16px',
52
53
  as: 'h2',
53
54
  children: 'This is Bold text with 700 font weight and 16px font size.',
55
+ required: true,
54
56
  },
55
57
  };
56
58
 
@@ -14,6 +14,7 @@ const Typography: React.FC<TypographyProps> = ({
14
14
  children,
15
15
  htmlFor = '',
16
16
  onClick = () => {},
17
+ required = false,
17
18
  }) => {
18
19
  const fontSizeValue =
19
20
  typeof fontSize === 'number' ? `${fontSize}px` : fontSize;
@@ -31,6 +32,7 @@ const Typography: React.FC<TypographyProps> = ({
31
32
  }}
32
33
  onClick={onClick}
33
34
  >
35
+ {required && <span className="required-asterisk">*</span>}
34
36
  {children}
35
37
  </Element>
36
38
  );
@@ -53,4 +53,5 @@ export interface TypographyProps {
53
53
  * To add onClick function
54
54
  */
55
55
  onClick?: () => void;
56
+ required?: boolean; // TO add * in the label
56
57
  }
package/src/index.ts CHANGED
@@ -23,7 +23,7 @@ import LazyLoad from './components/LazyLoad/LazyLoad';
23
23
  import ThemeProvider from './components/ThemeProvider';
24
24
  import Typography from './components/Typography';
25
25
  import useTheme from './hooks/useTheme';
26
- import Form from './components/Form';
26
+ import Forms from './components/Form/Forms';
27
27
  import InputWithDropdown from './components/InputWithDropdown';
28
28
  import RadioButton from './components/RadioButton';
29
29
  import RadioGroup from './components/RadioGroup';
@@ -50,6 +50,11 @@ 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 { Toastify, toast } from './components/Toastify/Toastify';
54
+
55
+ import LabelEditTextField from './components/LabelEditTextField';
56
+ import ExcelFile from './components/ExcelFile';
57
+ import ModuleChip from './components/ModulesChip/ModuleChip';
53
58
 
54
59
  // Utils imports
55
60
  import { checkEmpty } from './utils/checkEmpty/checkEmpty';
@@ -93,7 +98,7 @@ export {
93
98
  Table,
94
99
  RadioButton,
95
100
  RadioGroup,
96
- Form,
101
+ Forms,
97
102
  MiniModal,
98
103
  Container,
99
104
  Row,
@@ -120,7 +125,12 @@ export {
120
125
  MachineInputField,
121
126
  SequentialConnectingBranch,
122
127
  AttachmentButton,
128
+ LabelEditTextField,
129
+ ExcelFile,
123
130
  IconRadioGroup,
131
+ Toastify,
132
+ toast,
133
+ ModuleChip,
124
134
 
125
135
  // utils exports
126
136
  checkEmpty,
@@ -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
+ };
@@ -1,78 +0,0 @@
1
- import { CellBase } from "./ExcelFile/Excel";
2
-
3
- interface ChangeExcelStylesOptions {
4
- sheetName: string;
5
- styleType: string;
6
- value: string;
7
- selectedCell: { row: number; column: number }[];
8
- }
9
-
10
- export default function ChangeExcelStyles(
11
- setWorksheetsData: React.Dispatch<React.SetStateAction<{ [key: string]: Matrix<CellBase>; }>>,
12
- options: ChangeExcelStylesOptions
13
- ) {
14
- const { sheetName, styleType, value, selectedCell } = options;
15
-
16
- setWorksheetsData((prev) => {
17
- if (!prev[sheetName]) {
18
- return prev;
19
- }
20
-
21
- const sheetData = prev[sheetName]!;
22
- const selectedCells = new Set(
23
- selectedCell.map(({ row, column }) => `${row}-${column}`)
24
- );
25
-
26
- const updatedSheetData: Matrix<CellBase> = sheetData.map((row, rowIndex) =>
27
- row.map((cell, columnIndex) => {
28
- const isSelected = selectedCells.has(`${rowIndex}-${columnIndex}`);
29
- if (isSelected&&cell!==undefined) {
30
- let newStyle = { ...cell.style };
31
-
32
- switch (styleType) {
33
- // case 'border':
34
- // newStyle = handleBorderChange(newStyle, value);
35
- // break;
36
- // case 'alignment':
37
- // newStyle = handleAlignmentChange(newStyle, value);
38
- // break;
39
- // case 'bold':
40
- // newStyle = handleBoldChange(newStyle);
41
- // break;
42
- // case 'italic':
43
- // newStyle = handleItalicChange(newStyle);
44
- // break;
45
- case 'color':
46
- newStyle = handleColorChange(newStyle, value);
47
- break;
48
- case 'backgroundColor':
49
- newStyle = handleBackgroundColorChange(newStyle, value);
50
- break;
51
- default:
52
- break;
53
- }
54
-
55
- const newValue = cell.value ?? "";
56
-
57
- return { ...cell, style: newStyle, value: newValue };
58
- }
59
- return cell;
60
- })
61
- );
62
-
63
-
64
-
65
- return { ...prev, [sheetName]: updatedSheetData };
66
- });
67
- }
68
-
69
- function handleColorChange(style: CellStyle, value: string): CellStyle {
70
- return { ...style, color: `#${value}` };
71
- }
72
-
73
- function handleBackgroundColorChange(
74
- style: CellStyle,
75
- value: string
76
- ): CellStyle {
77
- return { ...style, backgroundColor: `#${value}` };
78
- }
@@ -1,86 +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
-
20
- interface CellData {
21
- style?: CellStyle;
22
- }
23
-
24
- type ImportExcelStylesData = Array<Array<CellData>>;
25
-
26
- export default function ImportExcelStyles(data: ImportExcelStylesData | null) {
27
- const getTable = document.querySelector(
28
- '.Spreadsheet__table'
29
- ) as HTMLTableElement | null;
30
-
31
- if (!getTable) {
32
- return;
33
- }
34
-
35
- const tableRows = getTable.querySelectorAll('tr');
36
- const tableHeader = getTable.querySelectorAll('th');
37
-
38
- tableHeader.forEach((cell) => {
39
- const cellText = cell.innerText.trim();
40
- const isNumber = !isNaN(Number(cellText));
41
- cell.style.width = isNumber ? '50px' : '150px';
42
- });
43
-
44
- if (data) {
45
- data.forEach((row, rowIndex) => {
46
- const rowData = tableRows[rowIndex + 1] as
47
- | HTMLTableRowElement
48
- | undefined;
49
-
50
- if (!rowData) return;
51
-
52
- const colData = rowData.querySelectorAll('.Spreadsheet__cell');
53
-
54
- row.forEach((column, columnIndex) => {
55
- if (colData[columnIndex] && column.style) {
56
- const {
57
- color,
58
- backgroundColor,
59
- bold,
60
- italic,
61
- name,
62
- border,
63
- alignment,
64
- } = column.style;
65
- const cell = colData[columnIndex] as HTMLElement;
66
- cell.style.color = color ? `#${color}` : '';
67
- cell.style.backgroundColor = backgroundColor
68
- ? `#${backgroundColor}`
69
- : 'white';
70
- cell.style.fontWeight = bold ? 'bolder' : 'normal';
71
- cell.style.fontStyle = italic ? 'italic' : 'normal';
72
- cell.style.fontFamily = name || '';
73
- cell.style.borderLeft =
74
- border.left === 'NONE' ? '' : `2px solid ${'black'}`;
75
- cell.style.borderRight =
76
- border.right === 'NONE' ? '' : `2px solid ${'black'}`;
77
- cell.style.borderBottom =
78
- border.bottom === 'NONE' ? '' : `2px solid ${'black'}`;
79
- cell.style.borderTop =
80
- border.top === 'NONE' ? '' : `2px solid ${'black'}`;
81
- cell.style.textAlign = alignment?.horizontal || 'left';
82
- }
83
- });
84
- });
85
- }
86
- }
@@ -1,57 +0,0 @@
1
- import React from 'react';
2
- import {
3
- useForm,
4
- UseFormProps,
5
- SubmitHandler,
6
- FieldValues,
7
- FieldPath,
8
- FieldErrors,
9
- } from 'react-hook-form';
10
- import './Form.scss';
11
-
12
- interface FormProps<T extends FieldValues> extends UseFormProps<T> {
13
- onSubmit: SubmitHandler<T>;
14
- children: (props: {
15
- register: (name: FieldPath<T>, options?: any) => any;
16
- errors: FieldErrors<T>;
17
- handleBlur: (field: FieldPath<T>) => void;
18
- getValues: () => T;
19
- watch: (field?: FieldPath<T>) => any;
20
- setValue: (field: FieldPath<T>, value: any, options?: object) => void;
21
- }) => React.ReactNode;
22
- }
23
-
24
- const Form = <T extends FieldValues>({
25
- onSubmit,
26
- children,
27
- ...rest
28
- }: FormProps<T>) => {
29
- const {
30
- register,
31
- handleSubmit,
32
- formState: { errors },
33
- trigger,
34
- getValues,
35
- watch,
36
- setValue
37
- } = useForm<T>(rest);
38
-
39
- const handleBlur = async (field: FieldPath<T>) => {
40
- await trigger(field);
41
- };
42
-
43
- return (
44
- <form onSubmit={handleSubmit(onSubmit)}>
45
- {children({
46
- register,
47
- errors,
48
- handleBlur,
49
- getValues,
50
- watch,
51
- setValue,
52
- })}
53
- </form>
54
- );
55
- };
56
-
57
- export default Form;