@zohodesk/components 1.6.27 → 1.6.28

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 (62) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/es/DividerLine/DividerLine.js +40 -0
  3. package/es/DividerLine/__tests__/DividerLine.spec.js +81 -0
  4. package/es/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
  5. package/es/DividerLine/constants/index.js +29 -0
  6. package/es/DividerLine/css/DividerLine.module.css +52 -0
  7. package/es/DividerLine/css/cssJSLogic.js +1 -0
  8. package/es/DividerLine/css/dividerLine.cva.js +42 -0
  9. package/es/DividerLine/props/defaultProps.js +11 -0
  10. package/es/DividerLine/props/propTypes.js +19 -0
  11. package/es/DropDown/DropDownSeparator.js +9 -4
  12. package/es/DropDown/DropDownSeparator.module.css +0 -4
  13. package/es/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
  14. package/es/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
  15. package/es/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
  16. package/es/MultiSelect/AdvancedMultiSelect.js +1 -0
  17. package/es/MultiSelect/SelectedOptions.js +3 -3
  18. package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +42 -0
  19. package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +10 -0
  20. package/es/MultiSelect/__tests__/MultiSelect.spec.js +10 -0
  21. package/es/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +121 -0
  22. package/es/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +97 -0
  23. package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +157 -0
  24. package/es/Select/SelectWithAvatar.js +14 -3
  25. package/es/Select/SelectWithIcon.js +23 -1
  26. package/es/Select/__tests__/SelectWithAvatar.spec.js +17 -0
  27. package/es/Select/__tests__/SelectWithIcon.spec.js +18 -0
  28. package/es/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
  29. package/es/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
  30. package/es/Select/props/propTypes.js +1 -0
  31. package/es/Tooltip/Tooltip.js +4 -1
  32. package/lib/DividerLine/DividerLine.js +50 -0
  33. package/lib/DividerLine/__tests__/DividerLine.spec.js +88 -0
  34. package/lib/DividerLine/__tests__/__snapshots__/DividerLine.spec.js.snap +131 -0
  35. package/lib/DividerLine/constants/index.js +39 -0
  36. package/lib/DividerLine/css/DividerLine.module.css +52 -0
  37. package/lib/DividerLine/css/cssJSLogic.js +13 -0
  38. package/lib/DividerLine/css/dividerLine.cva.js +57 -0
  39. package/lib/DividerLine/props/defaultProps.js +21 -0
  40. package/lib/DividerLine/props/propTypes.js +31 -0
  41. package/lib/DropDown/DropDownSeparator.js +9 -4
  42. package/lib/DropDown/DropDownSeparator.module.css +0 -4
  43. package/lib/DropDown/__tests__/DropDownSeparator.spec.js +8 -0
  44. package/lib/DropDown/__tests__/__snapshots__/DropDownSeparator.spec.js.snap +12 -2
  45. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +1 -0
  46. package/lib/MultiSelect/AdvancedMultiSelect.js +1 -0
  47. package/lib/MultiSelect/SelectedOptions.js +3 -3
  48. package/lib/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +42 -0
  49. package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +10 -0
  50. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +10 -0
  51. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedGroupMultiSelect.spec.js.snap +121 -0
  52. package/lib/MultiSelect/__tests__/__snapshots__/AdvancedMultiSelect.spec.js.snap +97 -0
  53. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +157 -0
  54. package/lib/Select/SelectWithAvatar.js +15 -3
  55. package/lib/Select/SelectWithIcon.js +26 -1
  56. package/lib/Select/__tests__/SelectWithAvatar.spec.js +20 -0
  57. package/lib/Select/__tests__/SelectWithIcon.spec.js +21 -0
  58. package/lib/Select/__tests__/__snapshots__/SelectWithAvatar.spec.js.snap +47 -0
  59. package/lib/Select/__tests__/__snapshots__/SelectWithIcon.spec.js.snap +19 -0
  60. package/lib/Select/props/propTypes.js +1 -0
  61. package/lib/Tooltip/Tooltip.js +6 -1
  62. package/package.json +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.28
