pixel-react 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/AppHeader/types.d.ts +11 -2
- package/lib/components/Avatar/Avatar.d.ts +5 -0
- package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
- package/lib/components/Avatar/index.d.ts +1 -0
- package/lib/components/Avatar/types.d.ts +26 -0
- package/lib/components/ExcelFile/ExcelFile/Excel/ActiveCell.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Copied.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/CornerIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataEditor.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/DataViewer.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/FloatingRect.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/HeaderRow.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Row.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/RowIndicator.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/Selected.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/Spreadsheet.d.ts +6 -7
- package/lib/components/ExcelFile/ExcelFile/Excel/Table.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/actions.d.ts +49 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/context.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/engine.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/formula.d.ts +6 -6
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/index.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-graph.d.ts +2 -2
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-hash.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/engine/point-set.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/index.d.ts +11 -11
- package/lib/components/ExcelFile/ExcelFile/Excel/matrix.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/point-range.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/reducer.d.ts +5 -5
- package/lib/components/ExcelFile/ExcelFile/Excel/selection.d.ts +3 -3
- package/lib/components/ExcelFile/ExcelFile/Excel/types.d.ts +11 -48
- package/lib/components/ExcelFile/ExcelFile/Excel/use-dispatch.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/use-selector.d.ts +1 -1
- package/lib/components/ExcelFile/ExcelFile/Excel/util.d.ts +11 -12
- package/lib/components/ExcelFile/ExcelFile/ExcelFile.d.ts +16 -0
- package/lib/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.d.ts +0 -3
- package/lib/components/ExcelFile/ExcelToolBar/ExcelToolBar.d.ts +12 -0
- package/lib/components/ExcelFile/Types.d.ts +2 -49
- package/lib/components/Form/Form.d.ts +1 -15
- package/lib/components/Form/Form.stories.d.ts +6 -5
- package/lib/components/Form/Forms.d.ts +8 -0
- package/lib/components/Form/index.d.ts +1 -1
- package/lib/components/MenuOption/types.d.ts +7 -7
- package/lib/components/ModulesChip/ModuleChip.d.ts +4 -0
- package/lib/components/ModulesChip/ModuleChip.stories.d.ts +6 -0
- package/lib/components/ModulesChip/index.d.ts +1 -0
- package/lib/components/ModulesChip/types.d.ts +14 -0
- package/lib/components/MultiSelect/MultiSelectTypes.d.ts +1 -0
- package/lib/components/Toastify/Toastify.d.ts +8 -0
- package/lib/components/Toastify/Toastify.stories.d.ts +6 -0
- package/lib/components/Toastify/index.d.ts +1 -0
- package/lib/components/Toastify/types.d.ts +7 -0
- package/lib/components/Tooltip/types.d.ts +6 -0
- package/lib/components/Typography/types.d.ts +1 -0
- package/lib/index.d.ts +75 -22
- package/lib/index.esm.js +26686 -870
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +26684 -864
- package/lib/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/StyleGuide/ColorPalette/colorPaletteList.ts +10 -0
- package/src/assets/Themes/BaseTheme.scss +2 -0
- package/src/assets/Themes/DarkTheme.scss +2 -0
- package/src/assets/icons/client_profile.svg +4 -0
- package/src/assets/icons/fireflink_finder_logo.svg +7 -0
- package/src/assets/icons/fireflink_platform.svg +4 -0
- package/src/assets/icons/license_expired.svg +20 -0
- package/src/components/AppHeader/AppHeader.stories.tsx +24 -3
- package/src/components/AppHeader/AppHeader.tsx +29 -11
- package/src/components/AppHeader/types.ts +11 -3
- package/src/components/Avatar/Avatar.scss +24 -0
- package/src/components/Avatar/Avatar.stories.tsx +56 -0
- package/src/components/Avatar/Avatar.tsx +25 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Avatar/types.ts +27 -0
- package/src/components/ExcelFile/ColorBarselector/ColorBarSelector.scss +0 -2
- package/src/components/ExcelFile/ContextMenu/ContextMenu.scss +1 -4
- package/src/components/ExcelFile/ContextMenu/ContextMenu.tsx +0 -1
- package/src/components/ExcelFile/ExcelFile/Excel/ActiveCell.tsx +13 -13
- package/src/components/ExcelFile/ExcelFile/Excel/Cell.tsx +13 -12
- package/src/components/ExcelFile/ExcelFile/Excel/ColumnIndicator.tsx +40 -32
- package/src/components/ExcelFile/ExcelFile/Excel/Copied.tsx +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/CornerIndicator.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/DataEditor.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/DataViewer.tsx +10 -10
- package/src/components/ExcelFile/ExcelFile/Excel/FloatingRect.tsx +6 -6
- package/src/components/ExcelFile/ExcelFile/Excel/HeaderRow.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/Row.tsx +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/RowIndicator.tsx +34 -27
- package/src/components/ExcelFile/ExcelFile/Excel/Selected.tsx +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/{Spreadsheet.css → Spreadsheet.scss} +21 -37
- package/src/components/ExcelFile/ExcelFile/Excel/Spreadsheet.tsx +87 -78
- package/src/components/ExcelFile/ExcelFile/Excel/Table.tsx +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/actions.ts +121 -31
- package/src/components/ExcelFile/ExcelFile/Excel/areModelsEqual.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/context.ts +4 -4
- package/src/components/ExcelFile/ExcelFile/Excel/engine/engine.ts +7 -7
- package/src/components/ExcelFile/ExcelFile/Excel/engine/formula.ts +11 -11
- package/src/components/ExcelFile/ExcelFile/Excel/engine/index.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-graph.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-hash.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/engine/point-set.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/index.ts +12 -11
- package/src/components/ExcelFile/ExcelFile/Excel/matrix.ts +18 -24
- package/src/components/ExcelFile/ExcelFile/Excel/point-range.ts +1 -1
- package/src/components/ExcelFile/ExcelFile/Excel/reducer.ts +311 -41
- package/src/components/ExcelFile/ExcelFile/Excel/selection.ts +5 -5
- package/src/components/ExcelFile/ExcelFile/Excel/types.ts +14 -66
- package/src/components/ExcelFile/ExcelFile/Excel/typings/fast-formula-parser.d.ts +8 -8
- package/src/components/ExcelFile/ExcelFile/Excel/use-dispatch.ts +2 -2
- package/src/components/ExcelFile/ExcelFile/Excel/use-selector.ts +3 -3
- package/src/components/ExcelFile/ExcelFile/Excel/util.ts +21 -22
- package/src/components/ExcelFile/ExcelFile/ExcelFile.scss +0 -3
- package/src/components/ExcelFile/ExcelFile/ExcelFile.tsx +45 -403
- package/src/components/ExcelFile/ExcelFile.stories.tsx +10 -29
- package/src/components/ExcelFile/ExcelSheetBar/ExcelSheetBar.tsx +1 -12
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.scss +0 -3
- package/src/components/ExcelFile/ExcelToolBar/ExcelToolBar.tsx +147 -127
- package/src/components/ExcelFile/Types.ts +3 -70
- package/src/components/ExcelFile/index.ts +1 -1
- package/src/components/Form/Form.d.ts +3 -0
- package/src/components/Form/Form.scss +31 -4
- package/src/components/Form/Form.stories.tsx +172 -138
- package/src/components/Form/Form.ts +2 -0
- package/src/components/Form/Forms.tsx +25 -0
- package/src/components/Form/index.ts +1 -1
- package/src/components/Icon/iconList.ts +8 -0
- package/src/components/IconButton/IconButton.scss +1 -1
- package/src/components/MenuOption/types.ts +7 -6
- package/src/components/ModulesChip/ModuleChip.scss +20 -0
- package/src/components/ModulesChip/ModuleChip.stories.tsx +41 -0
- package/src/components/ModulesChip/ModuleChip.tsx +31 -0
- package/src/components/ModulesChip/index.ts +1 -0
- package/src/components/ModulesChip/types.ts +14 -0
- package/src/components/MultiSelect/Dropdown.tsx +6 -1
- package/src/components/MultiSelect/MultiSelect.scss +17 -10
- package/src/components/MultiSelect/MultiSelect.stories.tsx +16 -4
- package/src/components/MultiSelect/MultiSelect.tsx +11 -4
- package/src/components/MultiSelect/MultiSelectTypes.ts +4 -3
- package/src/components/Select/Select.scss +4 -0
- package/src/components/Select/Select.tsx +2 -2
- package/src/components/Toastify/Toastify.stories.tsx +52 -0
- package/src/components/Toastify/Toastify.tsx +66 -0
- package/src/components/Toastify/index.ts +1 -0
- package/src/components/Toastify/types.ts +8 -0
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/Tooltip/types.ts +6 -0
- package/src/components/Typography/Typography.scss +12 -4
- package/src/components/Typography/Typography.stories.tsx +2 -0
- package/src/components/Typography/Typography.tsx +2 -0
- package/src/components/Typography/types.ts +1 -0
- package/src/index.ts +10 -2
- package/src/components/ExcelFile/ChangeExcelStyles.tsx +0 -78
- package/src/components/ExcelFile/ImportExcelStyles.tsx +0 -86
- package/src/components/Form/Form.tsx +0 -57
@@ -55,13 +55,25 @@ export const Default3: Story = {
|
|
55
55
|
export const EmailGroup: Story = {
|
56
56
|
render: () => {
|
57
57
|
const [options] = useState([
|
58
|
-
{
|
58
|
+
{
|
59
|
+
label: 'Sample1@gmail.com',
|
60
|
+
value: 'sample1@gmail.com',
|
61
|
+
isDisabled: true,
|
62
|
+
},
|
59
63
|
{ label: 'Sample2@gmail.com', value: 'sample2@gmail.com' },
|
60
64
|
]);
|
61
65
|
const [selectedOptions, setSelectedOptions] = useState<
|
62
|
-
{ label?: string; value?: string }[]
|
63
|
-
>([
|
64
|
-
|
66
|
+
{ label?: string; value?: string; isDisabled?: boolean }[]
|
67
|
+
>([
|
68
|
+
{
|
69
|
+
label: 'Sample1@gmail.com',
|
70
|
+
value: 'sample1@gmail.com',
|
71
|
+
isDisabled: true,
|
72
|
+
},
|
73
|
+
]);
|
74
|
+
const onChange = (
|
75
|
+
options: { label?: string; value?: string; isDisabled?: boolean }[]
|
76
|
+
) => {
|
65
77
|
setSelectedOptions(options);
|
66
78
|
};
|
67
79
|
return (
|
@@ -5,6 +5,7 @@ import './MultiSelect.scss';
|
|
5
5
|
import Dropdown from './Dropdown';
|
6
6
|
import Icon from '../Icon';
|
7
7
|
import { MultiSelectProps, Option } from './MultiSelectTypes';
|
8
|
+
import Typography from '../Typography';
|
8
9
|
|
9
10
|
const ChipElement = ({
|
10
11
|
label,
|
@@ -22,6 +23,8 @@ const ChipElement = ({
|
|
22
23
|
className="ff-multiselect-chip-close-icon"
|
23
24
|
onClick={onChipCloseClick}
|
24
25
|
name="close_pill"
|
26
|
+
height={13} //as per the latest chnages in icon container we have to give this
|
27
|
+
width={13}
|
25
28
|
/>
|
26
29
|
</div>
|
27
30
|
);
|
@@ -46,6 +49,9 @@ const MultiSelect = ({
|
|
46
49
|
}: MultiSelectProps) => {
|
47
50
|
const [isOpen, setIsOpen] = useState<boolean>(false);
|
48
51
|
const [allOptions, setAllOptions] = useState(options);
|
52
|
+
useEffect(() => {
|
53
|
+
setAllOptions(options);
|
54
|
+
}, [options]);
|
49
55
|
|
50
56
|
const [searchedKeyword, setSearchedKeyword] = useState('');
|
51
57
|
const [isSelectFocusedOnce, setIsSelectFocusedOnce] =
|
@@ -236,7 +242,8 @@ const MultiSelect = ({
|
|
236
242
|
>
|
237
243
|
<div className="ff-multiselect" onClick={handleClick}>
|
238
244
|
<div className="ff-multiselect__main">
|
239
|
-
<
|
245
|
+
<Typography
|
246
|
+
as="span"
|
240
247
|
className={classNames({
|
241
248
|
'active-default-label':
|
242
249
|
isOpen ||
|
@@ -244,9 +251,9 @@ const MultiSelect = ({
|
|
244
251
|
(isFieldSkipped && required),
|
245
252
|
'default-label': !isOpen && !selectedOptions?.length,
|
246
253
|
})}
|
247
|
-
|
248
|
-
|
249
|
-
|
254
|
+
children={label}
|
255
|
+
/>
|
256
|
+
|
250
257
|
<div className="ff-multiselect-chip-container">
|
251
258
|
{displayCount ? (
|
252
259
|
<>
|
@@ -3,10 +3,11 @@ interface Option {
|
|
3
3
|
value?: string;
|
4
4
|
accessor?: string;
|
5
5
|
isChecked?: boolean;
|
6
|
+
isDisabled?: boolean;
|
6
7
|
}
|
7
8
|
interface MultiSelectProps {
|
8
9
|
options: Option[];
|
9
|
-
type
|
10
|
+
type?: 'email' | 'text';
|
10
11
|
label: string;
|
11
12
|
selectedOptions?: Option[];
|
12
13
|
disabled?: boolean;
|
@@ -18,7 +19,7 @@ interface MultiSelectProps {
|
|
18
19
|
errorMessage?: string;
|
19
20
|
withSelectButton?: boolean;
|
20
21
|
onSelect?: () => void;
|
21
|
-
displayCount?:boolean;
|
22
|
+
displayCount?: boolean;
|
22
23
|
}
|
23
24
|
|
24
|
-
export { Option, MultiSelectProps };
|
25
|
+
export { Option, MultiSelectProps };
|
@@ -254,8 +254,8 @@ const Select = ({
|
|
254
254
|
const applyActiveOptionClasses = !isInputFocused && Boolean(option);
|
255
255
|
|
256
256
|
return (
|
257
|
-
<div className={classNames(`ff-select-wrapper
|
258
|
-
<div className=
|
257
|
+
<div className={classNames(`ff-select-wrapper`)}>
|
258
|
+
<div className={`ff-select ${className}`}>
|
259
259
|
<input
|
260
260
|
type="text"
|
261
261
|
className={classNames('ff-select-input', {
|
@@ -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';
|
@@ -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
|
})}
|
@@ -6,28 +6,32 @@
|
|
6
6
|
@font-face {
|
7
7
|
font-family: 'Poppins';
|
8
8
|
font-weight: 400;
|
9
|
-
src:
|
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:
|
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:
|
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:
|
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
|
);
|
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
|
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,7 +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
|
+
|
53
55
|
import LabelEditTextField from './components/LabelEditTextField';
|
56
|
+
import ExcelFile from './components/ExcelFile';
|
57
|
+
import ModuleChip from './components/ModulesChip/ModuleChip';
|
54
58
|
|
55
59
|
// Utils imports
|
56
60
|
import { checkEmpty } from './utils/checkEmpty/checkEmpty';
|
@@ -94,7 +98,7 @@ export {
|
|
94
98
|
Table,
|
95
99
|
RadioButton,
|
96
100
|
RadioGroup,
|
97
|
-
|
101
|
+
Forms,
|
98
102
|
MiniModal,
|
99
103
|
Container,
|
100
104
|
Row,
|
@@ -122,7 +126,11 @@ export {
|
|
122
126
|
SequentialConnectingBranch,
|
123
127
|
AttachmentButton,
|
124
128
|
LabelEditTextField,
|
129
|
+
ExcelFile,
|
125
130
|
IconRadioGroup,
|
131
|
+
Toastify,
|
132
|
+
toast,
|
133
|
+
ModuleChip,
|
126
134
|
|
127
135
|
// utils exports
|
128
136
|
checkEmpty,
|
@@ -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;
|