@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.
Files changed (114) hide show
  1. package/dist/Components/DsAppBar/DsAppBar.Component.d.ts +2 -5
  2. package/dist/Components/DsAppBar/DsAppBar.Component.js +19 -24
  3. package/dist/Components/DsAvatar/DsAvatar.Component.d.ts +3 -1
  4. package/dist/Components/DsAvatar/DsAvatar.Component.js +5 -1
  5. package/dist/Components/DsBottomSheet/DsBottomSheet.Component.d.ts +2 -7
  6. package/dist/Components/DsBottomSheet/DsBottomSheet.Component.js +62 -65
  7. package/dist/Components/DsButton/DsButton.Component.d.ts +2 -4
  8. package/dist/Components/DsButton/DsButton.Component.js +4 -7
  9. package/dist/Components/DsButtonGroup/DsButtonGroup.Component.d.ts +2 -6
  10. package/dist/Components/DsButtonGroup/DsButtonGroup.Component.js +16 -18
  11. package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselNavigation.d.ts +2 -3
  12. package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselNavigation.js +42 -44
  13. package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselPagination.d.ts +2 -6
  14. package/dist/Components/DsCarousel/DsCarousel.Component/DsCarouselPagination.js +109 -110
  15. package/dist/Components/DsCarousel/DsCarousel.Component/index.d.ts +3 -19
  16. package/dist/Components/DsCarousel/DsCarousel.Component/index.js +55 -57
  17. package/dist/Components/DsChip/DsChip.Component.d.ts +2 -5
  18. package/dist/Components/DsChip/DsChip.Component.js +3 -8
  19. package/dist/Components/DsChip/DsChip.Overrides.d.ts +1 -8
  20. package/dist/Components/DsChip/DsChip.Overrides.js +12 -57
  21. package/dist/Components/DsChip/DsChip.Types.d.ts +9 -2
  22. package/dist/Components/DsChipGroup/DsChipGroup.Component.d.ts +2 -5
  23. package/dist/Components/DsChipGroup/DsChipGroup.Component.js +5 -8
  24. package/dist/Components/DsContentSlider/DsContentSlider.Component.d.ts +3 -8
  25. package/dist/Components/DsContentSlider/DsContentSlider.Component.js +13 -20
  26. package/dist/Components/DsDialog/DsDialog.Component.d.ts +1 -6
  27. package/dist/Components/DsDialog/DsDialog.Component.js +71 -75
  28. package/dist/Components/DsDialog/DsDialog.Overrides.d.ts +1 -0
  29. package/dist/Components/DsDialog/DsDialog.Overrides.js +2 -0
  30. package/dist/Components/DsFileUploader/DsFileUploader.Component.d.ts +3 -16
  31. package/dist/Components/DsFileUploader/DsFileUploader.Component.js +68 -71
  32. package/dist/Components/DsHeader/DsHeader.Component.d.ts +2 -5
  33. package/dist/Components/DsHeader/DsHeader.Component.js +29 -32
  34. package/dist/Components/DsHelperText/DsHelperText.Component.d.ts +2 -5
  35. package/dist/Components/DsHelperText/DsHelperText.Component.js +16 -21
  36. package/dist/Components/DsHelperText/DsHelperText.Overrides.d.ts +5 -1
  37. package/dist/Components/DsHelperText/DsHelperText.Overrides.js +6 -1
  38. package/dist/Components/DsImage/DsImage.Component.d.ts +3 -12
  39. package/dist/Components/DsImage/DsImage.Component.js +40 -45
  40. package/dist/Components/DsImage/DsImage.Types.d.ts +0 -1
  41. package/dist/Components/DsImage/DsImage.Types.js +0 -3
  42. package/dist/Components/DsInputLabel/DsInputLabel.Component.d.ts +2 -4
  43. package/dist/Components/DsInputLabel/DsInputLabel.Component.js +6 -9
  44. package/dist/Components/DsNotistack/AlertMessage.Component.js +7 -9
  45. package/dist/Components/DsNotistack/DsNotistack.Component.d.ts +2 -7
  46. package/dist/Components/DsNotistack/DsNotistack.Component.js +12 -16
  47. package/dist/Components/DsNotistack/DsNotistack.Types.d.ts +1 -0
  48. package/dist/Components/DsNotistack/DsNotistack.Types.js +3 -1
  49. package/dist/Components/DsOtp/DsOtp.Component.d.ts +3 -15
  50. package/dist/Components/DsOtp/DsOtp.Component.js +41 -51
  51. package/dist/Components/DsPopup/DsPopup.Types.d.ts +1 -1
  52. package/dist/Components/DsProgressIndicator/DsProgressIndicator.Component.d.ts +2 -6
  53. package/dist/Components/DsProgressIndicator/DsProgressIndicator.Component.js +18 -21
  54. package/dist/Components/DsProgressTracker/DsProgressStepper.Component.d.ts +3 -9
  55. package/dist/Components/DsProgressTracker/DsProgressStepper.Component.js +8 -11
  56. package/dist/Components/DsProgressTracker/DsProgressTracker.Component.d.ts +3 -21
  57. package/dist/Components/DsProgressTracker/DsProgressTracker.Component.js +17 -26
  58. package/dist/Components/DsRadio/DsRadio.Component.d.ts +2 -5
  59. package/dist/Components/DsRadio/DsRadio.Component.js +5 -8
  60. package/dist/Components/DsRadio/DsRadio.Overrides.d.ts +1 -0
  61. package/dist/Components/DsRadio/DsRadio.Overrides.js +2 -1
  62. package/dist/Components/DsRemixIcon/DsRemixIcon.Component.d.ts +2 -4
  63. package/dist/Components/DsRemixIcon/DsRemixIcon.Component.js +5 -7
  64. package/dist/Components/DsSelect/DsSelect.Component.d.ts +2 -6
  65. package/dist/Components/DsSelect/DsSelect.Component.js +49 -53
  66. package/dist/Components/DsSelect/DsSelect.Types.d.ts +8 -0
  67. package/dist/Components/DsSlider/DsSlider.Component.d.ts +1 -5
  68. package/dist/Components/DsSlider/DsSlider.Component.js +1 -10
  69. package/dist/Components/DsSlider/DsSlider.Overrides.d.ts +1 -1
  70. package/dist/Components/DsSlider/DsSlider.Overrides.js +2 -2
  71. package/dist/Components/DsSwitch/DsSwitch.Component.d.ts +2 -6
  72. package/dist/Components/DsSwitch/DsSwitch.Component.js +7 -10
  73. package/dist/Components/DsTag/DsTag.Component.d.ts +2 -7
  74. package/dist/Components/DsTag/DsTag.Component.js +50 -14
  75. package/dist/Components/DsTag/DsTag.Overrides.d.ts +5 -1
  76. package/dist/Components/DsTag/DsTag.Overrides.js +6 -2
  77. package/dist/Components/DsTagGroup/DsTagGroup.Component.d.ts +2 -7
  78. package/dist/Components/DsTagGroup/DsTagGroup.Component.js +25 -27
  79. package/dist/Components/DsTextArea/DsTextArea.Component.d.ts +3 -10
  80. package/dist/Components/DsTextArea/DsTextArea.Component.js +49 -54
  81. package/dist/Components/DsTextArea/DsTextArea.Types.d.ts +0 -1
  82. package/dist/Components/DsTextArea/DsTextArea.Types.js +1 -3
  83. package/dist/Components/DsTextField/DsTextField.Component.d.ts +2 -4
  84. package/dist/Components/DsTextField/DsTextField.Component.js +7 -8
  85. package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Component.d.ts +3 -10
  86. package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Component.js +15 -26
  87. package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Types.d.ts +0 -1
  88. package/dist/Components/DsTextFieldPassword/DsTextFieldPassword.Types.js +0 -3
  89. package/dist/Components/DsToast/DsToast.Component.d.ts +2 -4
  90. package/dist/Components/DsToast/DsToast.Component.js +9 -7
  91. package/dist/Components/DsToggle/DsToggle.Component.d.ts +2 -5
  92. package/dist/Components/DsToggle/DsToggle.Component.js +11 -9
  93. package/dist/Components/DsToggle/DsToggle.Types.js +1 -1
  94. package/dist/Components/DsTooltip/DsTooltip.Component.d.ts +2 -5
  95. package/dist/Components/DsTooltip/DsTooltip.Component.js +7 -9
  96. package/dist/Constants/TYPOGRAPGHY.d.ts +4 -1
  97. package/dist/Constants/TYPOGRAPGHY.js +3 -0
  98. package/dist/Helpers/accessibility.d.ts +3 -0
  99. package/dist/Helpers/accessibility.js +14 -0
  100. package/dist/Helpers/index.d.ts +1 -0
  101. package/dist/Helpers/index.js +1 -0
  102. package/dist/Hooks/accessibility.d.ts +9 -0
  103. package/dist/Hooks/accessibility.js +35 -0
  104. package/dist/Hooks/index.d.ts +1 -0
  105. package/dist/Hooks/index.js +1 -0
  106. package/dist/Theme/componentOverrides.d.ts +8 -12
  107. package/dist/Theme/getColorScheme/dark.js +1 -1
  108. package/dist/Types/DsAccessibility.d.ts +1 -0
  109. package/dist/Types/DsAccessibility.js +1 -0
  110. package/dist/Types/index.d.ts +1 -0
  111. package/dist/Types/index.js +1 -0
  112. package/dist/index.d.ts +1 -0
  113. package/dist/index.js +1 -0
  114. package/package.json +1 -1
