@am92/react-design-system 2.7.8 → 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/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/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/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.Types.d.ts +8 -0
- 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/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 +3 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import { DsProgressTrackerDefaultProps } from './DsProgressTracker.Types';
|
|
4
4
|
import { DsProgressStepper } from './DsProgressStepper.Component';
|
|
5
5
|
import { DsProgressIndicator } from '../DsProgressIndicator';
|
|
@@ -7,38 +7,31 @@ import { DsCollapse } from '../DsCollapse';
|
|
|
7
7
|
import { DsBox } from '../DsBox';
|
|
8
8
|
import { DsTypography } from '../DsTypography';
|
|
9
9
|
import { DsStack } from '../DsStack';
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const state = {
|
|
15
|
-
open: props['ds-variant'] === 'steps' ? true : false
|
|
16
|
-
};
|
|
17
|
-
this.state = state;
|
|
18
|
-
}
|
|
19
|
-
getMergedProps = () => {
|
|
10
|
+
export const DsProgressTracker = (inProps) => {
|
|
11
|
+
const props = { ...DsProgressTrackerDefaultProps, ...inProps };
|
|
12
|
+
const [open, setOpen] = useState(props['ds-variant'] === 'steps' ? true : false);
|
|
13
|
+
const getMergedProps = () => {
|
|
20
14
|
return {
|
|
21
15
|
...DsProgressTrackerDefaultProps,
|
|
22
|
-
...
|
|
16
|
+
...props,
|
|
23
17
|
StepperProps: {
|
|
24
18
|
...DsProgressTrackerDefaultProps?.StepperProps,
|
|
25
|
-
...
|
|
19
|
+
...props?.StepperProps
|
|
26
20
|
}
|
|
27
21
|
};
|
|
28
22
|
};
|
|
29
|
-
handleToggleCollapse = () =>
|
|
30
|
-
renderStepper = () => {
|
|
31
|
-
const mergedProps =
|
|
23
|
+
const handleToggleCollapse = () => setOpen(!open);
|
|
24
|
+
const renderStepper = () => {
|
|
25
|
+
const mergedProps = getMergedProps();
|
|
32
26
|
// Don Not Render steps if variant is `header`
|
|
33
27
|
if (mergedProps['ds-variant'] === 'header') {
|
|
34
28
|
return null;
|
|
35
29
|
}
|
|
36
30
|
const { StepperProps, activeStep, steps } = mergedProps;
|
|
37
|
-
const { open } = this.state;
|
|
38
31
|
return (_jsx(DsCollapse, { in: open, children: _jsx(DsProgressStepper, { activeStep: activeStep, steps: steps, ...StepperProps }) }));
|
|
39
32
|
};
|
|
40
|
-
renderHeader = () => {
|
|
41
|
-
const mergedProps =
|
|
33
|
+
const renderHeader = () => {
|
|
34
|
+
const mergedProps = getMergedProps();
|
|
42
35
|
// Don Not Render Header if variant is `steps`
|
|
43
36
|
if (mergedProps['ds-variant'] === 'steps') {
|
|
44
37
|
return null;
|
|
@@ -55,13 +48,11 @@ export class DsProgressTracker extends PureComponent {
|
|
|
55
48
|
borderBottom: '1px solid var(--ds-colour-strokeDefault)',
|
|
56
49
|
backgroundColor: 'var(--ds-colour-surfaceBackground)',
|
|
57
50
|
cursor: mergedProps['ds-variant'] === 'default' ? 'pointer' : 'unset'
|
|
58
|
-
}, spacing: "var(--ds-spacing-bitterCold)", direction: "row", onClick:
|
|
51
|
+
}, spacing: "var(--ds-spacing-bitterCold)", direction: "row", onClick: handleToggleCollapse, children: [_jsx(DsProgressIndicator, { activeStep: activeStep + 1, steps: steps.length }), _jsxs(DsStack, { flexGrow: 1, direction: "column", spacing: "var(--ds-spacing-quickFreeze)", children: [_jsx(DsTypography, { component: "div", textAlign: "right", color: "var(--ds-colour-actionSecondary)", variant: "headingBoldExtraSmall", children: currentStep.stepName }), haveNextStep && (_jsx(DsTypography, { component: "div", textAlign: "right", color: "var(--ds-colour-typoTertiary)", variant: "subheadingSemiboldDefault", children: isNextStepLastStep
|
|
59
52
|
? 'Yay! you are almost done'
|
|
60
53
|
: `${nextStepLabelPrefix}${nextStep.stepName}` }))] })] }));
|
|
61
54
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}
|
|
55
|
+
const mergedProps = props;
|
|
56
|
+
const { sx } = mergedProps;
|
|
57
|
+
return (_jsxs(DsBox, { sx: { width: '100%', ...sx }, children: [renderHeader(), renderStepper()] }));
|
|
58
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsRadioProps } from './DsRadio.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsRadioProps;
|
|
5
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
}
|
|
3
|
+
export declare const DsRadio: FC<DsRadioProps>;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import Radio from '@mui/material/Radio';
|
|
4
3
|
import { DsRadioDefaultProps } from './DsRadio.Types';
|
|
5
4
|
import { DsFormControlLabel } from '../DsFormControlLabel';
|
|
6
5
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
6
|
+
export const DsRadio = (inProps) => {
|
|
7
|
+
const props = { ...inProps, ...DsRadioDefaultProps };
|
|
8
|
+
const { disabled, RadioProps, ...restProps } = props;
|
|
9
|
+
return (_jsx(DsFormControlLabel, { ...restProps, disabled: disabled, control: _jsx(Radio, { icon: _jsx(DsRemixIcon, { className: "ri-checkbox-blank-circle-line", sx: { fontSize: 'var(--ds-typo-fontSizeBitterCold)' } }), checkedIcon: _jsx(DsRemixIcon, { className: "ri-radio-button-line", sx: { fontSize: 'var(--ds-typo-fontSizeBitterCold)' } }), color: "secondary", ...RadioProps, disabled: disabled }) }));
|
|
10
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsRemixIconProps } from './DsRemixIcon.Types';
|
|
3
|
-
export declare
|
|
4
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
}
|
|
3
|
+
export declare const DsRemixIcon: FC<DsRemixIconProps>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
}
|
|
2
|
+
import { DsIcon, DsIconDefaultProps } from '../DsIcon';
|
|
3
|
+
export const DsRemixIcon = (inProps) => {
|
|
4
|
+
const props = { ...DsIconDefaultProps, ...inProps };
|
|
5
|
+
return _jsx(DsIcon, { baseClassName: "", ...props });
|
|
6
|
+
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsSelectProps } from './DsSelect.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsSelectProps;
|
|
5
|
-
selectRef: React.RefObject<Element>;
|
|
6
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
}
|
|
3
|
+
export declare const DsSelect: FC<DsSelectProps>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
3
3
|
import Select from '@mui/material/Select';
|
|
4
|
-
import { DsSelectDefaultProps } from './DsSelect.Types';
|
|
5
4
|
import { DsFormControl } from '../DsFormControl';
|
|
6
5
|
import { DsInputLabel } from '../DsInputLabel';
|
|
7
6
|
import { DsInputBase } from '../DsInputBase';
|
|
@@ -9,54 +8,51 @@ import { DsMenuItem } from '../DsMenuItem';
|
|
|
9
8
|
import { DsTypography } from '../DsTypography';
|
|
10
9
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
11
10
|
import { DsHelperText } from '../DsHelperText';
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const { selectedValue, valueMap } = props;
|
|
60
|
-
const returnValue = valueMap.get(selectedValue);
|
|
61
|
-
return _jsx(_Fragment, { children: returnValue });
|
|
11
|
+
export const DsSelect = (props) => {
|
|
12
|
+
const selectRef = useRef();
|
|
13
|
+
const { id, name, placeholder, label, labelSupportText, color, helperText, success, error, sx, fullWidth, children, options, disabled, FormControlProps, InputLabelProps, FormHelperTextProps, required, ...selectProps } = props;
|
|
14
|
+
const customColor = success ? 'success' : color;
|
|
15
|
+
const valueMap = options.reduce((acc, item) => {
|
|
16
|
+
acc.set(item.value, item.label);
|
|
17
|
+
return acc;
|
|
18
|
+
}, new Map());
|
|
19
|
+
const IconComponent = (props) => {
|
|
20
|
+
return (_jsx(DsRemixIcon, { ...props, className: `${props.className} ri-arrow-down-s-line` }));
|
|
21
|
+
};
|
|
22
|
+
const SelectedValueArray = (props) => {
|
|
23
|
+
const { selectedValue, valueMap } = props;
|
|
24
|
+
const returnValue = selectedValue
|
|
25
|
+
.map(selectedVal => valueMap.get(selectedVal))
|
|
26
|
+
.join(', ');
|
|
27
|
+
return _jsx(_Fragment, { children: returnValue });
|
|
28
|
+
};
|
|
29
|
+
const SelectedValue = (props) => {
|
|
30
|
+
const { selectedValue, valueMap } = props;
|
|
31
|
+
const returnValue = valueMap.get(selectedValue);
|
|
32
|
+
return _jsx(_Fragment, { children: returnValue });
|
|
33
|
+
};
|
|
34
|
+
return (_jsxs(DsFormControl, { fullWidth: fullWidth, color: customColor, error: error, sx: sx, disabled: disabled, required: required, ...FormControlProps, children: [_jsx(DsInputLabel, { label: label, labelSupportText: labelSupportText, error: error, success: success, htmlFor: id || name, disabled: disabled, ...InputLabelProps }), _jsxs(Select, { ref: selectRef, id: id, name: name, IconComponent: IconComponent, displayEmpty: true, input: _jsx(DsInputBase, {}), renderValue: value => {
|
|
35
|
+
if (!value || (value instanceof Array && !value.length)) {
|
|
36
|
+
return (_jsx(DsTypography, { variant: "bodyRegularMedium", color: "text.disabled", children: placeholder }));
|
|
37
|
+
}
|
|
38
|
+
if (value instanceof Array) {
|
|
39
|
+
return (_jsx(SelectedValueArray, { selectedValue: value, valueMap: valueMap }));
|
|
40
|
+
}
|
|
41
|
+
return _jsx(SelectedValue, { selectedValue: value, valueMap: valueMap });
|
|
42
|
+
}, error: error, disabled: disabled, ...selectProps, MenuProps: {
|
|
43
|
+
anchorEl: () => selectRef.current,
|
|
44
|
+
...selectProps?.MenuProps,
|
|
45
|
+
sx: {
|
|
46
|
+
marginTop: 'var(--ds-spacing-glacial)',
|
|
47
|
+
...selectProps?.MenuProps?.sx
|
|
48
|
+
}
|
|
49
|
+
}, children: [children, options.map(({ label, value }, index) => (_jsx(DsMenuItem, { value: value, sx: {
|
|
50
|
+
'&.Mui-selected': {
|
|
51
|
+
backgroundColor: 'transparent',
|
|
52
|
+
fontWeight: 'var(--ds-typo-bodyBoldMedium-fontWeight)',
|
|
53
|
+
fontSize: 'var(--ds-typo-bodyBoldMedium-fontSize)',
|
|
54
|
+
lineHeight: 'var(--ds-typo-bodyBoldMedium-lineHeight)',
|
|
55
|
+
letterSpacing: 'var(--ds-typo-bodyBoldMedium-letterSpacing)'
|
|
56
|
+
}
|
|
57
|
+
}, children: _jsx("span", { children: label }) }, index)))] }), _jsx(DsHelperText, { helperText: helperText, color: color, success: success, error: error, ...FormHelperTextProps })] }));
|
|
62
58
|
};
|
|
@@ -6,6 +6,14 @@ interface OptionProp {
|
|
|
6
6
|
label: string;
|
|
7
7
|
value: any;
|
|
8
8
|
}
|
|
9
|
+
export interface SelectedValueArrayProps {
|
|
10
|
+
selectedValue: any[];
|
|
11
|
+
valueMap: Map<any, string>;
|
|
12
|
+
}
|
|
13
|
+
export interface SelectedValueProps {
|
|
14
|
+
selectedValue: any;
|
|
15
|
+
valueMap: Map<any, string>;
|
|
16
|
+
}
|
|
9
17
|
export interface DsSelectProps extends Omit<SelectProps, 'ref'> {
|
|
10
18
|
ref?: React.Ref<any>;
|
|
11
19
|
FormControlProps?: Omit<DsFormControlProps, 'fullWidth' | 'color' | 'error' | 'disabled'>;
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { DsSliderProps } from './DsSlider.Types';
|
|
3
|
-
export declare class DsSlider extends React.PureComponent<DsSliderProps> {
|
|
4
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
}
|
|
1
|
+
export { default as DsSlider } from '@mui/material/Slider';
|
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { Slider } from '@mui/material';
|
|
4
|
-
import { DsSliderDefaultProps } from './DsSlider.Types';
|
|
5
|
-
export class DsSlider extends React.PureComponent {
|
|
6
|
-
render() {
|
|
7
|
-
const mergedProps = { ...DsSliderDefaultProps, ...this.props };
|
|
8
|
-
return _jsx(Slider, { ...mergedProps });
|
|
9
|
-
}
|
|
10
|
-
}
|
|
1
|
+
export { default as DsSlider } from '@mui/material/Slider';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DsSliderDefaultProps } from './DsSlider.Types';
|
|
2
2
|
export const DsSliderOverrides = {
|
|
3
3
|
MuiSlider: {
|
|
4
|
-
defaultProps:
|
|
4
|
+
defaultProps: DsSliderDefaultProps,
|
|
5
5
|
variants: [
|
|
6
6
|
{
|
|
7
7
|
props: { 'ds-mode': 'true' },
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsSwitchProps } from './DsSwitch.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsSwitchProps;
|
|
5
|
-
handleChange: (event: React.SyntheticEvent, value: NonNullable<any>) => void;
|
|
6
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
}
|
|
3
|
+
export declare const DsSwitch: FC<DsSwitchProps>;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import { DsSwitchDefaultProps } from './DsSwitch.Types';
|
|
4
3
|
import { DsToggleButtonGroup } from '../DsToggleButtonGroup';
|
|
5
4
|
import { DsToggleButton } from '../DsToggleButton';
|
|
6
5
|
import { DsTypography } from '../DsTypography';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
handleChange = (event, value) => {
|
|
10
|
-
const { name, onChange } =
|
|
6
|
+
export const DsSwitch = (inProps) => {
|
|
7
|
+
const props = { ...DsSwitchDefaultProps, ...inProps };
|
|
8
|
+
const handleChange = (event, value) => {
|
|
9
|
+
const { name, onChange } = props;
|
|
11
10
|
onChange(name, value);
|
|
12
11
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
}
|
|
12
|
+
const { positiveLabel, positiveValue, negativeLabel, negativeValue, ...restProps } = props;
|
|
13
|
+
return (_jsxs(DsToggleButtonGroup, { ...restProps, "ds-variant": "switch", exclusive: true, size: "small", onChange: handleChange, children: [_jsx(DsToggleButton, { value: positiveValue, children: _jsx(DsTypography, { variant: "supportBoldTextButton", children: positiveLabel }) }), _jsx(DsToggleButton, { value: negativeValue, children: _jsx(DsTypography, { variant: "supportBoldTextButton", children: negativeLabel }) })] }));
|
|
14
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsTagProps } from './DsTag.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsTagProps;
|
|
5
|
-
handleClick: () => void;
|
|
6
|
-
handleDelete: () => void;
|
|
7
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
}
|
|
3
|
+
export declare const DsTag: FC<DsTagProps>;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import Chip from '@mui/material/Chip';
|
|
4
3
|
import { DsTagDefaultProps } from './DsTag.Types';
|
|
5
4
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
handleClick = () => {
|
|
9
|
-
const { value, onClick } =
|
|
5
|
+
export const DsTag = (inProps) => {
|
|
6
|
+
const props = { ...DsTagDefaultProps, ...inProps };
|
|
7
|
+
const handleClick = () => {
|
|
8
|
+
const { value, onClick } = props;
|
|
10
9
|
if (typeof onClick === 'function') {
|
|
11
10
|
onClick(value);
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
|
-
handleDelete = () => {
|
|
15
|
-
const { value, onDelete } =
|
|
13
|
+
const handleDelete = () => {
|
|
14
|
+
const { value, onDelete } = props;
|
|
16
15
|
if (typeof onDelete === 'function') {
|
|
17
16
|
onDelete(value);
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
19
|
+
const { selected, onClick, onDelete, ...chipProps } = props;
|
|
20
|
+
const color = (selected && 'secondary') || 'default';
|
|
21
|
+
return (_jsx(Chip, { deleteIcon: _jsx(DsRemixIcon, { className: "ri-close-circle-fill" }), skipFocusWhenDisabled: true, ...chipProps, clickable: true, color: color, onDelete: (onDelete && handleDelete) || undefined, onClick: handleClick }));
|
|
22
|
+
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsTagGroupProps } from './DsTagGroup.Types';
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsTagGroupProps;
|
|
5
|
-
handleUnselect: (handleValue: any) => void;
|
|
6
|
-
handleSelect: (handleValue: any) => void;
|
|
7
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
}
|
|
3
|
+
export declare const DsTagGroup: FC<DsTagGroupProps>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import { DsStack } from '../DsStack';
|
|
4
4
|
import { DsTagGroupDefaultProps } from './DsTagGroup.Types';
|
|
5
5
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
handleUnselect = (handleValue) => {
|
|
9
|
-
const { name, value = [], onChange } =
|
|
10
|
-
const changedValue = value
|
|
6
|
+
export const DsTagGroup = (inProps) => {
|
|
7
|
+
const props = { ...DsTagGroupDefaultProps, ...inProps };
|
|
8
|
+
const handleUnselect = (handleValue) => {
|
|
9
|
+
const { name, value = [], onChange } = props;
|
|
10
|
+
const changedValue = value?.filter((e) => e !== handleValue);
|
|
11
11
|
onChange(name, changedValue);
|
|
12
12
|
};
|
|
13
|
-
handleSelect = (handleValue) => {
|
|
14
|
-
const { multi, name, value = [], onChange } =
|
|
13
|
+
const handleSelect = (handleValue) => {
|
|
14
|
+
const { multi, name, value = [], onChange } = props;
|
|
15
15
|
let changedValue;
|
|
16
16
|
if (multi) {
|
|
17
17
|
changedValue = Array.from(new Set([...value, handleValue]));
|
|
@@ -21,22 +21,20 @@ export class DsTagGroup extends PureComponent {
|
|
|
21
21
|
}
|
|
22
22
|
onChange(name, changedValue);
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
24
|
+
const { multi, children, value, name, onChange, ...restStackProps } = props;
|
|
25
|
+
const childrenArray = children instanceof Array ? children : [children];
|
|
26
|
+
return (_jsx(DsStack, { direction: 'row', spacing: 'var(--ds-spacing-glacial)', ...restStackProps, children: childrenArray.map(child => {
|
|
27
|
+
const { value: chipValue } = child.props;
|
|
28
|
+
const selected = (multi && value?.includes(chipValue)) || value === chipValue;
|
|
29
|
+
const onDelete = (multi && selected && handleUnselect) || undefined;
|
|
30
|
+
const onClick = (selected && onDelete) || handleSelect;
|
|
31
|
+
const childClone = React.cloneElement(child, {
|
|
32
|
+
value: chipValue,
|
|
33
|
+
selected,
|
|
34
|
+
deleteIcon: _jsx(DsRemixIcon, { className: "ri-close-circle-fill" }),
|
|
35
|
+
onDelete,
|
|
36
|
+
onClick
|
|
37
|
+
});
|
|
38
|
+
return childClone;
|
|
39
|
+
}) }));
|
|
40
|
+
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DsTextAreaProps
|
|
3
|
-
export declare
|
|
4
|
-
state: DsTextAreaState;
|
|
5
|
-
areRef: React.RefObject<unknown>;
|
|
6
|
-
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
-
componentDidMount(): void;
|
|
8
|
-
componentDidUpdate(prevProps: Readonly<DsTextAreaProps>, prevState: Readonly<DsTextAreaState>, snapshot?: any): void;
|
|
9
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DsTextAreaProps } from './DsTextArea.Types';
|
|
3
|
+
export declare const DsTextArea: FC<DsTextAreaProps>;
|
|
@@ -1,67 +1,62 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { DsFormControl } from '../DsFormControl';
|
|
4
4
|
import { DsTextField } from '../DsTextField';
|
|
5
5
|
import { DsTypography } from '../DsTypography';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { onChange } = this.props;
|
|
6
|
+
export const DsTextArea = (props) => {
|
|
7
|
+
const [count, setCount] = useState(0);
|
|
8
|
+
const areRef = useRef();
|
|
9
|
+
const handleChange = (event) => {
|
|
10
|
+
const { onChange } = props;
|
|
12
11
|
const { target } = event;
|
|
13
12
|
const { value = '' } = target;
|
|
14
|
-
let count = value
|
|
15
|
-
|
|
13
|
+
let count = value?.length;
|
|
14
|
+
setCount(count);
|
|
16
15
|
if (onChange && typeof onChange === 'function') {
|
|
17
16
|
onChange(event);
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
|
-
|
|
21
|
-
const { value = '' } =
|
|
22
|
-
const count = value.length;
|
|
23
|
-
this.setState({ count });
|
|
24
|
-
}
|
|
25
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
26
|
-
const { count: currentStateCount } = this.state;
|
|
27
|
-
const { value } = this.props;
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const { value = '' } = props;
|
|
28
21
|
const count = value?.length;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// Provide counter if MaxLength Provided
|
|
37
|
-
const hasMaxLength = !!maxLength;
|
|
38
|
-
const maxLengthHandlingInputStyle = hasMaxLength
|
|
39
|
-
? { mb: 'var(--ds-spacing-bittercold)' }
|
|
40
|
-
: {};
|
|
41
|
-
const counterStyle = {
|
|
42
|
-
position: 'absolute',
|
|
43
|
-
bottom: '8px',
|
|
44
|
-
right: '8px',
|
|
45
|
-
overflow: 'auto'
|
|
46
|
-
};
|
|
47
|
-
if (helperText) {
|
|
48
|
-
// Adjust the helper text size
|
|
49
|
-
counterStyle.bottom = 'calc(8px + 36px)';
|
|
22
|
+
setCount(count);
|
|
23
|
+
}, []);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const { value } = props;
|
|
26
|
+
const stringCount = value?.length;
|
|
27
|
+
if (stringCount && count !== count) {
|
|
28
|
+
setCount(stringCount);
|
|
50
29
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
30
|
+
}, [count, props.value]);
|
|
31
|
+
const { maxLength, hideCharacterCount, helperText, inputProps, ref, fullWidth, ...rest } = props;
|
|
32
|
+
// Provide counter if MaxLength Provided
|
|
33
|
+
const hasMaxLength = !!maxLength;
|
|
34
|
+
const maxLengthHandlingInputStyle = hasMaxLength
|
|
35
|
+
? { mb: 'var(--ds-spacing-bittercold)' }
|
|
36
|
+
: {};
|
|
37
|
+
const counterStyle = {
|
|
38
|
+
position: 'absolute',
|
|
39
|
+
bottom: '8px',
|
|
40
|
+
right: '8px',
|
|
41
|
+
overflow: 'auto'
|
|
42
|
+
};
|
|
43
|
+
if (helperText) {
|
|
44
|
+
// Adjust the helper text size
|
|
45
|
+
counterStyle.bottom = 'calc(8px + 36px)';
|
|
66
46
|
}
|
|
67
|
-
|
|
47
|
+
return (_jsxs(DsFormControl, { fullWidth: fullWidth, children: [_jsx(DsTextField, { maxRows: 3, minRows: 3, ...rest, fullWidth: fullWidth, onChange: handleChange, multiline: true, inputProps: {
|
|
48
|
+
ref: ref || areRef,
|
|
49
|
+
...inputProps,
|
|
50
|
+
sx: {
|
|
51
|
+
minWidth: '288px',
|
|
52
|
+
...maxLengthHandlingInputStyle,
|
|
53
|
+
...inputProps?.sx
|
|
54
|
+
},
|
|
55
|
+
maxLength: maxLength || ''
|
|
56
|
+
}, helperText: helperText,
|
|
57
|
+
// TODO: To be fixed when we fix the sx passing to inputbase
|
|
58
|
+
style: {
|
|
59
|
+
paddingBottom: 'var(--ds-spacing-mild)',
|
|
60
|
+
...rest?.style
|
|
61
|
+
} }), hasMaxLength && !hideCharacterCount && (_jsx(DsTypography, { sx: counterStyle, variant: "supportRegularFootnote", children: `${count}/${maxLength}` }))] }));
|
|
62
|
+
};
|