@am92/react-design-system 2.7.7 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Components/DsAppBar/DsAppBar.Component.d.ts +2 -5
- package/dist/Components/DsAppBar/DsAppBar.Component.js +19 -24
- package/dist/Components/DsBottomSheet/DsBottomSheet.Component.d.ts +2 -7
- package/dist/Components/DsBottomSheet/DsBottomSheet.Component.js +62 -65
- package/dist/Components/DsButton/DsButton.Component.d.ts +2 -4
- package/dist/Components/DsButton/DsButton.Component.js +4 -7
- package/dist/Components/DsButton/DsButton.Overrides.js +2 -2
- package/dist/Components/DsButtonGroup/DsButtonGroup.Component.d.ts +2 -6
- package/dist/Components/DsButtonGroup/DsButtonGroup.Component.js +16 -18
- package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselNavigation.d.ts +2 -3
- package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselNavigation.js +42 -44
- package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselPagination.d.ts +2 -6
- package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselPagination.js +109 -110
- package/dist/Components/DsCarousel/DsCarousel.Component/index.d.ts +3 -19
- package/dist/Components/DsCarousel/DsCarousel.Component/index.js +55 -57
- package/dist/Components/DsChip/DsChip.Component.d.ts +1 -6
- package/dist/Components/DsChip/DsChip.Component.js +1 -10
- package/dist/Components/DsChip/DsChip.Types.d.ts +1 -0
- package/dist/Components/DsChip/DsChip.Types.js +2 -1
- package/dist/Components/DsChipGroup/DsChipGroup.Component.d.ts +2 -5
- package/dist/Components/DsChipGroup/DsChipGroup.Component.js +5 -8
- package/dist/Components/DsContentSlider/DsContentSlider.Component.d.ts +3 -8
- package/dist/Components/DsContentSlider/DsContentSlider.Component.js +13 -20
- package/dist/Components/DsDialog/DsDialog.Component.d.ts +1 -6
- package/dist/Components/DsDialog/DsDialog.Component.js +71 -75
- package/dist/Components/DsDialog/DsDialog.Overrides.d.ts +1 -0
- package/dist/Components/DsDialog/DsDialog.Overrides.js +2 -0
- package/dist/Components/DsDivider/DsDivider.Overrides.js +6 -0
- package/dist/Components/DsFileUploader/DsFileUploader.Component.d.ts +3 -16
- package/dist/Components/DsFileUploader/DsFileUploader.Component.js +68 -71
- package/dist/Components/DsHeader/DsHeader.Component.d.ts +2 -5
- package/dist/Components/DsHeader/DsHeader.Component.js +29 -32
- package/dist/Components/DsHelperText/DsHelperText.Component.d.ts +2 -5
- package/dist/Components/DsHelperText/DsHelperText.Component.js +16 -21
- package/dist/Components/DsHelperText/DsHelperText.Overrides.d.ts +5 -1
- package/dist/Components/DsHelperText/DsHelperText.Overrides.js +6 -1
- package/dist/Components/DsImage/DsImage.Component.d.ts +3 -12
- package/dist/Components/DsImage/DsImage.Component.js +40 -45
- package/dist/Components/DsImage/DsImage.Types.d.ts +0 -1
- package/dist/Components/DsImage/DsImage.Types.js +0 -3
- package/dist/Components/DsInputLabel/DsInputLabel.Component.d.ts +2 -4
- package/dist/Components/DsInputLabel/DsInputLabel.Component.js +6 -9
- package/dist/Components/DsNotistack/AlertMessage.Component.js +7 -9
- package/dist/Components/DsNotistack/DsNotistack.Component.d.ts +2 -7
- package/dist/Components/DsNotistack/DsNotistack.Component.js +12 -16
- package/dist/Components/DsNotistack/DsNotistack.Types.d.ts +1 -0
- package/dist/Components/DsNotistack/DsNotistack.Types.js +3 -1
- package/dist/Components/DsOtp/DsOtp.Component.d.ts +3 -15
- package/dist/Components/DsOtp/DsOtp.Component.js +41 -51
- package/dist/Components/DsPopup/DsPopup.Types.d.ts +1 -1
- package/dist/Components/DsProgressIndicator/DsProgressIndicator.Component.d.ts +2 -6
- package/dist/Components/DsProgressIndicator/DsProgressIndicator.Component.js +18 -21
- package/dist/Components/DsProgressTracker/DsProgressStepper.Component.d.ts +3 -9
- package/dist/Components/DsProgressTracker/DsProgressStepper.Component.js +8 -11
- package/dist/Components/DsProgressTracker/DsProgressTracker.Component.d.ts +3 -21
- package/dist/Components/DsProgressTracker/DsProgressTracker.Component.js +17 -26
- package/dist/Components/DsRadio/DsRadio.Component.d.ts +2 -5
- package/dist/Components/DsRadio/DsRadio.Component.js +5 -8
- package/dist/Components/DsRadio/DsRadio.Overrides.d.ts +9 -1
- package/dist/Components/DsRadio/DsRadio.Overrides.js +9 -1
- package/dist/Components/DsRadioGroup/DsRadioGroup.Component.d.ts +3 -1
- package/dist/Components/DsRadioGroup/DsRadioGroup.Component.js +10 -1
- package/dist/Components/DsRemixIcon/DsRemixIcon.Component.d.ts +2 -4
- package/dist/Components/DsRemixIcon/DsRemixIcon.Component.js +5 -7
- package/dist/Components/DsSelect/DsSelect.Component.d.ts +2 -6
- package/dist/Components/DsSelect/DsSelect.Component.js +49 -53
- package/dist/Components/DsSelect/DsSelect.Overrides.d.ts +3 -0
- package/dist/Components/DsSelect/DsSelect.Overrides.js +4 -1
- package/dist/Components/DsSelect/DsSelect.Types.d.ts +8 -0
- package/dist/Components/DsSelect/DsSelect.Types.js +1 -1
- package/dist/Components/DsSlider/DsSlider.Component.d.ts +1 -5
- package/dist/Components/DsSlider/DsSlider.Component.js +1 -10
- package/dist/Components/DsSlider/DsSlider.Overrides.d.ts +1 -1
- package/dist/Components/DsSlider/DsSlider.Overrides.js +2 -2
- package/dist/Components/DsStepConnector/DsStepConnector.Overrides.d.ts +2 -1
- package/dist/Components/DsStepConnector/DsStepConnector.Overrides.js +9 -2
- package/dist/Components/DsStepLabel/DsStepLabel.Overrides.js +4 -4
- package/dist/Components/DsSwitch/DsSwitch.Component.d.ts +2 -6
- package/dist/Components/DsSwitch/DsSwitch.Component.js +7 -10
- package/dist/Components/DsTag/DsTag.Component.d.ts +2 -7
- package/dist/Components/DsTag/DsTag.Component.js +10 -13
- package/dist/Components/DsTagGroup/DsTagGroup.Component.d.ts +2 -7
- package/dist/Components/DsTagGroup/DsTagGroup.Component.js +25 -27
- package/dist/Components/DsTextArea/DsTextArea.Component.d.ts +3 -10
- package/dist/Components/DsTextArea/DsTextArea.Component.js +49 -54
- package/dist/Components/DsTextArea/DsTextArea.Types.d.ts +0 -1
- package/dist/Components/DsTextArea/DsTextArea.Types.js +1 -3
- package/dist/Components/DsTextField/DsTextField.Component.d.ts +2 -4
- package/dist/Components/DsTextField/DsTextField.Component.js +7 -8
- package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Component.d.ts +3 -10
- package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Component.js +15 -26
- package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Types.d.ts +0 -1
- package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Types.js +0 -3
- package/dist/Components/DsToast/DsToast.Component.d.ts +2 -4
- package/dist/Components/DsToast/DsToast.Component.js +9 -7
- package/dist/Components/DsToggle/DsToggle.Component.d.ts +2 -5
- package/dist/Components/DsToggle/DsToggle.Component.js +11 -9
- package/dist/Components/DsToggle/DsToggle.Types.js +1 -1
- package/dist/Components/DsTooltip/DsTooltip.Component.d.ts +2 -5
- package/dist/Components/DsTooltip/DsTooltip.Component.js +7 -9
- package/dist/Theme/componentOverrides.d.ts +15 -5
- package/dist/Theme/getColorScheme/dark.js +4 -4
- package/dist/Theme/getColorScheme/highContrast.js +1 -1
- package/dist/Theme/getColorScheme/light.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { DsDialogDefaultProps } from './DsDialog.Types';
|
|
4
2
|
import { DsDialogTitle } from '../DsDialogTitle';
|
|
5
3
|
import { Dialog } from '@mui/material';
|
|
6
4
|
import { DsIconButton } from '../DsIconButton';
|
|
@@ -9,90 +7,88 @@ import { DsTypography } from '../DsTypography';
|
|
|
9
7
|
import { DsDialogContent } from '../DsDialogContent';
|
|
10
8
|
import { DsDialogActions } from '../DsDialogActions';
|
|
11
9
|
import { DsButton } from '../DsButton';
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const { onClose } = this.props;
|
|
10
|
+
export const DsDialog = (props) => {
|
|
11
|
+
const handleDialogClose = (event, reason) => {
|
|
12
|
+
const { onClose } = props;
|
|
16
13
|
if (typeof onClose === 'function') {
|
|
17
14
|
onClose(event, reason);
|
|
18
15
|
}
|
|
19
16
|
};
|
|
20
|
-
handleCloseClick = (event) => {
|
|
21
|
-
const { onClose } =
|
|
17
|
+
const handleCloseClick = (event) => {
|
|
18
|
+
const { onClose } = props;
|
|
22
19
|
if (typeof onClose === 'function') {
|
|
23
20
|
onClose(event, 'backdropClick');
|
|
24
21
|
}
|
|
25
22
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
23
|
+
const { title, description, showClose, primaryButtonText, primaryButtonProps, secondaryButtonText, secondaryButtonProps, PaperProps, TitleProps, DescriptionProps, CloseIconButtonProps, CloseIconProps, ContentProps, ActionsProps, children, ...DialogProps } = props;
|
|
24
|
+
console.log('props', props);
|
|
25
|
+
const actionsAvailable = !!(primaryButtonText || secondaryButtonText);
|
|
26
|
+
const accessibilityProps = {};
|
|
27
|
+
const isFlushed = primaryButtonText &&
|
|
28
|
+
!secondaryButtonText &&
|
|
29
|
+
primaryButtonProps &&
|
|
30
|
+
primaryButtonProps?.variant === 'flushed';
|
|
31
|
+
if (title) {
|
|
32
|
+
accessibilityProps['aria-labelledby'] = title;
|
|
33
|
+
}
|
|
34
|
+
if (description) {
|
|
35
|
+
accessibilityProps['aria-describedby'] = description;
|
|
36
|
+
}
|
|
37
|
+
return (_jsxs(Dialog, { keepMounted: true, ...accessibilityProps, ...DialogProps, PaperProps: {
|
|
38
|
+
...PaperProps,
|
|
39
|
+
sx: {
|
|
40
|
+
pb: isFlushed
|
|
41
|
+
? undefined
|
|
42
|
+
: {
|
|
43
|
+
xs: 'var(--ds-spacing-bitterCold)',
|
|
44
|
+
md: 'var(--ds-spacing-warm)'
|
|
45
|
+
},
|
|
46
|
+
pt: {
|
|
47
|
+
xs: 'var(--ds-spacing-mild)',
|
|
48
|
+
md: 'var(--ds-spacing-warm)'
|
|
49
|
+
},
|
|
50
|
+
...PaperProps?.sx
|
|
51
|
+
}
|
|
52
|
+
}, children: [title && (_jsx(DsDialogTitle, { ...TitleProps, sx: {
|
|
53
|
+
width: showClose ? 'calc(100% - 44px)' : '100%',
|
|
54
|
+
px: {
|
|
55
|
+
xs: 'var(--ds-spacing-bitterCold)',
|
|
56
|
+
md: 'var(--ds-spacing-warm)'
|
|
57
|
+
},
|
|
58
|
+
...TitleProps?.sx
|
|
59
|
+
}, children: title })), description && (_jsx(DsTypography, { variant: "subheadingSemiboldDefault", color: "text.secondary", ...DescriptionProps, sx: {
|
|
60
|
+
px: {
|
|
61
|
+
xs: 'var(--ds-spacing-bitterCold)',
|
|
62
|
+
md: 'var(--ds-spacing-warm)'
|
|
63
|
+
},
|
|
64
|
+
...DescriptionProps?.sx
|
|
65
|
+
}, children: description })), showClose && (_jsx(DsIconButton, { onClick: handleCloseClick, ...CloseIconButtonProps, sx: {
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
padding: 'var(--ds-spacing-quickFreeze)',
|
|
68
|
+
borderRadius: 'var(--ds-radius-mild)',
|
|
69
|
+
top: {
|
|
50
70
|
xs: 'var(--ds-spacing-mild)',
|
|
51
71
|
md: 'var(--ds-spacing-warm)'
|
|
52
72
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
position: 'absolute',
|
|
70
|
-
padding: 'var(--ds-spacing-quickFreeze)',
|
|
71
|
-
borderRadius: 'var(--ds-radius-mild)',
|
|
72
|
-
top: {
|
|
73
|
-
xs: 'var(--ds-spacing-mild)',
|
|
74
|
-
md: 'var(--ds-spacing-warm)'
|
|
75
|
-
},
|
|
76
|
-
right: {
|
|
77
|
-
xs: 'var(--ds-spacing-bitterCold)',
|
|
78
|
-
md: 'var(--ds-spacing-warm)'
|
|
79
|
-
},
|
|
80
|
-
...CloseIconButtonProps?.sx
|
|
81
|
-
}, children: _jsx(DsRemixIcon, { className: "ri-close-line", ...CloseIconProps }) })), children && (_jsx(DsDialogContent, { ...ContentProps, sx: {
|
|
82
|
-
px: {
|
|
73
|
+
right: {
|
|
74
|
+
xs: 'var(--ds-spacing-bitterCold)',
|
|
75
|
+
md: 'var(--ds-spacing-warm)'
|
|
76
|
+
},
|
|
77
|
+
...CloseIconButtonProps?.sx
|
|
78
|
+
}, children: _jsx(DsRemixIcon, { className: "ri-close-line", ...CloseIconProps }) })), children && (_jsx(DsDialogContent, { ...ContentProps, sx: {
|
|
79
|
+
px: {
|
|
80
|
+
xs: 'var(--ds-spacing-bitterCold)',
|
|
81
|
+
md: 'var(--ds-spacing-warm)'
|
|
82
|
+
},
|
|
83
|
+
marginTop: 'var(--ds-spacing-mild)',
|
|
84
|
+
...ContentProps?.sx
|
|
85
|
+
}, children: children })), actionsAvailable && (_jsxs(DsDialogActions, { ...ActionsProps, sx: {
|
|
86
|
+
px: isFlushed
|
|
87
|
+
? undefined
|
|
88
|
+
: {
|
|
83
89
|
xs: 'var(--ds-spacing-bitterCold)',
|
|
84
90
|
md: 'var(--ds-spacing-warm)'
|
|
85
91
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
px: isFlushed
|
|
90
|
-
? undefined
|
|
91
|
-
: {
|
|
92
|
-
xs: 'var(--ds-spacing-bitterCold)',
|
|
93
|
-
md: 'var(--ds-spacing-warm)'
|
|
94
|
-
},
|
|
95
|
-
...ActionsProps?.sx
|
|
96
|
-
}, children: [(secondaryButtonText || secondaryButtonProps?.children) && (_jsx(DsButton, { color: "secondary", size: "large", fullWidth: true, ...secondaryButtonProps, children: secondaryButtonText || secondaryButtonProps?.children })), (primaryButtonText || primaryButtonProps?.children) && (_jsx(DsButton, { size: "large", fullWidth: true, ...primaryButtonProps, children: primaryButtonText || primaryButtonProps?.children }))] }))] }));
|
|
97
|
-
}
|
|
98
|
-
}
|
|
92
|
+
...ActionsProps?.sx
|
|
93
|
+
}, children: [(secondaryButtonText || secondaryButtonProps?.children) && (_jsx(DsButton, { color: "secondary", size: "large", fullWidth: true, ...secondaryButtonProps, children: secondaryButtonText || secondaryButtonProps?.children })), (primaryButtonText || primaryButtonProps?.children) && (_jsx(DsButton, { size: "large", fullWidth: true, ...primaryButtonProps, children: primaryButtonText || primaryButtonProps?.children }))] }))] }));
|
|
94
|
+
};
|
|
@@ -19,6 +19,9 @@ export const DsDividerOverrides = {
|
|
|
19
19
|
},
|
|
20
20
|
'&::after': {
|
|
21
21
|
borderWidth: '0.5px'
|
|
22
|
+
},
|
|
23
|
+
'&:not(.MuiDivider-withChildren)': {
|
|
24
|
+
borderWidth: '0.5px'
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
},
|
|
@@ -30,6 +33,9 @@ export const DsDividerOverrides = {
|
|
|
30
33
|
},
|
|
31
34
|
'&::after': {
|
|
32
35
|
borderWidth: '6px'
|
|
36
|
+
},
|
|
37
|
+
'&:not(.MuiDivider-withChildren)': {
|
|
38
|
+
borderWidth: '6px'
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
}
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DsFileUploaderProps
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsFileUploaderProps;
|
|
5
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
6
|
-
state: DsFileUploaderState;
|
|
7
|
-
humaniseSize: (bytes: number, decimals?: number) => string;
|
|
8
|
-
getFileIconClass: (mimeType: string) => "ri-image-2-line" | "ri-video-line" | "ri-file-list-2-line";
|
|
9
|
-
handleOnClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
10
|
-
handleRemoveFile: (index: number) => () => void;
|
|
11
|
-
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
12
|
-
handleDrop: (event: DragEvent) => void;
|
|
13
|
-
handleDragOverHandler: (event: DragEvent) => void;
|
|
14
|
-
renderFiles: () => false | import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DsFileUploaderProps } from './DsFileUploader.Types';
|
|
3
|
+
export declare const DsFileUploader: FC<DsFileUploaderProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useRef, useState } from 'react';
|
|
3
3
|
import { DsBox } from '../DsBox';
|
|
4
4
|
import { DsButton } from '../DsButton';
|
|
5
5
|
import { DsIconButton } from '../DsIconButton';
|
|
@@ -7,12 +7,12 @@ import { DsInput } from '../DsInput';
|
|
|
7
7
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
8
8
|
import { DsStack } from '../DsStack';
|
|
9
9
|
import { DsTypography } from '../DsTypography';
|
|
10
|
-
import { DsFileUploaderDefaultProps
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
inputRef =
|
|
14
|
-
|
|
15
|
-
humaniseSize = (bytes, decimals = 2) => {
|
|
10
|
+
import { DsFileUploaderDefaultProps } from './DsFileUploader.Types';
|
|
11
|
+
export const DsFileUploader = (inProps) => {
|
|
12
|
+
const props = { ...DsFileUploaderDefaultProps, ...inProps };
|
|
13
|
+
const inputRef = useRef();
|
|
14
|
+
const [files, setFiles] = useState([]);
|
|
15
|
+
const humaniseSize = (bytes, decimals = 2) => {
|
|
16
16
|
if (!+bytes)
|
|
17
17
|
return '0 Bytes';
|
|
18
18
|
const k = 1024;
|
|
@@ -21,7 +21,7 @@ export class DsFileUploader extends React.Component {
|
|
|
21
21
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
22
22
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
23
23
|
};
|
|
24
|
-
getFileIconClass = (mimeType) => {
|
|
24
|
+
const getFileIconClass = (mimeType) => {
|
|
25
25
|
if (mimeType.includes('image/')) {
|
|
26
26
|
return 'ri-image-2-line';
|
|
27
27
|
}
|
|
@@ -30,35 +30,35 @@ export class DsFileUploader extends React.Component {
|
|
|
30
30
|
}
|
|
31
31
|
return 'ri-file-list-2-line';
|
|
32
32
|
};
|
|
33
|
-
handleOnClick = (event) => {
|
|
34
|
-
|
|
33
|
+
const handleOnClick = (event) => {
|
|
34
|
+
inputRef?.current?.click();
|
|
35
35
|
};
|
|
36
|
-
handleRemoveFile = (index) => () => {
|
|
37
|
-
const { onChange, name } =
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const handleRemoveFile = (index) => () => {
|
|
37
|
+
const { onChange, name } = props;
|
|
38
|
+
const tempFiles = [...files];
|
|
39
|
+
tempFiles.splice(index, 1);
|
|
40
|
+
setFiles(tempFiles);
|
|
41
41
|
if (onChange && typeof onChange === 'function') {
|
|
42
|
-
onChange(name, [...
|
|
42
|
+
onChange(name, [...tempFiles]);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
handleChange = (event) => {
|
|
46
|
-
const { onChange, name } =
|
|
47
|
-
const
|
|
45
|
+
const handleChange = (event) => {
|
|
46
|
+
const { onChange, name } = props;
|
|
47
|
+
const stateFiles = files;
|
|
48
48
|
const { target } = event;
|
|
49
|
-
const { files } = target;
|
|
50
|
-
if (
|
|
51
|
-
const newFiles = [...stateFiles, ...
|
|
52
|
-
|
|
49
|
+
const { files: selectedFiles } = target;
|
|
50
|
+
if (selectedFiles) {
|
|
51
|
+
const newFiles = [...stateFiles, ...selectedFiles];
|
|
52
|
+
setFiles(newFiles);
|
|
53
53
|
if (onChange && typeof onChange === 'function') {
|
|
54
54
|
onChange(name, newFiles);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
handleDrop = (event) => {
|
|
58
|
+
const handleDrop = (event) => {
|
|
59
59
|
// Prevent default behavior (Prevent file from being opened)
|
|
60
60
|
event.preventDefault();
|
|
61
|
-
const { InputProps = {}, onChange, name } =
|
|
61
|
+
const { InputProps = {}, onChange, name } = props;
|
|
62
62
|
const { accept, multiple } = InputProps;
|
|
63
63
|
if (!event.dataTransfer) {
|
|
64
64
|
return;
|
|
@@ -89,21 +89,20 @@ export class DsFileUploader extends React.Component {
|
|
|
89
89
|
files.push(file);
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
|
-
const
|
|
92
|
+
const stateFiles = files;
|
|
93
93
|
const newFiles = multiple
|
|
94
94
|
? [...stateFiles, ...files]
|
|
95
95
|
: (files[0] && [files[0]]) || (stateFiles[0] && [stateFiles[0]]) || [];
|
|
96
|
-
|
|
96
|
+
setFiles(newFiles);
|
|
97
97
|
if (onChange && typeof onChange === 'function') {
|
|
98
98
|
onChange(name, newFiles);
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
handleDragOverHandler = (event) => {
|
|
101
|
+
const handleDragOverHandler = (event) => {
|
|
102
102
|
// Prevent default behavior (Prevent file from being opened)
|
|
103
103
|
event.preventDefault();
|
|
104
104
|
};
|
|
105
|
-
renderFiles = () => {
|
|
106
|
-
const { files } = this.state;
|
|
105
|
+
const renderFiles = () => {
|
|
107
106
|
if (!files.length) {
|
|
108
107
|
return false;
|
|
109
108
|
}
|
|
@@ -127,59 +126,57 @@ export class DsFileUploader extends React.Component {
|
|
|
127
126
|
borderRadius: 'var(--ds-radius-quickFreeze)',
|
|
128
127
|
backgroundColor: 'var(--ds-colour-neutral2)',
|
|
129
128
|
color: 'var(--ds-colour-actionTertiary)'
|
|
130
|
-
}, className:
|
|
129
|
+
}, className: getFileIconClass(file.type) }), _jsxs(DsBox, { sx: {
|
|
131
130
|
display: 'flex',
|
|
132
131
|
flexGrow: 1,
|
|
133
132
|
minWidth: 0,
|
|
134
133
|
flexDirection: 'column'
|
|
135
134
|
}, children: [_jsx(DsTypography, { component: "div", variant: "subheadingSemiboldDefault", noWrap: true, children: file.name }), _jsx(DsTypography, { component: "div", variant: "bodyRegularSmall", noWrap: true, sx: {
|
|
136
135
|
color: 'var(--ds-colour-typoTertiary)'
|
|
137
|
-
}, children:
|
|
136
|
+
}, children: humaniseSize(file.size) })] }), _jsx(DsIconButton, { onClick: handleRemoveFile(index), children: _jsx(DsRemixIcon, { className: "ri-close-line" }) })] }, `${file.name}-${index}`));
|
|
138
137
|
}
|
|
139
138
|
return (_jsx(DsStack, { sx: {
|
|
140
139
|
mt: 'var(--ds-spacing-warm)',
|
|
141
140
|
width: '100%'
|
|
142
141
|
}, spacing: "var(--ds-spacing-glacial)", direction: "column", children: Files }));
|
|
143
142
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
'
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
143
|
+
const { IconProps, titleButtonText, TitleButtonProps, descriptionTypograpghyText, DescriptionTypograpghyProps, InputProps } = props;
|
|
144
|
+
return (_jsxs(_Fragment, { children: [_jsxs(DsStack, { sx: {
|
|
145
|
+
width: '100%',
|
|
146
|
+
position: 'relative',
|
|
147
|
+
p: 'var(--ds-spacing-bitterCold)',
|
|
148
|
+
borderRadius: 'var(--ds-radius-glacial)',
|
|
149
|
+
borderWidth: '1px',
|
|
150
|
+
borderStyle: 'dashed',
|
|
151
|
+
borderColor: 'var(--ds-colour-strokeDefault)',
|
|
152
|
+
backgroundColor: 'var(--ds-colour-surfacePrimary)',
|
|
153
|
+
cursor: 'pointer',
|
|
154
|
+
'&:hover': {
|
|
155
|
+
borderColor: 'var(--ds-colour-strokeSecondarySelected)',
|
|
156
|
+
backgroundColor: 'var(--ds-colour-stateSelectedSecondaryHover)'
|
|
157
|
+
}
|
|
158
|
+
}, direction: "column", spacing: "var(--ds-spacing-glacial)", children: [_jsx(DsRemixIcon, { className: "ri-upload-cloud-2-line", color: "secondary", ...IconProps }), _jsx(DsButton, { variant: "text", color: "secondary", ...TitleButtonProps, children: titleButtonText }), _jsx(DsTypography, { variant: "bodyRegularSmall", align: "center", ...DescriptionTypograpghyProps, sx: {
|
|
159
|
+
color: 'var(--ds-colour-typoTertiary)',
|
|
160
|
+
...DescriptionTypograpghyProps?.sx
|
|
161
|
+
}, children: descriptionTypograpghyText }), _jsx(DsInput, { type: "file", sx: {
|
|
162
|
+
position: 'absolute',
|
|
163
|
+
top: 0,
|
|
164
|
+
left: 0,
|
|
165
|
+
height: '100%',
|
|
166
|
+
width: '100%',
|
|
167
|
+
opacity: 0,
|
|
168
|
+
cursor: 'pointer',
|
|
169
|
+
margin: 'var(--ds-spacing-zero) !important'
|
|
170
|
+
}, onChange: handleChange, onDrop: handleDrop, onDragOver: handleDragOverHandler, disableUnderline: true, inputProps: {
|
|
171
|
+
title: titleButtonText,
|
|
172
|
+
ref: inputRef,
|
|
173
|
+
value: '',
|
|
174
|
+
...InputProps,
|
|
175
|
+
style: {
|
|
167
176
|
height: '100%',
|
|
168
177
|
width: '100%',
|
|
169
|
-
opacity: 0,
|
|
170
178
|
cursor: 'pointer',
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
value: '',
|
|
176
|
-
...InputProps,
|
|
177
|
-
style: {
|
|
178
|
-
height: '100%',
|
|
179
|
-
width: '100%',
|
|
180
|
-
cursor: 'pointer',
|
|
181
|
-
...InputProps?.style
|
|
182
|
-
}
|
|
183
|
-
} })] }), this.renderFiles()] }));
|
|
184
|
-
}
|
|
185
|
-
}
|
|
179
|
+
...InputProps?.style
|
|
180
|
+
}
|
|
181
|
+
} })] }), renderFiles()] }));
|
|
182
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsHeaderProps } from './DsHeader.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsHeaderProps;
|
|
5
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
}
|
|
3
|
+
export declare const DsHeader: FC<DsHeaderProps>;
|
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import { DsBox } from '../DsBox';
|
|
4
3
|
import { DsStack } from '../DsStack';
|
|
5
4
|
import { DsImage } from '../DsImage';
|
|
6
5
|
import { DsHeaderDefaultProps } from './DsHeader.Types';
|
|
7
|
-
export
|
|
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
|
-
}
|
|
6
|
+
export const DsHeader = (inProps) => {
|
|
7
|
+
const props = { ...DsHeaderDefaultProps, ...inProps };
|
|
8
|
+
const { logoUrl, logo, children, BoxProps, StackProps, ...HeaderProps } = props;
|
|
9
|
+
return (_jsxs(DsBox, { ...HeaderProps, sx: {
|
|
10
|
+
height: {
|
|
11
|
+
xs: 'var(--ds-rules-headerMobileHeight)',
|
|
12
|
+
lg: 'var(--ds-rules-headerDesktopHeight)'
|
|
13
|
+
},
|
|
14
|
+
backgroundColor: 'var(--ds-colour-surfacePrimary)',
|
|
15
|
+
display: 'flex',
|
|
16
|
+
boxShadow: 'var(--ds-elevation-3)',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
...HeaderProps.sx
|
|
20
|
+
}, children: [_jsx(DsBox, { ...BoxProps, sx: {
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
right: 0,
|
|
23
|
+
bottom: 0,
|
|
24
|
+
pr: {
|
|
25
|
+
xs: 'var(--ds-spacing-cool)',
|
|
26
|
+
md: 'var(--ds-spacing-mild)'
|
|
27
|
+
},
|
|
28
|
+
pb: {
|
|
29
|
+
xs: 'var(--ds-spacing-glacial)',
|
|
30
|
+
md: 'var(--ds-spacing-frostbite)'
|
|
31
|
+
},
|
|
32
|
+
...BoxProps.sx
|
|
33
|
+
}, children: _jsx(DsStack, { ...StackProps, children: children }) }), logoUrl && (_jsx(DsImage, { srcSet: [{ src: logoUrl, alt: 'logo' }], WrapperProps: { height: '100%' }, style: { height: '100%' } })), logo && logo] }));
|
|
34
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsHelperTextProps } from './DsHelperText.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsHelperTextProps;
|
|
5
|
-
render(): false | "" | 0 | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
6
|
-
}
|
|
3
|
+
export declare const DsHelperText: FC<DsHelperTextProps>;
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
|
-
import { DsHelperTextDefaultProps } from './DsHelperText.Types';
|
|
4
2
|
import { DsFormHelperText } from '../DsFormHelperText';
|
|
5
3
|
import { DsBox } from '../DsBox';
|
|
6
4
|
import { DsTypography } from '../DsTypography';
|
|
7
5
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} })), _jsxs(DsTypography, { variant: "bodyRegularSmall", color: "inherit", sx: { pl: 'var(--ds-spacing-deepFreeze)' }, children: [helperText, "\u200B"] })] }) })));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
6
|
+
export const DsHelperText = (props) => {
|
|
7
|
+
const { helperText, color, success, error, ...formHelperTextProps } = props;
|
|
8
|
+
const customColor = success ? 'success' : color;
|
|
9
|
+
const iconClassName = (error && 'ri-error-warning-fill') ||
|
|
10
|
+
(success && 'ri-checkbox-circle-fill') ||
|
|
11
|
+
false;
|
|
12
|
+
return (helperText && (_jsx(DsFormHelperText, { component: "div", color: customColor, error: error, ...formHelperTextProps, children: _jsxs(DsBox, { sx: {
|
|
13
|
+
display: 'flex',
|
|
14
|
+
justifyContent: 'start',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
color: `${customColor}.main`
|
|
17
|
+
}, children: [iconClassName && (_jsx(DsRemixIcon, { className: iconClassName, color: "inherit", fontSize: "cool", sx: {
|
|
18
|
+
mr: 'var(--ds-spacing-quickFreeze)',
|
|
19
|
+
padding: 'var(--ds-spacing-deepFreeze)'
|
|
20
|
+
} })), _jsxs(DsTypography, { variant: "bodyRegularSmall", color: "inherit", sx: { pl: 'var(--ds-spacing-deepFreeze)' }, children: [helperText, "\u200B"] })] }) })));
|
|
21
|
+
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DsImageProps
|
|
3
|
-
export declare
|
|
4
|
-
state: DsImageState;
|
|
5
|
-
handleSetLoadedStage: () => void;
|
|
6
|
-
handleSetErrorStage: () => void;
|
|
7
|
-
hasSource: () => boolean;
|
|
8
|
-
renderLoadingComponent: () => false | import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
renderErrorComponent: () => false | import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
renderPictureComponent: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DsImageProps } from './DsImage.Types';
|
|
3
|
+
export declare const DsImage: FC<DsImageProps>;
|