@zohodesk/components 1.0.0-temp-199.18 → 1.0.0-temp-246
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/README.md +15 -1
- package/assets/Appearance/dark/mode/Component_DarkMode.module.css +2 -0
- package/assets/Appearance/light/mode/Component_LightMode.module.css +2 -0
- package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +2 -0
- package/es/CheckBox/CheckBox.js +21 -10
- package/es/CheckBox/CheckBox.module.css +21 -6
- package/es/CheckBox/__tests__/CheckBox.spec.js +9 -0
- package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/es/CheckBox/props/propTypes.js +4 -1
- package/es/ColorSelect/ColorSingleSelect.js +0 -1
- package/es/ColorSelect/__tests__/ColorMultiSelect.spec.js +15 -3
- package/es/ColorSelect/__tests__/ColorSingleSelect.spec.js +15 -3
- package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +2 -2
- package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +8 -8
- package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +7 -3
- package/es/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +17 -4
- package/es/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +3 -3
- package/es/ColorSelect/_shared/ColorIndicator/props/propTypes.js +1 -1
- package/es/ColorSelect/_shared/ColoredTag/props/propTypes.js +1 -0
- package/es/ColorSelect/_shared/helpers/renderHelpers.js +14 -10
- package/es/ColorSelect/props/propTypes.js +1 -0
- package/es/Label/Label.js +19 -1
- package/es/Label/__tests__/Label.spec.js +58 -0
- package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/es/Label/props/defaultProps.js +1 -0
- package/es/Label/props/propTypes.js +7 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -6
- package/es/MultiSelect/MultiSelect.js +2 -2
- package/es/MultiSelect/Suggestions.js +2 -7
- package/es/MultiSelect/props/defaultProps.js +0 -2
- package/es/MultiSelect/props/propTypes.js +3 -11
- package/es/Radio/Radio.js +20 -9
- package/es/Radio/Radio.module.css +38 -5
- package/es/Radio/__tests__/Radio.spec.js +10 -0
- package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +238 -81
- package/es/Radio/props/propTypes.js +4 -1
- package/es/Select/GroupSelect.js +1 -1
- package/es/Select/SelectWithAvatar.js +3 -3
- package/es/Select/SelectWithIcon.js +3 -10
- package/es/Select/props/defaultProps.js +2 -4
- package/es/Select/props/propTypes.js +3 -11
- package/es/Typography/Typography.js +9 -2
- package/es/Typography/__tests__/Typography.spec.js +427 -0
- package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +506 -0
- package/es/Typography/props/defaultProps.js +2 -1
- package/es/Typography/props/propTypes.js +24 -5
- package/es/Typography/utils/textHighlighter.js +139 -0
- package/es/common/common.module.css +1 -1
- package/es/shared/ArrowIcon/ArrowIcon.js +6 -3
- package/es/shared/ArrowIcon/ArrowIcon.module.css +9 -0
- package/es/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +24 -0
- package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +70 -7
- package/es/shared/ArrowIcon/props/defaultProps.js +2 -0
- package/es/shared/ArrowIcon/props/propTypes.js +3 -1
- package/es/utils/dropDownUtils.js +3 -3
- package/lib/CheckBox/CheckBox.js +23 -9
- package/lib/CheckBox/CheckBox.module.css +21 -6
- package/lib/CheckBox/__tests__/CheckBox.spec.js +21 -12
- package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
- package/lib/CheckBox/props/propTypes.js +5 -1
- package/lib/ColorSelect/ColorSingleSelect.js +1 -2
- package/lib/ColorSelect/__tests__/ColorMultiSelect.spec.js +15 -3
- package/lib/ColorSelect/__tests__/ColorSingleSelect.spec.js +15 -3
- package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +2 -2
- package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +8 -8
- package/lib/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +10 -4
- package/lib/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +17 -4
- package/lib/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +3 -3
- package/lib/ColorSelect/_shared/ColorIndicator/props/propTypes.js +1 -1
- package/lib/ColorSelect/_shared/ColoredTag/props/propTypes.js +1 -0
- package/lib/ColorSelect/_shared/helpers/renderHelpers.js +19 -13
- package/lib/ColorSelect/props/propTypes.js +1 -0
- package/lib/Label/Label.js +21 -1
- package/lib/Label/__tests__/Label.spec.js +58 -0
- package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
- package/lib/Label/props/defaultProps.js +1 -0
- package/lib/Label/props/propTypes.js +8 -1
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -8
- package/lib/MultiSelect/MultiSelect.js +2 -2
- package/lib/MultiSelect/Suggestions.js +2 -6
- package/lib/MultiSelect/props/defaultProps.js +0 -2
- package/lib/MultiSelect/props/propTypes.js +5 -13
- package/lib/Radio/Radio.js +22 -8
- package/lib/Radio/Radio.module.css +38 -5
- package/lib/Radio/__tests__/Radio.spec.js +10 -0
- package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +238 -81
- package/lib/Radio/props/propTypes.js +5 -1
- package/lib/Select/GroupSelect.js +1 -2
- package/lib/Select/SelectWithAvatar.js +3 -4
- package/lib/Select/SelectWithIcon.js +3 -10
- package/lib/Select/props/defaultProps.js +3 -5
- package/lib/Select/props/propTypes.js +3 -11
- package/lib/Typography/Typography.js +9 -2
- package/lib/Typography/__tests__/Typography.spec.js +436 -0
- package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +506 -0
- package/lib/Typography/props/defaultProps.js +2 -1
- package/lib/Typography/props/propTypes.js +31 -6
- package/lib/Typography/utils/textHighlighter.js +160 -0
- package/lib/common/common.module.css +1 -1
- package/lib/shared/ArrowIcon/ArrowIcon.js +6 -3
- package/lib/shared/ArrowIcon/ArrowIcon.module.css +9 -0
- package/lib/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +34 -10
- package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +70 -7
- package/lib/shared/ArrowIcon/props/defaultProps.js +2 -0
- package/lib/shared/ArrowIcon/props/propTypes.js +3 -1
- package/lib/utils/dropDownUtils.js +3 -3
- package/package.json +2 -2
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { propTypes as TypographyPropTypes } from "../../Typography/props/propTypes";
|
|
2
3
|
export const propTypes = {
|
|
3
4
|
active: PropTypes.bool,
|
|
4
5
|
activeStyle: PropTypes.oneOf(['tick', 'minus']),
|
|
5
6
|
checked: PropTypes.bool,
|
|
6
7
|
dataId: PropTypes.string,
|
|
7
8
|
dataSelectorId: PropTypes.string,
|
|
9
|
+
secondaryText: PropTypes.string,
|
|
8
10
|
disabled: PropTypes.bool,
|
|
9
11
|
disabledTitle: PropTypes.string,
|
|
10
12
|
getRef: PropTypes.func,
|
|
@@ -36,7 +38,8 @@ export const propTypes = {
|
|
|
36
38
|
}),
|
|
37
39
|
customProps: PropTypes.shape({
|
|
38
40
|
CheckBoxProps: PropTypes.object,
|
|
39
|
-
LabelProps: PropTypes.object
|
|
41
|
+
LabelProps: PropTypes.object,
|
|
42
|
+
secondaryTextProps: PropTypes.exact(TypographyPropTypes)
|
|
40
43
|
}),
|
|
41
44
|
renderRightPlaceholderNode: PropTypes.node
|
|
42
45
|
};
|
|
@@ -4,15 +4,27 @@ import ColorMultiSelect from "../ColorMultiSelect";
|
|
|
4
4
|
const options = [{
|
|
5
5
|
id: 1,
|
|
6
6
|
text: 'Red',
|
|
7
|
-
|
|
7
|
+
colorConfig: {
|
|
8
|
+
text: 'black',
|
|
9
|
+
background: '#ff6e6e',
|
|
10
|
+
border: 'black'
|
|
11
|
+
}
|
|
8
12
|
}, {
|
|
9
13
|
id: 2,
|
|
10
14
|
text: 'Green',
|
|
11
|
-
|
|
15
|
+
colorConfig: {
|
|
16
|
+
text: 'black',
|
|
17
|
+
background: '#77d779',
|
|
18
|
+
border: 'black'
|
|
19
|
+
}
|
|
12
20
|
}, {
|
|
13
21
|
id: 3,
|
|
14
22
|
text: 'Blue',
|
|
15
|
-
|
|
23
|
+
colorConfig: {
|
|
24
|
+
text: 'black',
|
|
25
|
+
background: '#649cff',
|
|
26
|
+
border: 'black'
|
|
27
|
+
}
|
|
16
28
|
}];
|
|
17
29
|
describe('ColorMultiSelect', () => {
|
|
18
30
|
test('rendering the defult props', () => {
|
|
@@ -4,15 +4,27 @@ import ColorSingleSelect from "../ColorSingleSelect";
|
|
|
4
4
|
const options = [{
|
|
5
5
|
id: 1,
|
|
6
6
|
text: 'Red',
|
|
7
|
-
|
|
7
|
+
colorConfig: {
|
|
8
|
+
text: 'black',
|
|
9
|
+
background: '#ff6e6e',
|
|
10
|
+
border: 'black'
|
|
11
|
+
}
|
|
8
12
|
}, {
|
|
9
13
|
id: 2,
|
|
10
14
|
text: 'Green',
|
|
11
|
-
|
|
15
|
+
colorConfig: {
|
|
16
|
+
text: 'black',
|
|
17
|
+
background: '#77d779',
|
|
18
|
+
border: 'black'
|
|
19
|
+
}
|
|
12
20
|
}, {
|
|
13
21
|
id: 3,
|
|
14
22
|
text: 'Blue',
|
|
15
|
-
|
|
23
|
+
colorConfig: {
|
|
24
|
+
text: 'black',
|
|
25
|
+
background: '#649cff',
|
|
26
|
+
border: 'black'
|
|
27
|
+
}
|
|
16
28
|
}];
|
|
17
29
|
describe('ColorSingleSelect', () => {
|
|
18
30
|
test('rendering the defult props', () => {
|
|
@@ -110,7 +110,7 @@ exports[`ColorMultiSelect Should render the selected value 1`] = `
|
|
|
110
110
|
data-selector-id="tag"
|
|
111
111
|
data-test-id="tag_Tag"
|
|
112
112
|
data-title="Red"
|
|
113
|
-
style="--tag_bg_color:
|
|
113
|
+
style="--tag_bg_color: #ff6e6e; --tag_text_color: black; --tag_border_color: black;"
|
|
114
114
|
tabindex="0"
|
|
115
115
|
>
|
|
116
116
|
<div
|
|
@@ -161,7 +161,7 @@ exports[`ColorMultiSelect Should render the selected value 1`] = `
|
|
|
161
161
|
data-selector-id="tag"
|
|
162
162
|
data-test-id="tag_Tag"
|
|
163
163
|
data-title="Green"
|
|
164
|
-
style="--tag_bg_color:
|
|
164
|
+
style="--tag_bg_color: #77d779; --tag_text_color: black; --tag_border_color: black;"
|
|
165
165
|
tabindex="0"
|
|
166
166
|
>
|
|
167
167
|
<div
|
|
@@ -43,7 +43,7 @@ exports[`ColorSingleSelect Should render the default selected value 1`] = `
|
|
|
43
43
|
data-selector-id="tag"
|
|
44
44
|
data-test-id="tag_Tag"
|
|
45
45
|
data-title="Red"
|
|
46
|
-
style="--tag_bg_color:
|
|
46
|
+
style="--tag_bg_color: #ff6e6e; --tag_text_color: black; --tag_border_color: black;"
|
|
47
47
|
tabindex="0"
|
|
48
48
|
>
|
|
49
49
|
<div
|
|
@@ -57,7 +57,7 @@ exports[`ColorSingleSelect Should render the default selected value 1`] = `
|
|
|
57
57
|
</div>
|
|
58
58
|
<div
|
|
59
59
|
aria-hidden="true"
|
|
60
|
-
class="arrowIcon
|
|
60
|
+
class="arrowIcon inflex coldir both"
|
|
61
61
|
data-id="undefined_downIcon"
|
|
62
62
|
data-selector-id="container"
|
|
63
63
|
data-test-id="undefined_downIcon"
|
|
@@ -131,7 +131,7 @@ exports[`ColorSingleSelect Should render the selected value 1`] = `
|
|
|
131
131
|
</div>
|
|
132
132
|
<div
|
|
133
133
|
aria-hidden="true"
|
|
134
|
-
class="arrowIcon
|
|
134
|
+
class="arrowIcon inflex coldir both"
|
|
135
135
|
data-id="undefined_downIcon"
|
|
136
136
|
data-selector-id="container"
|
|
137
137
|
data-test-id="undefined_downIcon"
|
|
@@ -194,7 +194,7 @@ exports[`ColorSingleSelect rendering the defult props 1`] = `
|
|
|
194
194
|
</div>
|
|
195
195
|
<div
|
|
196
196
|
aria-hidden="true"
|
|
197
|
-
class="arrowIcon
|
|
197
|
+
class="arrowIcon inflex coldir both"
|
|
198
198
|
data-id="undefined_downIcon"
|
|
199
199
|
data-selector-id="container"
|
|
200
200
|
data-test-id="undefined_downIcon"
|
|
@@ -259,7 +259,7 @@ exports[`ColorSingleSelect rendering with isDefaultSelectValue is false 1`] = `
|
|
|
259
259
|
</div>
|
|
260
260
|
<div
|
|
261
261
|
aria-hidden="true"
|
|
262
|
-
class="arrowIcon
|
|
262
|
+
class="arrowIcon inflex coldir both"
|
|
263
263
|
data-id="undefined_downIcon"
|
|
264
264
|
data-selector-id="container"
|
|
265
265
|
data-test-id="undefined_downIcon"
|
|
@@ -323,7 +323,7 @@ exports[`ColorSingleSelect renders with renderCustomColorIndicator 1`] = `
|
|
|
323
323
|
data-selector-id="tag"
|
|
324
324
|
data-test-id="tag_Tag"
|
|
325
325
|
data-title="Red"
|
|
326
|
-
style="--tag_bg_color:
|
|
326
|
+
style="--tag_bg_color: #ff6e6e; --tag_text_color: black; --tag_border_color: black;"
|
|
327
327
|
tabindex="0"
|
|
328
328
|
>
|
|
329
329
|
<div
|
|
@@ -337,7 +337,7 @@ exports[`ColorSingleSelect renders with renderCustomColorIndicator 1`] = `
|
|
|
337
337
|
</div>
|
|
338
338
|
<div
|
|
339
339
|
aria-hidden="true"
|
|
340
|
-
class="arrowIcon
|
|
340
|
+
class="arrowIcon inflex coldir both"
|
|
341
341
|
data-id="undefined_downIcon"
|
|
342
342
|
data-selector-id="container"
|
|
343
343
|
data-test-id="undefined_downIcon"
|
|
@@ -400,7 +400,7 @@ exports[`ColorSingleSelect renders with renderCustomSelectedValue 1`] = `
|
|
|
400
400
|
</div>
|
|
401
401
|
<div
|
|
402
402
|
aria-hidden="true"
|
|
403
|
-
class="arrowIcon
|
|
403
|
+
class="arrowIcon inflex coldir both"
|
|
404
404
|
data-id="undefined_downIcon"
|
|
405
405
|
data-selector-id="container"
|
|
406
406
|
data-test-id="undefined_downIcon"
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import style from "./ColorIndicator.module.css";
|
|
3
2
|
import { defaultProps } from "./props/defaultProps";
|
|
4
3
|
import { propTypes } from "./props/propTypes";
|
|
4
|
+
import { DUMMY_OBJECT } from "../../../utils/Common";
|
|
5
|
+
import style from "./ColorIndicator.module.css";
|
|
5
6
|
|
|
6
7
|
function ColorIndicator(props) {
|
|
7
8
|
const {
|
|
8
|
-
|
|
9
|
+
colorConfig,
|
|
9
10
|
shape,
|
|
10
11
|
customClass,
|
|
11
12
|
customId,
|
|
@@ -13,11 +14,14 @@ function ColorIndicator(props) {
|
|
|
13
14
|
tagAttributes,
|
|
14
15
|
a11yAttributes
|
|
15
16
|
} = props;
|
|
17
|
+
const {
|
|
18
|
+
background
|
|
19
|
+
} = colorConfig || DUMMY_OBJECT;
|
|
16
20
|
return /*#__PURE__*/React.createElement("div", { ...tagAttributes,
|
|
17
21
|
...a11yAttributes,
|
|
18
22
|
className: `${style.varClass} ${style.indicator} ${style[shape]} ${customClass}`,
|
|
19
23
|
style: {
|
|
20
|
-
backgroundColor:
|
|
24
|
+
backgroundColor: background
|
|
21
25
|
},
|
|
22
26
|
"data-id": customId,
|
|
23
27
|
"data-test-id": testId
|
|
@@ -16,13 +16,26 @@ describe('ColorIndicator', () => {
|
|
|
16
16
|
testId: "test-id"
|
|
17
17
|
}));
|
|
18
18
|
expect(asFragment()).toMatchSnapshot();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
}); // const colors = ['#ff0000', '#00ff00', '#0000ff'];
|
|
20
|
+
|
|
21
|
+
const colorConfigurations = [{
|
|
22
|
+
background: '#ff0000',
|
|
23
|
+
text: '#000000',
|
|
24
|
+
border: '#ffffff'
|
|
25
|
+
}, {
|
|
26
|
+
background: '#00ff00',
|
|
27
|
+
text: '#000000',
|
|
28
|
+
border: '#ffffff'
|
|
29
|
+
}, {
|
|
30
|
+
background: '#0000ff',
|
|
31
|
+
text: '#ffffff',
|
|
32
|
+
border: '#000000'
|
|
33
|
+
}];
|
|
34
|
+
test.each(colorConfigurations)('rendering the color of- %s', color => {
|
|
22
35
|
const {
|
|
23
36
|
asFragment
|
|
24
37
|
} = render( /*#__PURE__*/React.createElement(ColorIndicator, {
|
|
25
|
-
|
|
38
|
+
colorConfig: color
|
|
26
39
|
}));
|
|
27
40
|
expect(asFragment()).toMatchSnapshot();
|
|
28
41
|
});
|
package/es/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`ColorIndicator rendering the color of- #0000ff 1`] = `
|
|
3
|
+
exports[`ColorIndicator rendering the color of- { background: '#0000ff', text: '#ffffff', border: '#000000' } 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="varClass indicator circle "
|
|
@@ -11,7 +11,7 @@ exports[`ColorIndicator rendering the color of- #0000ff 1`] = `
|
|
|
11
11
|
</DocumentFragment>
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
|
-
exports[`ColorIndicator rendering the color of- #00ff00 1`] = `
|
|
14
|
+
exports[`ColorIndicator rendering the color of- { background: '#00ff00', text: '#000000', border: '#ffffff' } 1`] = `
|
|
15
15
|
<DocumentFragment>
|
|
16
16
|
<div
|
|
17
17
|
class="varClass indicator circle "
|
|
@@ -22,7 +22,7 @@ exports[`ColorIndicator rendering the color of- #00ff00 1`] = `
|
|
|
22
22
|
</DocumentFragment>
|
|
23
23
|
`;
|
|
24
24
|
|
|
25
|
-
exports[`ColorIndicator rendering the color of- #ff0000 1`] = `
|
|
25
|
+
exports[`ColorIndicator rendering the color of- { background: '#ff0000', text: '#000000', border: '#ffffff' } 1`] = `
|
|
26
26
|
<DocumentFragment>
|
|
27
27
|
<div
|
|
28
28
|
class="varClass indicator circle "
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { propTypes as tagPropTypes } from "../../../../Tag/props/propTypes";
|
|
3
3
|
export const propTypes = { ...tagPropTypes,
|
|
4
|
+
isActive: PropTypes.bool,
|
|
4
5
|
colorConfig: PropTypes.shape({
|
|
5
6
|
textColor: PropTypes.string,
|
|
6
7
|
backgroundColor: PropTypes.string,
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Color from 'color';
|
|
3
2
|
import ColoredTag from "../ColoredTag/ColoredTag";
|
|
4
3
|
import ColorIndicator from "../ColorIndicator/ColorIndicator";
|
|
4
|
+
import { DUMMY_OBJECT } from "../../../utils/Common";
|
|
5
5
|
export function renderColoredTag(data) {
|
|
6
6
|
const {
|
|
7
7
|
option,
|
|
8
8
|
...otherData
|
|
9
|
-
} = data;
|
|
9
|
+
} = data || DUMMY_OBJECT;
|
|
10
10
|
const {
|
|
11
|
-
|
|
11
|
+
colorConfig,
|
|
12
12
|
value,
|
|
13
13
|
id
|
|
14
|
-
} = option;
|
|
15
|
-
const
|
|
14
|
+
} = option || DUMMY_OBJECT;
|
|
15
|
+
const {
|
|
16
|
+
text,
|
|
17
|
+
background,
|
|
18
|
+
border
|
|
19
|
+
} = colorConfig || DUMMY_OBJECT;
|
|
16
20
|
|
|
17
21
|
function getColorConfig() {
|
|
18
22
|
return {
|
|
19
|
-
backgroundColor:
|
|
20
|
-
textColor:
|
|
21
|
-
borderColor:
|
|
23
|
+
backgroundColor: background,
|
|
24
|
+
textColor: text,
|
|
25
|
+
borderColor: border
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
|
|
@@ -31,9 +35,9 @@ export function renderColoredTag(data) {
|
|
|
31
35
|
}
|
|
32
36
|
export function renderColorIndicator(data) {
|
|
33
37
|
const {
|
|
34
|
-
|
|
38
|
+
colorConfig
|
|
35
39
|
} = data;
|
|
36
40
|
return /*#__PURE__*/React.createElement(ColorIndicator, {
|
|
37
|
-
|
|
41
|
+
colorConfig: colorConfig
|
|
38
42
|
});
|
|
39
43
|
}
|
package/es/Label/Label.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { defaultProps } from "./props/defaultProps";
|
|
6
6
|
import { propTypes } from "./props/propTypes";
|
|
7
|
+
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
8
|
+
import { renderNode, isRenderable } from '@zohodesk/utils';
|
|
7
9
|
import style from "./Label.module.css";
|
|
8
10
|
import colors from "./LabelColors.module.css";
|
|
9
11
|
export default class Label extends React.Component {
|
|
@@ -20,14 +22,20 @@ export default class Label extends React.Component {
|
|
|
20
22
|
dataId,
|
|
21
23
|
dataSelectorId,
|
|
22
24
|
variant,
|
|
25
|
+
customProps,
|
|
23
26
|
customClass,
|
|
24
27
|
id,
|
|
28
|
+
renderRightPlaceholderNode,
|
|
25
29
|
a11y = {}
|
|
26
30
|
} = this.props;
|
|
31
|
+
const {
|
|
32
|
+
containerProps,
|
|
33
|
+
rightPlaceholderNodeProps
|
|
34
|
+
} = customProps;
|
|
27
35
|
const {
|
|
28
36
|
tabIndex
|
|
29
37
|
} = a11y;
|
|
30
|
-
|
|
38
|
+
const labelElement = /*#__PURE__*/React.createElement("label", {
|
|
31
39
|
className: `${style.label} ${style[type]} ${style[size]} ${colors[palette]} ${style[`font_${variant}`]}
|
|
32
40
|
${clipped ? style.dotted : ''} ${onClick ? style.pointer : style.cursor} ${customClass} `,
|
|
33
41
|
htmlFor: htmlFor,
|
|
@@ -39,6 +47,16 @@ export default class Label extends React.Component {
|
|
|
39
47
|
id: id,
|
|
40
48
|
tabIndex: tabIndex
|
|
41
49
|
}, text);
|
|
50
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, isRenderable(renderRightPlaceholderNode) ? /*#__PURE__*/React.createElement(Flex, {
|
|
51
|
+
$ui_displayMode: "flex",
|
|
52
|
+
$ui_direction: "row",
|
|
53
|
+
$ui_alignItems: "center",
|
|
54
|
+
...containerProps
|
|
55
|
+
}, labelElement, /*#__PURE__*/React.createElement(Flex, {
|
|
56
|
+
$ui_displayMode: "flex",
|
|
57
|
+
$ui_alignItems: "center",
|
|
58
|
+
...rightPlaceholderNodeProps
|
|
59
|
+
}, renderNode(renderRightPlaceholderNode))) : /*#__PURE__*/React.createElement(React.Fragment, null, labelElement));
|
|
42
60
|
}
|
|
43
61
|
|
|
44
62
|
}
|
|
@@ -96,4 +96,62 @@ describe('Label', () => {
|
|
|
96
96
|
}));
|
|
97
97
|
expect(asFragment()).toMatchSnapshot();
|
|
98
98
|
});
|
|
99
|
+
test('rendering with renderRightPlaceholderNode', () => {
|
|
100
|
+
const {
|
|
101
|
+
asFragment
|
|
102
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
103
|
+
text: "New Feature",
|
|
104
|
+
id: "label_new",
|
|
105
|
+
renderRightPlaceholderNode: /*#__PURE__*/React.createElement("span", {
|
|
106
|
+
style: {
|
|
107
|
+
background: '#27ae60',
|
|
108
|
+
color: 'white',
|
|
109
|
+
padding: '2px 6px',
|
|
110
|
+
borderRadius: '3px',
|
|
111
|
+
fontSize: '10px',
|
|
112
|
+
fontWeight: 'bold'
|
|
113
|
+
}
|
|
114
|
+
}, "NEW")
|
|
115
|
+
}));
|
|
116
|
+
expect(asFragment()).toMatchSnapshot();
|
|
117
|
+
});
|
|
118
|
+
test('rendering with customProps - containerProps & rightPlaceholderNodeProps', () => {
|
|
119
|
+
const {
|
|
120
|
+
asFragment
|
|
121
|
+
} = render( /*#__PURE__*/React.createElement(Label, {
|
|
122
|
+
text: "Premium Feature",
|
|
123
|
+
id: "label_premium",
|
|
124
|
+
size: "large",
|
|
125
|
+
palette: "danger",
|
|
126
|
+
renderRightPlaceholderNode: /*#__PURE__*/React.createElement("span", {
|
|
127
|
+
style: {
|
|
128
|
+
fontSize: '10px',
|
|
129
|
+
background: '#f39c12',
|
|
130
|
+
color: 'white',
|
|
131
|
+
padding: '1px 4px',
|
|
132
|
+
borderRadius: '2px'
|
|
133
|
+
}
|
|
134
|
+
}, "PRO"),
|
|
135
|
+
customProps: {
|
|
136
|
+
containerProps: {
|
|
137
|
+
$ui_alignItems: 'center',
|
|
138
|
+
$tagAttributes_container: {
|
|
139
|
+
style: {
|
|
140
|
+
gap: '6px'
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
rightPlaceholderNodeProps: {
|
|
145
|
+
$ui_displayMode: 'flex',
|
|
146
|
+
$ui_alignItems: 'center',
|
|
147
|
+
$tagAttributes_container: {
|
|
148
|
+
style: {
|
|
149
|
+
gap: '6px'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
expect(asFragment()).toMatchSnapshot();
|
|
156
|
+
});
|
|
99
157
|
});
|
|
@@ -310,3 +310,69 @@ exports[`Label rendering the variant of- primary 1`] = `
|
|
|
310
310
|
</label>
|
|
311
311
|
</DocumentFragment>
|
|
312
312
|
`;
|
|
313
|
+
|
|
314
|
+
exports[`Label rendering with customProps - containerProps & rightPlaceholderNodeProps 1`] = `
|
|
315
|
+
<DocumentFragment>
|
|
316
|
+
<div
|
|
317
|
+
class="flex row alignItems_center"
|
|
318
|
+
data-id="flex"
|
|
319
|
+
data-test-id="flex"
|
|
320
|
+
style="gap: 6px;"
|
|
321
|
+
>
|
|
322
|
+
<label
|
|
323
|
+
class="label title large danger font_default
|
|
324
|
+
cursor "
|
|
325
|
+
data-id="label"
|
|
326
|
+
data-selector-id="label"
|
|
327
|
+
data-test-id="label"
|
|
328
|
+
id="label_premium"
|
|
329
|
+
>
|
|
330
|
+
Premium Feature
|
|
331
|
+
</label>
|
|
332
|
+
<div
|
|
333
|
+
class="flex row alignItems_center"
|
|
334
|
+
data-id="flex"
|
|
335
|
+
data-test-id="flex"
|
|
336
|
+
style="gap: 6px;"
|
|
337
|
+
>
|
|
338
|
+
<span
|
|
339
|
+
style="font-size: 10px; background: rgb(243, 156, 18); color: white; padding: 1px 4px; border-radius: 2px;"
|
|
340
|
+
>
|
|
341
|
+
PRO
|
|
342
|
+
</span>
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
</DocumentFragment>
|
|
346
|
+
`;
|
|
347
|
+
|
|
348
|
+
exports[`Label rendering with renderRightPlaceholderNode 1`] = `
|
|
349
|
+
<DocumentFragment>
|
|
350
|
+
<div
|
|
351
|
+
class="flex row"
|
|
352
|
+
data-id="flex"
|
|
353
|
+
data-test-id="flex"
|
|
354
|
+
>
|
|
355
|
+
<label
|
|
356
|
+
class="label title medium default font_default
|
|
357
|
+
cursor "
|
|
358
|
+
data-id="label"
|
|
359
|
+
data-selector-id="label"
|
|
360
|
+
data-test-id="label"
|
|
361
|
+
id="label_new"
|
|
362
|
+
>
|
|
363
|
+
New Feature
|
|
364
|
+
</label>
|
|
365
|
+
<div
|
|
366
|
+
class=""
|
|
367
|
+
data-id="flex"
|
|
368
|
+
data-test-id="flex"
|
|
369
|
+
>
|
|
370
|
+
<span
|
|
371
|
+
style="background: rgb(39, 174, 96); color: white; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: bold;"
|
|
372
|
+
>
|
|
373
|
+
NEW
|
|
374
|
+
</span>
|
|
375
|
+
</div>
|
|
376
|
+
</div>
|
|
377
|
+
</DocumentFragment>
|
|
378
|
+
`;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import FlexPropTypes from '@zohodesk/layout/es/Flex/props/propTypes';
|
|
2
3
|
export const propTypes = {
|
|
3
4
|
clipped: PropTypes.bool,
|
|
4
5
|
dataId: PropTypes.string,
|
|
@@ -11,9 +12,14 @@ export const propTypes = {
|
|
|
11
12
|
title: PropTypes.string,
|
|
12
13
|
type: PropTypes.oneOf(['title', 'subtitle']),
|
|
13
14
|
variant: PropTypes.oneOf(['primary', 'default']),
|
|
15
|
+
customProps: PropTypes.shape({
|
|
16
|
+
containerProps: PropTypes.exact(FlexPropTypes),
|
|
17
|
+
rightPlaceholderNodeProps: PropTypes.exact(FlexPropTypes)
|
|
18
|
+
}),
|
|
14
19
|
customClass: PropTypes.string,
|
|
15
20
|
a11y: PropTypes.shape({
|
|
16
21
|
tabIndex: PropTypes.string
|
|
17
22
|
}),
|
|
18
|
-
id: PropTypes.string
|
|
23
|
+
id: PropTypes.string,
|
|
24
|
+
renderRightPlaceholderNode: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
19
25
|
};
|
|
@@ -889,12 +889,8 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
889
889
|
autoComplete,
|
|
890
890
|
getTargetRef,
|
|
891
891
|
isFocus,
|
|
892
|
-
limit
|
|
893
|
-
customProps
|
|
892
|
+
limit
|
|
894
893
|
} = this.props;
|
|
895
|
-
const {
|
|
896
|
-
SuggestionsProps = {}
|
|
897
|
-
} = customProps;
|
|
898
894
|
let {
|
|
899
895
|
clearText = MULTISELECT_I18N_KEYS.clearText,
|
|
900
896
|
limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
|
|
@@ -1063,7 +1059,7 @@ class AdvancedGroupMultiSelect extends React.Component {
|
|
|
1063
1059
|
a11y: {
|
|
1064
1060
|
role: 'heading'
|
|
1065
1061
|
}
|
|
1066
|
-
})), /*#__PURE__*/React.createElement(Suggestions, {
|
|
1062
|
+
})), /*#__PURE__*/React.createElement(Suggestions, {
|
|
1067
1063
|
suggestions: suggestions,
|
|
1068
1064
|
selectedOptions: selectedOptionIds,
|
|
1069
1065
|
getRef: this.suggestionItemRef,
|
|
@@ -1095,9 +1095,9 @@ export class MultiSelectComponent extends React.Component {
|
|
|
1095
1095
|
isLoading,
|
|
1096
1096
|
selectAllText,
|
|
1097
1097
|
needSelectAll,
|
|
1098
|
+
customProps,
|
|
1098
1099
|
isVirtualizerEnabled,
|
|
1099
|
-
limit
|
|
1100
|
-
customProps
|
|
1100
|
+
limit
|
|
1101
1101
|
} = this.props;
|
|
1102
1102
|
const {
|
|
1103
1103
|
selectedOptions,
|
|
@@ -193,23 +193,18 @@ export default class Suggestions extends React.PureComponent {
|
|
|
193
193
|
htmlId,
|
|
194
194
|
a11y,
|
|
195
195
|
getVirtualizerPublicMethods,
|
|
196
|
-
setVirtualizerContainerRefFunction
|
|
197
|
-
customClass
|
|
196
|
+
setVirtualizerContainerRefFunction
|
|
198
197
|
} = this.props;
|
|
199
198
|
const {
|
|
200
199
|
ariaParentRole,
|
|
201
200
|
ariaMultiselectable
|
|
202
201
|
} = a11y;
|
|
203
|
-
const {
|
|
204
|
-
containerClass = ''
|
|
205
|
-
} = customClass;
|
|
206
202
|
return /*#__PURE__*/React.createElement(Container, {
|
|
207
203
|
isCover: false,
|
|
208
204
|
role: ariaParentRole,
|
|
209
205
|
id: htmlId,
|
|
210
206
|
tabindex: "0",
|
|
211
|
-
"aria-multiselectable": ariaMultiselectable
|
|
212
|
-
className: containerClass
|
|
207
|
+
"aria-multiselectable": ariaMultiselectable
|
|
213
208
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
214
209
|
dataId: `${dataId}`,
|
|
215
210
|
className: className ? className : ''
|
|
@@ -38,7 +38,6 @@ export const AdvancedGroupMultiSelect_defaultProps = {
|
|
|
38
38
|
palette: 'default',
|
|
39
39
|
isLoading: false,
|
|
40
40
|
dataSelectorId: 'advancedGroupMultiSelect',
|
|
41
|
-
customProps: {},
|
|
42
41
|
allowValueFallback: true
|
|
43
42
|
};
|
|
44
43
|
export const AdvancedMultiSelect_defaultProps = {
|
|
@@ -170,6 +169,5 @@ export const SelectedOptions_defaultProps = {
|
|
|
170
169
|
export const Suggestions_defaultProps = {
|
|
171
170
|
a11y: {},
|
|
172
171
|
isVirtualizerEnabled: false,
|
|
173
|
-
customClass: {},
|
|
174
172
|
needMultiLineText: false
|
|
175
173
|
};
|