4
+
5
+ - **DividerLine** - New component introduced
6
+ - **DropDownSeparator** - Adopted `DividerLine` component
7
+ - **SelectWithAvatar, SelectWithIcon** - `renderCustomSelectedValue` prop supported
8
+ - **AdvancedMultiSelect, AdvancedGroupMultiSelect, SelectedOptions** - Fixed an issue where the remove option was displayed for selected values when disabled
9
+ - **Tooltip** - Corrected the fallback behavior for nearby `data-title` attributes by ignoring empty values
10
+
3
11
  ## 1.6.27
4
12
 
5
13
  - **DateWidget** - RTL support: Date and time render order now correctly reversed in RTL direction for proper text flow alignment.
@@ -0,0 +1,40 @@
1
+ import { cn } from "@dot-system/css-utility";
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ import React from 'react';
6
+ import cssJSLogic from "./css/cssJSLogic";
7
+ import defaultProps from "./props/defaultProps";
8
+ import propTypes from "./props/propTypes";
9
+ const DividerLine = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const {
11
+ customId,
12
+ testId,
13
+ orientation,
14
+ customAttributes,
15
+ a11yAttributes
16
+ } = props;
17
+ const {
18
+ wrapperClass
19
+ } = cssJSLogic({
20
+ props
21
+ });
22
+ const {
23
+ wrapper: wrapperTagAttrs
24
+ } = customAttributes;
25
+ const {
26
+ wrapper: wrapperA11yAttrs
27
+ } = a11yAttributes;
28
+ return /*#__PURE__*/React.createElement("hr", _extends({}, wrapperTagAttrs, {
29
+ "aria-orientation": orientation
30
+ }, wrapperA11yAttrs, {
31
+ ref: ref,
32
+ className: cn(wrapperClass),
33
+ "data-id": customId,
34
+ "data-test-id": testId
35
+ }));
36
+ });
37
+ DividerLine.displayName = 'DividerLine';
38
+ DividerLine.defaultProps = defaultProps;
39
+ DividerLine.propTypes = propTypes;
40
+ export default DividerLine;
@@ -0,0 +1,81 @@
1
+ import React from 'react';
2
+ import { render, cleanup } from '@testing-library/react';
3
+ import DividerLine from "../DividerLine";
4
+ describe('DividerLine - Snapshot', () => {
5
+ afterEach(() => {
6
+ cleanup();
7
+ });
8
+ test('Render with default props', () => {
9
+ const {
10
+ asFragment
11
+ } = render( /*#__PURE__*/React.createElement(DividerLine, null));
12
+ expect(asFragment()).toMatchSnapshot();
13
+ });
14
+ test.each(['horizontal', 'vertical'])('Render with orientation as %s', orientation => {
15
+ const {
16
+ asFragment
17
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
18
+ orientation: orientation
19
+ }));
20
+ expect(asFragment()).toMatchSnapshot();
21
+ });
22
+ test.each(['solid', 'dashed', 'dotted'])('Render with lineStyle as %s', lineStyle => {
23
+ const {
24
+ asFragment
25
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
26
+ lineStyle: lineStyle
27
+ }));
28
+ expect(asFragment()).toMatchSnapshot();
29
+ });
30
+ test.each(['default', 'secondary', 'tertiary', 'brand'])('Render with color as %s', color => {
31
+ const {
32
+ asFragment
33
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
34
+ color: color
35
+ }));
36
+ expect(asFragment()).toMatchSnapshot();
37
+ });
38
+ test('Render with customId and testId', () => {
39
+ const {
40
+ asFragment
41
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
42
+ customId: "divider-line-customId",
43
+ testId: "divider-line-testId"
44
+ }));
45
+ expect(asFragment()).toMatchSnapshot();
46
+ });
47
+ test('Render with customAttributes', () => {
48
+ const {
49
+ asFragment
50
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
51
+ customAttributes: {
52
+ wrapper: {
53
+ 'data-custom-attr': 'true'
54
+ }
55
+ }
56
+ }));
57
+ expect(asFragment()).toMatchSnapshot();
58
+ });
59
+ test('Render with a11yAttributes', () => {
60
+ const {
61
+ asFragment
62
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
63
+ a11yAttributes: {
64
+ wrapper: {
65
+ 'aria-label': 'Section divider'
66
+ }
67
+ }
68
+ }));
69
+ expect(asFragment()).toMatchSnapshot();
70
+ });
71
+ test('Render with customClass', () => {
72
+ const {
73
+ asFragment
74
+ } = render( /*#__PURE__*/React.createElement(DividerLine, {
75
+ customClass: {
76
+ wrapper: 'my-divider-line'
77
+ }
78
+ }));
79
+ expect(asFragment()).toMatchSnapshot();
80
+ });
81
+ });
@@ -0,0 +1,131 @@
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
+
3
+ exports[`DividerLine - Snapshot Render with a11yAttributes 1`] = `
4
+ <DocumentFragment>
5
+ <hr
6
+ aria-label="Section divider"
7
+ aria-orientation="horizontal"
8
+ class="wrapper horizontal solid colorDefault"
9
+ />
10
+ </DocumentFragment>
11
+ `;
12
+
13
+ exports[`DividerLine - Snapshot Render with color as brand 1`] = `
14
+ <DocumentFragment>
15
+ <hr
16
+ aria-orientation="horizontal"
17
+ class="wrapper horizontal solid colorBrand"
18
+ />
19
+ </DocumentFragment>
20
+ `;
21
+
22
+ exports[`DividerLine - Snapshot Render with color as default 1`] = `
23
+ <DocumentFragment>
24
+ <hr
25
+ aria-orientation="horizontal"
26
+ class="wrapper horizontal solid colorDefault"
27
+ />
28
+ </DocumentFragment>
29
+ `;
30
+
31
+ exports[`DividerLine - Snapshot Render with color as secondary 1`] = `
32
+ <DocumentFragment>
33
+ <hr
34
+ aria-orientation="horizontal"
35
+ class="wrapper horizontal solid colorSecondary"
36
+ />
37
+ </DocumentFragment>
38
+ `;
39
+
40
+ exports[`DividerLine - Snapshot Render with color as tertiary 1`] = `
41
+ <DocumentFragment>
42
+ <hr
43
+ aria-orientation="horizontal"
44
+ class="wrapper horizontal solid colorTertiary"
45
+ />
46
+ </DocumentFragment>
47
+ `;
48
+
49
+ exports[`DividerLine - Snapshot Render with customAttributes 1`] = `
50
+ <DocumentFragment>
51
+ <hr
52
+ aria-orientation="horizontal"
53
+ class="wrapper horizontal solid colorDefault"
54
+ data-custom-attr="true"
55
+ />
56
+ </DocumentFragment>
57
+ `;
58
+
59
+ exports[`DividerLine - Snapshot Render with customClass 1`] = `
60
+ <DocumentFragment>
61
+ <hr
62
+ aria-orientation="horizontal"
63
+ class="wrapper horizontal solid colorDefault my-divider-line"
64
+ />
65
+ </DocumentFragment>
66
+ `;
67
+
68
+ exports[`DividerLine - Snapshot Render with customId and testId 1`] = `
69
+ <DocumentFragment>
70
+ <hr
71
+ aria-orientation="horizontal"
72
+ class="wrapper horizontal solid colorDefault"
73
+ data-id="divider-line-customId"
74
+ data-test-id="divider-line-testId"
75
+ />
76
+ </DocumentFragment>
77
+ `;
78
+
79
+ exports[`DividerLine - Snapshot Render with default props 1`] = `
80
+ <DocumentFragment>
81
+ <hr
82
+ aria-orientation="horizontal"
83
+ class="wrapper horizontal solid colorDefault"
84
+ />
85
+ </DocumentFragment>
86
+ `;
87
+
88
+ exports[`DividerLine - Snapshot Render with lineStyle as dashed 1`] = `
89
+ <DocumentFragment>
90
+ <hr
91
+ aria-orientation="horizontal"
92
+ class="wrapper horizontal dashed colorDefault"
93
+ />
94
+ </DocumentFragment>
95
+ `;
96
+
97
+ exports[`DividerLine - Snapshot Render with lineStyle as dotted 1`] = `
98
+ <DocumentFragment>
99
+ <hr
100
+ aria-orientation="horizontal"
101
+ class="wrapper horizontal dotted colorDefault"
102
+ />
103
+ </DocumentFragment>
104
+ `;
105
+
106
+ exports[`DividerLine - Snapshot Render with lineStyle as solid 1`] = `
107
+ <DocumentFragment>
108
+ <hr
109
+ aria-orientation="horizontal"
110
+ class="wrapper horizontal solid colorDefault"
111
+ />
112
+ </DocumentFragment>
113
+ `;
114
+
115
+ exports[`DividerLine - Snapshot Render with orientation as horizontal 1`] = `
116
+ <DocumentFragment>
117
+ <hr
118
+ aria-orientation="horizontal"
119
+ class="wrapper horizontal solid colorDefault"
120
+ />
121
+ </DocumentFragment>
122
+ `;
123
+
124
+ exports[`DividerLine - Snapshot Render with orientation as vertical 1`] = `
125
+ <DocumentFragment>
126
+ <hr
127
+ aria-orientation="vertical"
128
+ class="wrapper vertical solid colorDefault"
129
+ />
130
+ </DocumentFragment>
131
+ `;
@@ -0,0 +1,29 @@
1
+ export const ORIENTATION = {
2
+ HORIZONTAL: 'horizontal',
3
+ VERTICAL: 'vertical'
4
+ };
5
+ export const LINE_STYLE = {
6
+ SOLID: 'solid',
7
+ DASHED: 'dashed',
8
+ DOTTED: 'dotted'
9
+ };
10
+ export const LINE_STYLE_CLASS_MAP = {
11
+ [LINE_STYLE.SOLID]: 'solid',
12
+ [LINE_STYLE.DASHED]: 'dashed',
13
+ [LINE_STYLE.DOTTED]: 'dotted'
14
+ };
15
+ export const COLOR = {
16
+ DEFAULT: 'default',
17
+ SECONDARY: 'secondary',
18
+ TERTIARY: 'tertiary',
19
+ BRAND: 'brand'
20
+ };
21
+ export const COLOR_CLASS_MAP = {
22
+ [COLOR.DEFAULT]: 'colorDefault',
23
+ [COLOR.SECONDARY]: 'colorSecondary',
24
+ [COLOR.TERTIARY]: 'colorTertiary',
25
+ [COLOR.BRAND]: 'colorBrand'
26
+ };
27
+ export const DEFAULT_ORIENTATION = ORIENTATION.HORIZONTAL;
28
+ export const DEFAULT_LINE_STYLE = LINE_STYLE.SOLID;
29
+ export const DEFAULT_COLOR = COLOR.DEFAULT;
@@ -0,0 +1,52 @@
1
+ .wrapper {
2
+ flex-shrink: 0;
3
+ border: none;
4
+ margin: 0 ;
5
+ }
6
+
7
+ .horizontal {
8
+ inline-size: 100% ;
9
+ block-size: 0 ;
10
+ border-block-start-width: 1px;
11
+ }
12
+
13
+ .vertical {
14
+ inline-size: 0 ;
15
+ block-size: 100% ;
16
+ border-inline-start-width: 1px;
17
+ }
18
+
19
+ .solid {
20
+ border-block-start-style: solid;
21
+ border-inline-start-style: solid;
22
+ }
23
+
24
+ .dashed {
25
+ border-block-start-style: dashed;
26
+ border-inline-start-style: dashed;
27
+ }
28
+
29
+ .dotted {
30
+ border-block-start-style: dotted;
31
+ border-inline-start-style: dotted;
32
+ }
33
+
34
+ .colorDefault {
35
+ border-block-start-color: var(--zd-border-primary);
36
+ border-inline-start-color: var(--zd-border-primary);
37
+ }
38
+
39
+ .colorSecondary {
40
+ border-block-start-color: var(--zd-border-secondary);
41
+ border-inline-start-color: var(--zd-border-secondary);
42
+ }
43
+
44
+ .colorTertiary {
45
+ border-block-start-color: var(--zd-border-tertiary);
46
+ border-inline-start-color: var(--zd-border-tertiary);
47
+ }
48
+
49
+ .colorBrand {
50
+ border-block-start-color: var(--zd-border-brand);
51
+ border-inline-start-color: var(--zd-border-brand);
52
+ }
@@ -0,0 +1 @@
1
+ export { dividerLine_cva as default } from "./dividerLine.cva";
@@ -0,0 +1,42 @@
1
+ import { cva } from '@dot-system/css-utility';
2
+ import { DUMMY_OBJECT } from '@zohodesk/utils/es/constantProps/constant';
3
+ import style from "./DividerLine.module.css";
4
+ import { LINE_STYLE_CLASS_MAP, COLOR_CLASS_MAP, DEFAULT_ORIENTATION, DEFAULT_LINE_STYLE, DEFAULT_COLOR } from "../constants";
5
+
6
+ const resolveClassVariants = classMap => Object.keys(classMap).reduce((acc, key) => {
7
+ acc[key] = style[classMap[key]];
8
+ return acc;
9
+ }, {});
10
+
11
+ const wrapperVariants = cva(style.wrapper, {
12
+ variants: {
13
+ orientation: {
14
+ horizontal: style.horizontal,
15
+ vertical: style.vertical
16
+ },
17
+ lineStyle: resolveClassVariants(LINE_STYLE_CLASS_MAP),
18
+ color: resolveClassVariants(COLOR_CLASS_MAP)
19
+ }
20
+ });
21
+ export function dividerLine_cva({
22
+ props
23
+ }) {
24
+ const {
25
+ orientation = DEFAULT_ORIENTATION,
26
+ lineStyle = DEFAULT_LINE_STYLE,
27
+ color = DEFAULT_COLOR,
28
+ customClass = DUMMY_OBJECT
29
+ } = props;
30
+ const {
31
+ wrapper: wrapperCustomClass = ''
32
+ } = customClass;
33
+ const wrapperClass = wrapperVariants({
34
+ orientation,
35
+ lineStyle,
36
+ color,
37
+ className: wrapperCustomClass
38
+ });
39
+ return {
40
+ wrapperClass
41
+ };
42
+ }
@@ -0,0 +1,11 @@
1
+ import { DEFAULT_ORIENTATION, DEFAULT_LINE_STYLE, DEFAULT_COLOR } from "../constants";
2
+ import { DUMMY_OBJECT } from '@zohodesk/utils/es/constantProps/constant';
3
+ const defaultProps = {
4
+ orientation: DEFAULT_ORIENTATION,
5
+ lineStyle: DEFAULT_LINE_STYLE,
6
+ color: DEFAULT_COLOR,
7
+ customClass: DUMMY_OBJECT,
8
+ customAttributes: DUMMY_OBJECT,
9
+ a11yAttributes: DUMMY_OBJECT
10
+ };
11
+ export default defaultProps;
@@ -0,0 +1,19 @@
1
+ import PropTypes from 'prop-types';
2
+ import { ORIENTATION, LINE_STYLE, COLOR } from "../constants";
3
+ const propTypes = {
4
+ customId: PropTypes.string,
5
+ testId: PropTypes.string,
6
+ orientation: PropTypes.oneOf(Object.values(ORIENTATION)),
7
+ lineStyle: PropTypes.oneOf(Object.values(LINE_STYLE)),
8
+ color: PropTypes.oneOf(Object.values(COLOR)),
9
+ customClass: PropTypes.shape({
10
+ wrapper: PropTypes.string
11
+ }),
12
+ customAttributes: PropTypes.shape({
13
+ wrapper: PropTypes.object
14
+ }),
15
+ a11yAttributes: PropTypes.shape({
16
+ wrapper: PropTypes.object
17
+ })
18
+ };
19
+ export default propTypes;
@@ -1,14 +1,19 @@
1
1
  import React from 'react';
