@am92/react-design-system 2.7.8 → 2.8.1
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/DsAvatar/DsAvatar.Component.d.ts +3 -1
- package/dist/Components/DsAvatar/DsAvatar.Component.js +5 -1
- 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 +2 -5
- package/dist/Components/DsChip/DsChip.Component.js +3 -8
- package/dist/Components/DsChip/DsChip.Overrides.d.ts +1 -8
- package/dist/Components/DsChip/DsChip.Overrides.js +12 -57
- package/dist/Components/DsChip/DsChip.Types.d.ts +9 -2
- 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/DsRadio/DsRadio.Overrides.d.ts +1 -0
- package/dist/Components/DsRadio/DsRadio.Overrides.js +2 -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.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 +50 -14
- package/dist/Components/DsTag/DsTag.Overrides.d.ts +5 -1
- package/dist/Components/DsTag/DsTag.Overrides.js +6 -2
- 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/Constants/TYPOGRAPGHY.d.ts +4 -1
- package/dist/Constants/TYPOGRAPGHY.js +3 -0
- package/dist/Helpers/accessibility.d.ts +3 -0
- package/dist/Helpers/accessibility.js +14 -0
- package/dist/Helpers/index.d.ts +1 -0
- package/dist/Helpers/index.js +1 -0
- package/dist/Hooks/accessibility.d.ts +9 -0
- package/dist/Hooks/accessibility.js +35 -0
- package/dist/Hooks/index.d.ts +1 -0
- package/dist/Hooks/index.js +1 -0
- package/dist/Theme/componentOverrides.d.ts +8 -12
- package/dist/Theme/getColorScheme/dark.js +1 -1
- package/dist/Types/DsAccessibility.d.ts +1 -0
- package/dist/Types/DsAccessibility.js +1 -0
- package/dist/Types/index.d.ts +1 -0
- package/dist/Types/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsTextFieldProps } from './DsTextField.Types';
|
|
3
|
-
export declare
|
|
4
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
}
|
|
3
|
+
export declare const DsTextField: FC<DsTextFieldProps>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { DsTextFieldDefaultProps } from './DsTextField.Types';
|
|
3
3
|
import { DsFormControl } from '../DsFormControl';
|
|
4
4
|
import { DsInputLabel } from '../DsInputLabel';
|
|
5
5
|
import { DsInputBase } from '../DsInputBase';
|
|
6
6
|
import { DsHelperText } from '../DsHelperText';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
7
|
+
export const DsTextField = (inProps) => {
|
|
8
|
+
const props = { ...DsTextFieldDefaultProps, ...inProps };
|
|
9
|
+
const { id, name, label, labelSupportText, color, helperText, success, error, sx, fullWidth, ref, inputRef, disabled, required, FormControlProps, InputLabelProps, HelperTextProps, ...inputBaseProps } = props;
|
|
10
|
+
const customColor = success ? 'success' : color;
|
|
11
|
+
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, required: required, ...InputLabelProps }), _jsx(DsInputBase, { fullWidth: fullWidth, color: customColor, error: error, id: id || name, name: name, inputRef: ref || inputRef, disabled: disabled, required: required, ...inputBaseProps }), _jsx(DsHelperText, { helperText: helperText, color: color, success: success, error: error, ...HelperTextProps })] }));
|
|
12
|
+
};
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DsTextFieldPasswordProps
|
|
3
|
-
export declare
|
|
4
|
-
static defaultProps: DsTextFieldPasswordProps;
|
|
5
|
-
state: DsTextFieldPasswordState;
|
|
6
|
-
constructor(props: DsTextFieldPasswordProps);
|
|
7
|
-
getMergedProps: () => DsTextFieldPasswordProps;
|
|
8
|
-
handleTogglePassword: () => void;
|
|
9
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
}
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DsTextFieldPasswordProps } from './DsTextFieldPassword.Types';
|
|
3
|
+
export declare const DsTextFieldPassword: FC<DsTextFieldPasswordProps>;
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import { DsInputAdornment } from '../DsInputAdornment';
|
|
4
4
|
import { DsTextField } from '../DsTextField';
|
|
5
|
-
import { DsTextFieldPasswordDefaultProps
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
super(props);
|
|
11
|
-
this.state = {
|
|
12
|
-
...DsTextFieldPasswordDefaultState,
|
|
13
|
-
isVisible: props.isVisible
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
getMergedProps = () => {
|
|
17
|
-
return { ...DsTextFieldPasswordDefaultProps, ...this.props };
|
|
5
|
+
import { DsTextFieldPasswordDefaultProps } from './DsTextFieldPassword.Types';
|
|
6
|
+
export const DsTextFieldPassword = (props) => {
|
|
7
|
+
const [isVisible, setIsVisible] = useState(false);
|
|
8
|
+
const getMergedProps = () => {
|
|
9
|
+
return { ...DsTextFieldPasswordDefaultProps, ...props };
|
|
18
10
|
};
|
|
19
|
-
handleTogglePassword = () =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return (_jsx(DsTextField, { ...restProps, disabled: disabled, type: inputType, endAdornment: _jsx(DsInputAdornment, { position: "end", onClick: (!disabled && this.handleTogglePassword) || undefined, children: endAdornment }) }));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
11
|
+
const handleTogglePassword = () => setIsVisible(!isVisible);
|
|
12
|
+
const mergedProps = getMergedProps();
|
|
13
|
+
const { type, isVisible: isVisibleProp, disabled, toggleNode, ...restProps } = mergedProps;
|
|
14
|
+
const inputType = (isVisible && type) || 'password';
|
|
15
|
+
const endAdornment = isVisible
|
|
16
|
+
? React.cloneElement(toggleNode?.toHide || _jsx(_Fragment, {}), { disabled })
|
|
17
|
+
: React.cloneElement(toggleNode?.toShow || _jsx(_Fragment, {}), { disabled });
|
|
18
|
+
return (_jsx(DsTextField, { ...restProps, disabled: disabled, type: inputType, endAdornment: _jsx(DsInputAdornment, { position: "end", onClick: (!disabled && handleTogglePassword) || undefined, children: endAdornment }) }));
|
|
19
|
+
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsToastProps } from './DsToast.Types';
|
|
3
|
-
export declare
|
|
4
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
}
|
|
3
|
+
export declare const DsToast: FC<DsToastProps>;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import Alert from '@mui/material/Alert';
|
|
4
3
|
import { DsRemixIcon } from '../DsRemixIcon';
|
|
4
|
+
import { useThemeProps } from '@mui/system';
|
|
5
5
|
const CloseIcon = (props) => {
|
|
6
6
|
const { ownerState, ...restProps } = props;
|
|
7
7
|
return (_jsx(DsRemixIcon, { fontSize: "mild", className: "ri-close-line", ...restProps }));
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}
|
|
9
|
+
export const DsToast = (inProps) => {
|
|
10
|
+
const props = useThemeProps({
|
|
11
|
+
props: inProps,
|
|
12
|
+
name: 'MuiAlert'
|
|
13
|
+
});
|
|
14
|
+
const { forwardedRef, ...restProps } = props;
|
|
15
|
+
return (_jsx(Alert, { ref: forwardedRef, ...restProps, slots: { closeIcon: CloseIcon, ...restProps?.slots } }));
|
|
16
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsToggleProps } from './DsToggle.Types';
|
|
3
|
-
export declare
|
|
4
|
-
handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
}
|
|
3
|
+
export declare const DsToggle: FC<DsToggleProps>;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PureComponent } from 'react';
|
|
3
2
|
import Switch from '@mui/material/Switch';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { useThemeProps } from '@mui/system';
|
|
4
|
+
export const DsToggle = (inProps) => {
|
|
5
|
+
const props = useThemeProps({
|
|
6
|
+
props: inProps,
|
|
7
|
+
name: 'DsToggle'
|
|
8
|
+
});
|
|
9
|
+
const handleChange = (event) => {
|
|
10
|
+
const { onChange } = props;
|
|
7
11
|
const { name, checked } = event.target;
|
|
8
12
|
if (typeof onChange === 'function') {
|
|
9
13
|
onChange(name, checked);
|
|
10
14
|
}
|
|
11
15
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
}
|
|
16
|
+
const { value, onChange, ...restProps } = props;
|
|
17
|
+
return (_jsx(Switch, { ...restProps, color: "secondary", checked: value, onChange: handleChange }));
|
|
18
|
+
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { DsTooltipProps } from './DsTooltip.Types';
|
|
3
|
-
export declare
|
|
4
|
-
renderTitle: () => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
render(): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
}
|
|
3
|
+
export declare const DsTooltip: FC<DsTooltipProps>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React
|
|
2
|
+
import React from 'react';
|
|
3
3
|
import Tooltip from '@mui/material/Tooltip';
|
|
4
4
|
import { DsTypography } from '../DsTypography';
|
|
5
5
|
import { DsLink } from '../DsLink';
|
|
6
|
-
export
|
|
7
|
-
renderTitle = () => {
|
|
8
|
-
const { heading, description, buttonGroup } =
|
|
6
|
+
export const DsTooltip = (props) => {
|
|
7
|
+
const renderTitle = () => {
|
|
8
|
+
const { heading, description, buttonGroup } = props;
|
|
9
9
|
const tooltipButtonGroup = buttonGroup
|
|
10
10
|
? React.cloneElement(buttonGroup, {
|
|
11
11
|
size: 'small',
|
|
@@ -16,8 +16,6 @@ export class DsTooltip extends PureComponent {
|
|
|
16
16
|
: false;
|
|
17
17
|
return (_jsxs(_Fragment, { children: [heading && (_jsx(DsTypography, { component: "div", variant: "bodyBoldMedium", sx: { mb: 'var(--ds-spacing-glacial)' }, children: heading })), description && (_jsx(DsTypography, { component: "div", variant: "bodyRegularMedium", children: description })), tooltipButtonGroup] }));
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
19
|
+
const { heading, description, buttonGroup, children, ...tooltipProps } = props;
|
|
20
|
+
return (_jsx(Tooltip, { title: renderTitle(), ...tooltipProps, children: _jsx(DsLink, { component: "span", underline: "always", color: "inherit", variant: "inherit", sx: { textDecorationColor: 'inherit' }, children: children }) }));
|
|
21
|
+
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import { DsTypographyTokens } from '../Types';
|
|
1
|
+
import { DS_TYPOGRAPHY_HTML_FONT_SIZE, DsTypographyTokens } from '../Types';
|
|
2
2
|
export declare const DSTYPOGRAPHY_TOKENS: DsTypographyTokens[];
|
|
3
|
+
export declare const DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE: DS_TYPOGRAPHY_HTML_FONT_SIZE;
|
|
4
|
+
export declare const DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE: DS_TYPOGRAPHY_HTML_FONT_SIZE;
|
|
5
|
+
export declare const DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE: DS_TYPOGRAPHY_HTML_FONT_SIZE;
|
|
@@ -28,3 +28,6 @@ export const DSTYPOGRAPHY_TOKENS = [
|
|
|
28
28
|
'supportBoldTextButton',
|
|
29
29
|
'supportRegularMetadata'
|
|
30
30
|
];
|
|
31
|
+
export const DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE = 16;
|
|
32
|
+
export const DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE = 16;
|
|
33
|
+
export const DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE = 18;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE, DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE, DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE } from '../Constants';
|
|
2
|
+
export const getCurrentFontSize = () => {
|
|
3
|
+
const htmlElement = document.documentElement;
|
|
4
|
+
const computedFontSize = window.getComputedStyle(htmlElement).fontSize;
|
|
5
|
+
if (computedFontSize) {
|
|
6
|
+
const parsedFontSize = parseInt(computedFontSize, 10);
|
|
7
|
+
return parsedFontSize;
|
|
8
|
+
}
|
|
9
|
+
return DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE;
|
|
10
|
+
};
|
|
11
|
+
export const isValidFontSize = (fontSize) => {
|
|
12
|
+
return (fontSize >= DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE &&
|
|
13
|
+
fontSize <= DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE);
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './accessibility';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './accessibility';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DS_TYPOGRAPHY_HTML_FONT_SIZE } from '../Types';
|
|
2
|
+
export declare const useFontSizeAccessibility: () => {
|
|
3
|
+
fontSize: DS_TYPOGRAPHY_HTML_FONT_SIZE;
|
|
4
|
+
disableDecrease: boolean;
|
|
5
|
+
disableIncrease: boolean;
|
|
6
|
+
increaseFontSize: () => void;
|
|
7
|
+
decreaseFontSize: () => void;
|
|
8
|
+
setFontSize: (newFontSize: DS_TYPOGRAPHY_HTML_FONT_SIZE) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import { DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE, DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE, DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE } from '../Constants';
|
|
3
|
+
import { getCurrentFontSize, isValidFontSize } from '../Helpers';
|
|
4
|
+
export const useFontSizeAccessibility = () => {
|
|
5
|
+
let currentFontSize = getCurrentFontSize();
|
|
6
|
+
if (!isValidFontSize(currentFontSize)) {
|
|
7
|
+
currentFontSize = DS_TYPOGRAPHY_DEFAULT_HTML_FONT_SIZE;
|
|
8
|
+
}
|
|
9
|
+
const [fontSize, setFontSize] = useState(currentFontSize);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const htmlElement = document.documentElement;
|
|
12
|
+
htmlElement.style.fontSize = `${fontSize}px`;
|
|
13
|
+
}, [fontSize, document.documentElement.style.fontSize]);
|
|
14
|
+
const setValidFontSize = useCallback((newFontSize) => {
|
|
15
|
+
if (isValidFontSize(newFontSize)) {
|
|
16
|
+
setFontSize(newFontSize);
|
|
17
|
+
}
|
|
18
|
+
}, []);
|
|
19
|
+
const deltaChangeFontSize = (delta) => () => {
|
|
20
|
+
const newFontSize = (fontSize + delta);
|
|
21
|
+
if (isValidFontSize(newFontSize)) {
|
|
22
|
+
setFontSize(newFontSize);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
let disableIncrease = fontSize >= DS_TYPOGRAPHY_MAX_HTML_FONT_SIZE;
|
|
26
|
+
let disableDecrease = fontSize <= DS_TYPOGRAPHY_MIN_HTML_FONT_SIZE;
|
|
27
|
+
return {
|
|
28
|
+
fontSize,
|
|
29
|
+
disableDecrease,
|
|
30
|
+
disableIncrease,
|
|
31
|
+
increaseFontSize: deltaChangeFontSize(1),
|
|
32
|
+
decreaseFontSize: deltaChangeFontSize(-1),
|
|
33
|
+
setFontSize: setValidFontSize
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './accessibility';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './accessibility';
|
|
@@ -480,6 +480,9 @@ declare const componentOverrides: {
|
|
|
480
480
|
};
|
|
481
481
|
};
|
|
482
482
|
};
|
|
483
|
+
DsTag: {
|
|
484
|
+
defaultProps: import("../Components").DsTagProps;
|
|
485
|
+
};
|
|
483
486
|
MuiTabs: {
|
|
484
487
|
defaultProps: import("../Components").DsTabsProps;
|
|
485
488
|
variants: {
|
|
@@ -605,7 +608,7 @@ declare const componentOverrides: {
|
|
|
605
608
|
};
|
|
606
609
|
};
|
|
607
610
|
MuiSlider: {
|
|
608
|
-
defaultProps:
|
|
611
|
+
defaultProps: import("../Components").DsSliderProps;
|
|
609
612
|
variants: {
|
|
610
613
|
props: Partial<import("../Components").DsSliderProps>;
|
|
611
614
|
style: {
|
|
@@ -725,6 +728,7 @@ declare const componentOverrides: {
|
|
|
725
728
|
styleOverrides: {
|
|
726
729
|
root: {
|
|
727
730
|
padding: string;
|
|
731
|
+
color: string;
|
|
728
732
|
};
|
|
729
733
|
};
|
|
730
734
|
};
|
|
@@ -979,9 +983,7 @@ declare const componentOverrides: {
|
|
|
979
983
|
};
|
|
980
984
|
};
|
|
981
985
|
MuiFormHelperText: {
|
|
982
|
-
|
|
983
|
-
root: import("@mui/system").CSSInterpolation;
|
|
984
|
-
};
|
|
986
|
+
defaultProps: import("../Components").DsHelperTextProps;
|
|
985
987
|
};
|
|
986
988
|
MuiFormControlLabel: {
|
|
987
989
|
styleOverrides: {
|
|
@@ -1074,6 +1076,7 @@ declare const componentOverrides: {
|
|
|
1074
1076
|
};
|
|
1075
1077
|
};
|
|
1076
1078
|
MuiDialog: {
|
|
1079
|
+
defaultProps: import("../Components").DsDialogProps;
|
|
1077
1080
|
styleOverrides: {
|
|
1078
1081
|
paper: {
|
|
1079
1082
|
backgroundColor: string;
|
|
@@ -1098,14 +1101,7 @@ declare const componentOverrides: {
|
|
|
1098
1101
|
props: Partial<import("../Components").DsChipProps>;
|
|
1099
1102
|
style: import("@mui/system").CSSInterpolation;
|
|
1100
1103
|
}[];
|
|
1101
|
-
styleOverrides: {
|
|
1102
|
-
root: import("@mui/system").CSSInterpolation;
|
|
1103
|
-
filled: import("@mui/system").CSSInterpolation;
|
|
1104
|
-
filledSecondary: import("@mui/system").CSSInterpolation;
|
|
1105
|
-
label: import("@mui/system").CSSInterpolation;
|
|
1106
|
-
icon: import("@mui/system").CSSInterpolation;
|
|
1107
|
-
deleteIcon: import("@mui/system").CSSInterpolation;
|
|
1108
|
-
};
|
|
1104
|
+
styleOverrides: {};
|
|
1109
1105
|
};
|
|
1110
1106
|
MuiCheckbox: {
|
|
1111
1107
|
defaultProps: import("../Components").DsCheckboxProps;
|
|
@@ -47,7 +47,7 @@ export default function getDarkModeColorScheme(colorPalette) {
|
|
|
47
47
|
supportPositive: successGreenDark,
|
|
48
48
|
supportWarning: warningOrangeDark,
|
|
49
49
|
supportVariable: snackBlue,
|
|
50
|
-
supportTypical:
|
|
50
|
+
supportTypical: typical,
|
|
51
51
|
supportNegativeNeutral: errorRedNeutralDark,
|
|
52
52
|
supportPositiveNeutral: successGreenNeutralDark,
|
|
53
53
|
supportWarningNeutral: warningOrangeNeutralDark,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DS_TYPOGRAPHY_HTML_FONT_SIZE = 16 | 17 | 18;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Types/index.d.ts
CHANGED