@@ -1,17 +1,17 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { PureComponent } from '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 class DsTagGroup extends PureComponent {
7
- static defaultProps = DsTagGroupDefaultProps;
8
- handleUnselect = (handleValue) => {
9
- const { name, value = [], onChange } = this.props;
10
- const changedValue = value.filter((e) => e !== handleValue);
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 } = this.props;
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
- render() {
25
- const { multi, children, value, name, onChange, ...restStackProps } = this.props;
26
- const childrenArray = children instanceof Array ? children : [children];
27
- return (_jsx(DsStack, { direction: 'row', spacing: 'var(--ds-spacing-glacial)', ...restStackProps, children: childrenArray.map(child => {
28
- const { value: chipValue } = child.props;
29
- const selected = (multi && value.includes(chipValue)) || value === chipValue;
30
- const onDelete = (multi && selected && this.handleUnselect) || undefined;
31
- const onClick = (selected && onDelete) || this.handleSelect;
32
- const childClone = React.cloneElement(child, {
33
- value: chipValue,
34
- selected,
35
- deleteIcon: _jsx(DsRemixIcon, { className: "ri-close-circle-fill" }),
36
- onDelete,
37
- onClick
38
- });
39
- return childClone;
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 React, { PureComponent } from 'react';
2
- import { DsTextAreaProps, DsTextAreaState } from './DsTextArea.Types';
3
- export declare class DsTextArea extends PureComponent<DsTextAreaProps, DsTextAreaState> {
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 React, { PureComponent } from 'react';
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
- import { DsTextAreaDefaultState } from './DsTextArea.Types';
7
- export class DsTextArea extends PureComponent {
8
- state = DsTextAreaDefaultState;
9
- areRef = React.createRef();
10
- handleChange = (event) => {
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.length;
15
- this.setState({ count });
13
+ let count = value?.length;
14
+ setCount(count);
16
15
  if (onChange && typeof onChange === 'function') {
17
16
  onChange(event);
18
17
  }
19
18
  };
20
- componentDidMount() {
21
- const { value = '' } = this.props;
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
- if (count && currentStateCount !== count) {
30
- this.setState({ count });
31
- }
32
- }
33
- render() {
34
- const { maxLength, hideCharacterCount, helperText, inputProps, ref, fullWidth, ...rest } = this.props;
35
- const { count } = this.state;
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
- return (_jsxs(DsFormControl, { fullWidth: fullWidth, children: [_jsx(DsTextField, { maxRows: 3, minRows: 3, ...rest, fullWidth: fullWidth, onChange: this.handleChange, multiline: true, inputProps: {
52
- ref: ref || this.areRef,
53
- ...inputProps,
54
- sx: {
55
- minWidth: '288px',
56
- ...maxLengthHandlingInputStyle,
57
- ...inputProps?.sx
58
- },
59
- maxLength: maxLength || ''
60
- }, helperText: helperText,
61
- // TODO: To be fixed when we fix the sx passing to inputbase
62
- style: {
63
- paddingBottom: 'var(--ds-spacing-mild)',
64
- ...rest?.style
65
- } }), hasMaxLength && !hideCharacterCount && (_jsx(DsTypography, { sx: counterStyle, variant: "supportRegularFootnote", children: `${count}/${maxLength}` }))] }));
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
+ };
@@ -6,4 +6,3 @@ export interface DsTextAreaProps extends DsTextFieldProps {
6
6
  export interface DsTextAreaState {
7
7
  count: number;
8
8
  }
9
- export declare const DsTextAreaDefaultState: DsTextAreaState;
@@ -1,3 +1 @@
1
- export const DsTextAreaDefaultState = {
2
- count: 0
3
- };
1
+ export {};
@@ -1,5 +1,3 @@
1
- import { PureComponent } from 'react';
1
+ import { FC } from 'react';
2
2
  import { DsTextFieldProps } from './DsTextField.Types';
3
- export declare class DsTextField extends PureComponent<DsTextFieldProps> {
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 { PureComponent } from 'react';
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 class DsTextField extends PureComponent {
8
- render() {
9
- const { id, name, label, labelSupportText, color, helperText, success, error, sx, fullWidth, ref, inputRef, disabled, required, FormControlProps, InputLabelProps, HelperTextProps, ...inputBaseProps } = this.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
- }
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 { Component } from 'react';
2
- import { DsTextFieldPasswordProps, DsTextFieldPasswordState } from './DsTextFieldPassword.Types';
3
- export declare class DsTextFieldPassword extends Component<DsTextFieldPasswordProps, DsTextFieldPasswordState> {
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, { Component } from 'react';
2
+ import React, { useState } from 'react';
3
3
  import { DsInputAdornment } from '../DsInputAdornment';
4
4
  import { DsTextField } from '../DsTextField';
5
- import { DsTextFieldPasswordDefaultProps, DsTextFieldPasswordDefaultState } from './DsTextFieldPassword.Types';
6
- export class DsTextFieldPassword extends Component {
7
- static defaultProps = DsTextFieldPasswordDefaultProps;
8
- state;
9
- constructor(props) {
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 = () => this.setState({ isVisible: !this.state.isVisible });
20
- render() {
21
- const { isVisible } = this.state;
22
- const mergedProps = this.getMergedProps();
23
- const { type, isVisible: isVisibleProp, disabled, toggleNode, ...restProps } = mergedProps;
24
- const inputType = (isVisible && type) || 'password';
25
- const endAdornment = isVisible
26
- ? React.cloneElement(toggleNode?.toHide || _jsx(_Fragment, {}), { disabled })
27
- : React.cloneElement(toggleNode?.toShow || _jsx(_Fragment, {}), { disabled });
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
+ };
@@ -10,4 +10,3 @@ export declare const DsTextFieldPasswordDefaultProps: DsTextFieldPasswordProps;
10
10
  export interface DsTextFieldPasswordState {
11
11
  isVisible: boolean;
12
12
  }
13
- export declare const DsTextFieldPasswordDefaultState: DsTextFieldPasswordState;
@@ -9,6 +9,3 @@ export const DsTextFieldPasswordDefaultProps = {
9
9
  toHide: (_jsx(DsButton, { variant: "text", color: "secondary", sx: { minWidth: '50px' }, children: "HIDE" }))
10
10
  }
11
11
  };
12
- export const DsTextFieldPasswordDefaultState = {
13
- isVisible: false
14
- };
@@ -1,5 +1,3 @@
1
- import { PureComponent } from 'react';
1
+ import { FC } from 'react';
2
2
  import { DsToastProps } from './DsToast.Types';
3
- export declare class DsToast extends PureComponent<DsToastProps> {
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 class DsToast extends PureComponent {
10
- render() {
11
- const { forwardedRef, ...restProps } = this.props;
12
- return (_jsx(Alert, { ref: forwardedRef, ...restProps, slots: { closeIcon: CloseIcon, ...restProps?.slots } }));
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 React, { PureComponent } from 'react';
1
+ import { FC } from 'react';
2
2
  import { DsToggleProps } from './DsToggle.Types';
3
- export declare class DsToggle extends PureComponent<DsToggleProps> {
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
- export class DsToggle extends PureComponent {
5
- handleChange = (event) => {
6
- const { onChange } = this.props;
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
- render() {
13
- const { value, onChange, ...restProps } = this.props;
14
- return (_jsx(Switch, { ...restProps, color: "secondary", checked: value, onChange: this.handleChange }));
15
- }
16
- }
16
+ const { value, onChange, ...restProps } = props;
17
+ return (_jsx(Switch, { ...restProps, color: "secondary", checked: value, onChange: handleChange }));
18
+ };
@@ -1,5 +1,5 @@
1
1
  export const DsToggleDefaultProps = {
2
2
  name: '',
3
- value: false,
3
+ value: true,
4
4
  onChange: () => undefined
5
5
  };
@@ -1,6 +1,3 @@
1
- import { PureComponent } from 'react';
1
+ import { FC } from 'react';
2
2
  import { DsTooltipProps } from './DsTooltip.Types';
3
- export declare class DsTooltip extends PureComponent<DsTooltipProps> {
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, { PureComponent } from '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 class DsTooltip extends PureComponent {
7
- renderTitle = () => {
8
- const { heading, description, buttonGroup } = this.props;
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
- render() {
20
- const { heading, description, buttonGroup, children, ...tooltipProps } = this.props;
21
- return (_jsx(Tooltip, { title: this.renderTitle(), ...tooltipProps, children: _jsx(DsLink, { component: "span", underline: "always", color: "inherit", variant: "inherit", sx: { textDecorationColor: 'inherit' }, children: children }) }));
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,3 @@
1
+ import { DS_TYPOGRAPHY_HTML_FONT_SIZE } from '../Types';
2
+ export declare const getCurrentFontSize: () => DS_TYPOGRAPHY_HTML_FONT_SIZE;
3
+ export declare const isValidFontSize: (fontSize: DS_TYPOGRAPHY_HTML_FONT_SIZE) => boolean;
@@ -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
- styleOverrides: {
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: snackBlueNeutralDark,
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 {};
@@ -4,3 +4,4 @@ export * from './DsElevation';
4
4
  export * from './DsSpacing';
5
5
  export * from './DsPalette';
6
6
  export * from './DsRadius';
7
+ export * from './DsAccessibility';