2
+ import DividerLine from "../DividerLine/DividerLine";
2
3
  import { DropDownSeparator_propTypes } from "./props/propTypes";
3
- import { cn } from "@dot-system/css-utility";
4
4
  import style from "./DropDownSeparator.module.css";
5
5
  export default class DropDownSeparator extends React.Component {
6
6
  render() {
7
- let {
7
+ const {
8
8
  customClass = ''
9
9
  } = this.props;
10
- return /*#__PURE__*/React.createElement("div", {
11
- className: cn(`${style.separator} ${customClass}`)
10
+ return /*#__PURE__*/React.createElement(DividerLine, {
11
+ orientation: "horizontal",
12
+ lineStyle: "solid",
13
+ color: "secondary",
14
+ customClass: {
15
+ wrapper: `${style.separator} ${customClass}`
16
+ }
12
17
  });
13
18
  }
14
19
 
@@ -1,8 +1,4 @@
1
1
  .separator {
2
- height: var(--zd_size1) ;
3
2
  margin-block: var(--zd_size5) ;
4
3
  margin-inline: 0 ;
5
- border-width: 0 0 1px 0;
6
- border-style: solid;
7
- border-color: var(--zdt_dropdown_user_default_border);
8
4
  }
@@ -8,4 +8,12 @@ describe('DropDownSeparator', () => {
8
8
  } = render( /*#__PURE__*/React.createElement(DropDownSeparator, null));
9
9
  expect(asFragment()).toMatchSnapshot();
10
10
  });
11
+ test('rendering the custom class', () => {
12
+ const {
13
+ asFragment
14
+ } = render( /*#__PURE__*/React.createElement(DropDownSeparator, {
15
+ customClass: "my-custom-class"
16
+ }));
17
+ expect(asFragment()).toMatchSnapshot();
18
+ });
11
19
  });
@@ -1,9 +1,19 @@
1
1
  // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
+ exports[`DropDownSeparator rendering the custom class 1`] = `
4
+ <DocumentFragment>
5
+ <hr
6
+ aria-orientation="horizontal"
7
+ class="wrapper horizontal solid colorSecondary separator my-custom-class"
8
+ />
9
+ </DocumentFragment>
10
+ `;
11
+
3
12
  exports[`DropDownSeparator rendering the defult props 1`] = `
4
13
  <DocumentFragment>
5
- <div
6
- class="separator"
14
+ <hr
15
+ aria-orientation="horizontal"
16
+ class="wrapper horizontal solid colorSecondary separator"
7
17
  />
8
18
  </DocumentFragment>
9
19
  `;
@@ -945,6 +945,7 @@ class AdvancedGroupMultiSelect extends React.Component {
945
945
  selectedOptions: formatSelectedOptions,
946
946
  highLightedSelectOptions: highLightedSelectOptions,
947
947
  isReadOnly: isReadOnly,
948
+ isDisabled: isDisabled,
948
949
  getRef: this.selectedOptionRef,
949
950
  onRemove: this.handleRemoveOption,
950
951
  onSelect: this.handleClickSelectedOption,
@@ -453,6 +453,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
453
453
  selectedOptions: selectedOptions,
454
454
  highLightedSelectOptions: highLightedSelectOptions,
455
455
  isReadOnly: isReadOnly,
456
+ isDisabled: isDisabled,
456
457
  getRef: this.selectedOptionRef,
457
458
  onRemove: this.handleRemoveOption,
458
459
  onSelect: this.handleClickSelectedOption,
@@ -44,8 +44,8 @@ export default class SelectedOptions extends React.PureComponent {
44
44
  isDisabled
45
45
  } = option;
46
46
  const commonProps = {
47
- disabled: isDisabled,
48
- onRemove: isDisabled || isReadOnly ? null : onRemove,
47
+ disabled: isDisabled || isInputDisabled,
48
+ onRemove: isDisabled || isInputDisabled || isReadOnly ? null : onRemove,
49
49
  text: value,
50
50
  palette: isDarkPalette,
51
51
  onSelectTag: isReadOnly ? null : onSelect,
@@ -81,7 +81,7 @@ export default class SelectedOptions extends React.PureComponent {
81
81
  key: `${id}customTag`,
82
82
  dataId: dataId
83
83
  }, typeof renderCustomSelectedValue == 'function' ? renderCustomSelectedValue({
84
- onRemove: isDisabled || isReadOnly ? null : onRemove,
84
+ onRemove: isDisabled || isInputDisabled || isReadOnly ? null : onRemove,
85
85
  palette: isDarkPalette,
86
86
  onSelectTag: isReadOnly ? null : onSelect,
87
87
  getRef: getRef,
@@ -2,6 +2,38 @@ import React from 'react';
2
2
  import { render } from '@testing-library/react';
3
3
  import AdvancedGroupMultiSelect from "../AdvancedGroupMultiSelect";
4
4
  describe('AdvancedGroupMultiSelect', () => {
5
+ const options = [{
6
+ id: 'Group1',
7
+ name: 'Group 1',
8
+ options: [{
9
+ id: 'group11',
10
+ value: 'Option 1'
11
+ }, {
12
+ id: 'group12',
13
+ value: 'Option 2'
14
+ }],
15
+ textField: 'value',
16
+ valueField: 'id'
17
+ }, {
18
+ id: 'Group2',
19
+ name: 'Group 2',
20
+ options: [{
21
+ id: 'group21',
22
+ value: 'Group2 Option 1'
23
+ }, {
24
+ id: 'group22',
25
+ value: 'Group2 Option 2'
26
+ }],
27
+ textField: 'value',
28
+ valueField: 'id'
29
+ }];
30
+ const selectedGroupOptions = [{
31
+ groupId: 'Group1',
32
+ id: 'group11'
33
+ }, {
34
+ groupId: 'Group2',
35
+ id: 'group22'
36
+ }];
5
37
  test('rendering the defult props', () => {
6
38
  const mockOnChange = jest.fn();
7
39
  const {
@@ -9,4 +41,14 @@ describe('AdvancedGroupMultiSelect', () => {
9
41
  } = render( /*#__PURE__*/React.createElement(AdvancedGroupMultiSelect, null));
10
42
  expect(asFragment()).toMatchSnapshot();
11
43
  });
44
+ test('Should render as disabled', () => {
45
+ const {
46
+ asFragment
47
+ } = render( /*#__PURE__*/React.createElement(AdvancedGroupMultiSelect, {
48
+ options: options,
49
+ selectedGroupOptions: selectedGroupOptions,
50
+ isDisabled: true
51
+ }));
52
+ expect(asFragment()).toMatchSnapshot();
53
+ });
12
54
  });
@@ -44,4 +44,14 @@ describe('AdvancedMultiSelect', () => {
44
44
  }));
45
45
  expect(asFragment()).toMatchSnapshot();
46
46
  });
47
+ test('Should render as disabled', () => {
48
+ const {
49
+ asFragment
50
+ } = render( /*#__PURE__*/React.createElement(AdvancedMultiSelect, {
51
+ options: options,
52
+ selectedOptions: ['Apple'],
53
+ isDisabled: true
54
+ }));
55
+ expect(asFragment()).toMatchSnapshot();
56
+ });
47
57
  });
@@ -71,4 +71,14 @@ describe('MultiSelect', () => {
71
71
  }));
72
72
  expect(asFragment()).toMatchSnapshot();
73
73
  });
74
+ test('Should render as disabled', () => {
75
+ const {
76
+ asFragment
77
+ } = render( /*#__PURE__*/React.createElement(MultiSelect, {
78
+ options: options,
79
+ selectedOptions: testSelectedData,
80
+ isDisabled: true
81
+ }));
82
+ expect(asFragment()).toMatchSnapshot();
83
+ });
74
84
  });