@zohodesk/components 1.0.0-temp-199.18 → 1.0.0-temp-242.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/README.md +31 -1
- package/es/AppContainer/AppContainer.js +1 -0
- package/es/AppContainer/AppContainer.module.css +3 -2
- package/es/Button/css/Button.module.css +13 -4
- 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/DateTime/DateTime.module.css +12 -9
- package/es/DateTime/YearView.module.css +1 -1
- package/es/DropBox/DropBoxElement/DropBoxElement.js +1 -1
- package/es/DropBox/utils/isMobilePopover.js +3 -14
- package/es/Heading/Heading.module.css +1 -1
- package/es/Label/Label.module.css +8 -8
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -6
- package/es/MultiSelect/MultiSelect.js +2 -2
- package/es/MultiSelect/MultiSelect.module.css +1 -1
- 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/Popup/Popup.js +21 -1045
- 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/Tab/Tabs.module.css +1 -1
- package/es/TextBox/TextBox.module.css +4 -4
- package/es/TextBoxIcon/TextBoxIcon.module.css +0 -6
- package/es/Textarea/Textarea.module.css +1 -1
- package/es/Tooltip/Tooltip.module.css +1 -1
- 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/css/Typography.module.css +4 -4
- 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/basic.module.css +39 -6
- package/es/common/basicReset.module.css +2 -2
- package/es/common/common.module.css +6 -6
- 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/shared/InputFieldLine/InputFieldLine.module.css +1 -1
- package/es/utils/Common.js +1 -1
- package/es/utils/dropDownUtils.js +3 -3
- package/es/v1/Popup/Popup.js +1 -1
- package/es/v1/Tab/v1Tabs.module.css +1 -1
- package/es/v1/Typography/css/v1_Typography.module.css +4 -4
- package/lib/AppContainer/AppContainer.js +2 -0
- package/lib/AppContainer/AppContainer.module.css +3 -2
- package/lib/Button/css/Button.module.css +13 -4
- 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/DateTime/DateTime.module.css +12 -9
- package/lib/DateTime/YearView.module.css +1 -1
- package/lib/DropBox/DropBoxElement/DropBoxElement.js +5 -5
- package/lib/DropBox/utils/isMobilePopover.js +4 -14
- package/lib/Heading/Heading.module.css +1 -1
- package/lib/Label/Label.module.css +8 -8
- package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -8
- package/lib/MultiSelect/MultiSelect.js +2 -2
- package/lib/MultiSelect/MultiSelect.module.css +1 -1
- 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/Popup/Popup.js +25 -1152
- 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/Tab/Tabs.module.css +1 -1
- package/lib/TextBox/TextBox.module.css +4 -4
- package/lib/TextBoxIcon/TextBoxIcon.module.css +0 -6
- package/lib/Textarea/Textarea.module.css +1 -1
- package/lib/Tooltip/Tooltip.module.css +1 -1
- 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/css/Typography.module.css +4 -4
- 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/basic.module.css +39 -6
- package/lib/common/basicReset.module.css +2 -2
- package/lib/common/common.module.css +6 -6
- 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/shared/InputFieldLine/InputFieldLine.module.css +1 -1
- package/lib/utils/Common.js +1 -1
- package/lib/utils/dropDownUtils.js +3 -3
- package/lib/v1/Popup/Popup.js +1 -1
- package/lib/v1/Tab/v1Tabs.module.css +1 -1
- package/lib/v1/Typography/css/v1_Typography.module.css +4 -4
- package/package.json +6 -6
- package/es/DropBox/DropBoxPositionMapping.js +0 -142
- package/es/Popup/PositionMapping.js +0 -72
- package/es/Popup/Registry.js +0 -36
- package/es/Popup/intersectionObserver.js +0 -49
- package/es/Popup/viewPort.js +0 -373
- package/lib/DropBox/DropBoxPositionMapping.js +0 -149
- package/lib/Popup/PositionMapping.js +0 -81
- package/lib/Popup/Registry.js +0 -46
- package/lib/Popup/intersectionObserver.js +0 -72
- package/lib/Popup/viewPort.js +0 -367
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cssJSLogic from "../css/cssJSLogic";
|
|
3
|
+
import { renderNode, isRenderable } from '@zohodesk/utils';
|
|
4
|
+
import typographyStyle from "./../css/Typography.module.css";
|
|
5
|
+
import { DUMMY_ARRAY, DUMMY_OBJECT } from "../../utils/Common";
|
|
6
|
+
export function highlightText(config) {
|
|
7
|
+
const {
|
|
8
|
+
text: sourceText,
|
|
9
|
+
data: highlightData,
|
|
10
|
+
styleConfiguration: highlightStyleConfig = DUMMY_OBJECT,
|
|
11
|
+
shouldExcludeIndices = false,
|
|
12
|
+
isCaseSensitive: enableCaseSensitiveMatch = false,
|
|
13
|
+
isWholeWord: matchWholeWordOnly = false,
|
|
14
|
+
tagName: wrapperTagName = 'span',
|
|
15
|
+
renderHighlight: customRenderer
|
|
16
|
+
} = config;
|
|
17
|
+
|
|
18
|
+
if (!sourceText || !highlightData?.length) {
|
|
19
|
+
return sourceText;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const cssClassCache = new Map();
|
|
23
|
+
const normalizedHighlightTerms = highlightData.map(highlightItem => {
|
|
24
|
+
const searchTerm = typeof highlightItem === 'string' ? highlightItem : highlightItem?.text;
|
|
25
|
+
if (!searchTerm) return null;
|
|
26
|
+
const itemConfiguration = typeof highlightItem === 'string' ? DUMMY_OBJECT : highlightItem;
|
|
27
|
+
const hasStyleConfigrationFromItem = itemConfiguration.styleConfiguration !== undefined;
|
|
28
|
+
const hasRenderHighlightFromItem = itemConfiguration.renderHighlight !== undefined;
|
|
29
|
+
const finalStyleConfig = itemConfiguration.styleConfiguration !== undefined ? itemConfiguration.styleConfiguration : highlightStyleConfig;
|
|
30
|
+
const {
|
|
31
|
+
customStyle,
|
|
32
|
+
...restStyleConfig
|
|
33
|
+
} = finalStyleConfig;
|
|
34
|
+
const cacheKey = JSON.stringify(restStyleConfig);
|
|
35
|
+
let typographyClass;
|
|
36
|
+
|
|
37
|
+
if (Object.keys(restStyleConfig).length !== 0) {
|
|
38
|
+
if (cssClassCache.has(cacheKey)) {
|
|
39
|
+
typographyClass = cssClassCache.get(cacheKey);
|
|
40
|
+
} else {
|
|
41
|
+
const {
|
|
42
|
+
typographyClass: computedClass
|
|
43
|
+
} = cssJSLogic({
|
|
44
|
+
props: restStyleConfig,
|
|
45
|
+
style: typographyStyle
|
|
46
|
+
});
|
|
47
|
+
typographyClass = computedClass;
|
|
48
|
+
cssClassCache.set(cacheKey, typographyClass);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
searchTerm,
|
|
54
|
+
targetIndices: itemConfiguration.index !== undefined ? itemConfiguration.index : DUMMY_ARRAY,
|
|
55
|
+
shouldExcludeIndices: itemConfiguration.shouldExcludeIndices !== undefined ? itemConfiguration.shouldExcludeIndices : shouldExcludeIndices,
|
|
56
|
+
isCaseSensitive: itemConfiguration.isCaseSensitive !== undefined ? itemConfiguration.isCaseSensitive : enableCaseSensitiveMatch,
|
|
57
|
+
matchWholeWordOnly: itemConfiguration.isWholeWord !== undefined ? itemConfiguration.isWholeWord : matchWholeWordOnly,
|
|
58
|
+
wrapperTagName: itemConfiguration.tagName !== undefined ? itemConfiguration.tagName : wrapperTagName,
|
|
59
|
+
customStyle: customStyle,
|
|
60
|
+
customRenderer: itemConfiguration.renderHighlight !== undefined ? itemConfiguration.renderHighlight : customRenderer,
|
|
61
|
+
highlightClasses: typographyClass,
|
|
62
|
+
hasStyleConfigrationFromItem,
|
|
63
|
+
hasRenderHighlightFromItem
|
|
64
|
+
};
|
|
65
|
+
}).filter(highlightConfig => highlightConfig && highlightConfig.searchTerm.trim());
|
|
66
|
+
|
|
67
|
+
if (!normalizedHighlightTerms.length) {
|
|
68
|
+
return sourceText;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const regexPatterns = normalizedHighlightTerms.map(highlightConfig => {
|
|
72
|
+
// Escape special regex characters in the searchTerm so it can be safely used in a RegExp
|
|
73
|
+
const escapedTerm = highlightConfig.searchTerm.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // If matchWholeWordOnly is true, wrap the term with word boundaries (\b) to match whole words only
|
|
74
|
+
|
|
75
|
+
return highlightConfig.matchWholeWordOnly ? `\\b${escapedTerm}\\b` : escapedTerm;
|
|
76
|
+
});
|
|
77
|
+
const combinedRegexPattern = regexPatterns.join('|');
|
|
78
|
+
const textSegments = sourceText.split(new RegExp(`(${combinedRegexPattern})`, 'gi'));
|
|
79
|
+
const occurrenceCountByTerm = {};
|
|
80
|
+
return textSegments.map((textSegment, segmentIndex) => {
|
|
81
|
+
const matchingHighlightConfig = normalizedHighlightTerms.find(highlightConfig => {
|
|
82
|
+
const segmentToCompare = highlightConfig.isCaseSensitive ? textSegment : textSegment.toLowerCase();
|
|
83
|
+
const termToCompare = highlightConfig.isCaseSensitive ? highlightConfig.searchTerm : highlightConfig.searchTerm.toLowerCase();
|
|
84
|
+
return segmentToCompare === termToCompare;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (!matchingHighlightConfig) {
|
|
88
|
+
return textSegment;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const termKey = matchingHighlightConfig.searchTerm;
|
|
92
|
+
occurrenceCountByTerm[termKey] = (occurrenceCountByTerm[termKey] || 0) + 1;
|
|
93
|
+
const currentOccurrenceIndex = occurrenceCountByTerm[termKey];
|
|
94
|
+
const {
|
|
95
|
+
targetIndices,
|
|
96
|
+
shouldExcludeIndices
|
|
97
|
+
} = matchingHighlightConfig;
|
|
98
|
+
const isIndicesArray = Array.isArray(targetIndices);
|
|
99
|
+
let shouldApplyHighlight;
|
|
100
|
+
|
|
101
|
+
if (isIndicesArray) {
|
|
102
|
+
shouldApplyHighlight = (targetIndices.length === 0 || targetIndices.includes(currentOccurrenceIndex)) !== shouldExcludeIndices;
|
|
103
|
+
} else {
|
|
104
|
+
shouldApplyHighlight = (targetIndices === 0 || targetIndices === currentOccurrenceIndex) !== shouldExcludeIndices;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!shouldApplyHighlight) {
|
|
108
|
+
return textSegment;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const {
|
|
112
|
+
customStyle,
|
|
113
|
+
highlightClasses,
|
|
114
|
+
customRenderer,
|
|
115
|
+
hasStyleConfigrationFromItem,
|
|
116
|
+
hasRenderHighlightFromItem,
|
|
117
|
+
wrapperTagName: WrapperTag
|
|
118
|
+
} = matchingHighlightConfig;
|
|
119
|
+
let shouldUseCustomRenderer = false;
|
|
120
|
+
|
|
121
|
+
if (customRenderer) {
|
|
122
|
+
if (hasRenderHighlightFromItem) {
|
|
123
|
+
shouldUseCustomRenderer = true;
|
|
124
|
+
} else if (!hasStyleConfigrationFromItem && customRenderer) {
|
|
125
|
+
shouldUseCustomRenderer = true;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (shouldUseCustomRenderer && isRenderable(customRenderer)) {
|
|
130
|
+
return renderNode(customRenderer, textSegment);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return /*#__PURE__*/React.createElement(WrapperTag, {
|
|
134
|
+
key: `${textSegment}_${currentOccurrenceIndex}`,
|
|
135
|
+
style: customStyle,
|
|
136
|
+
className: highlightClasses
|
|
137
|
+
}, textSegment);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
@font-face {
|
|
2
|
-
font-family:
|
|
3
|
-
src: url('https://static.zohocdn.com/webfonts/
|
|
4
|
-
font-weight:
|
|
2
|
+
font-family: Light;
|
|
3
|
+
src: url('https://static.zohocdn.com/webfonts/lato2light/font.woff2') format('woff2');
|
|
4
|
+
font-weight: 300;
|
|
5
5
|
font-style: normal;
|
|
6
6
|
font-display: swap;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
@font-face {
|
|
10
|
-
font-family:
|
|
11
|
-
src: url('https://static.zohocdn.com/webfonts/
|
|
12
|
-
font-weight:
|
|
10
|
+
font-family: Regular;
|
|
11
|
+
src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');
|
|
12
|
+
font-weight: 400;
|
|
13
13
|
font-style: normal;
|
|
14
14
|
font-display: swap;
|
|
15
15
|
}
|
|
@@ -29,3 +29,36 @@
|
|
|
29
29
|
font-style: normal;
|
|
30
30
|
font-display: swap;
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: ZDLato;
|
|
36
|
+
src: url('https://static.zohocdn.com/webfonts/lato2light/font.woff2') format('woff2');
|
|
37
|
+
font-weight: 100 300;
|
|
38
|
+
font-style: normal;
|
|
39
|
+
font-display: swap;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@font-face {
|
|
43
|
+
font-family: ZDLato;
|
|
44
|
+
src: url('https://static.zohocdn.com/webfonts/lato2regular/font.woff2') format('woff2');
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
font-style: normal;
|
|
47
|
+
font-display: swap;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@font-face {
|
|
51
|
+
font-family: ZDLato;
|
|
52
|
+
src: url('https://static.zohocdn.com/webfonts/lato2semibold/font.woff2') format('woff2');
|
|
53
|
+
font-weight: 500 600;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-display: swap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@font-face {
|
|
59
|
+
font-family: ZDLato;
|
|
60
|
+
src: url('https://static.zohocdn.com/webfonts/lato2bold/font.woff2') format('woff2');
|
|
61
|
+
font-weight: 700 900;
|
|
62
|
+
font-style: normal;
|
|
63
|
+
font-display: swap;
|
|
64
|
+
}
|
|
@@ -27,7 +27,7 @@ html {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
textarea {
|
|
30
|
-
font-
|
|
30
|
+
font-weight: var(--zd-fw-normal);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
label, input[type='button'], input[type='submit'], input[type='file'], button {
|
|
@@ -37,4 +37,4 @@ label, input[type='button'], input[type='submit'], input[type='file'], button {
|
|
|
37
37
|
/*Moz Required Box shadow Isssue*/
|
|
38
38
|
input[required]:-moz-ui-invalid {
|
|
39
39
|
box-shadow: none;
|
|
40
|
-
}
|
|
40
|
+
}
|
|
@@ -303,22 +303,22 @@
|
|
|
303
303
|
resize: vertical;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
/*font-
|
|
306
|
+
/*font-weight*/
|
|
307
307
|
.regular {
|
|
308
|
-
font-
|
|
308
|
+
font-weight: var(--zd-fw-normal);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
.light {
|
|
312
|
-
font-
|
|
312
|
+
font-weight: var(--zd-fw-light);
|
|
313
313
|
}
|
|
314
314
|
|
|
315
315
|
.semibold {
|
|
316
|
-
font-
|
|
316
|
+
font-weight: var(--zd-fw-semibold);
|
|
317
317
|
composes: ftsmooth;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
.bold {
|
|
321
|
-
font-
|
|
321
|
+
font-weight: var(--zd-fw-bold);
|
|
322
322
|
composes: ftsmooth;
|
|
323
323
|
}
|
|
324
324
|
|
|
@@ -501,7 +501,7 @@
|
|
|
501
501
|
}
|
|
502
502
|
.lineClamp {
|
|
503
503
|
composes: wbreak clamp;
|
|
504
|
-
-webkit-line-clamp: var(--line-clamp,
|
|
504
|
+
-webkit-line-clamp: var(--line-clamp,2);
|
|
505
505
|
}
|
|
506
506
|
|
|
507
507
|
.offSelection {
|
|
@@ -10,10 +10,12 @@ const ArrowIcon = props => {
|
|
|
10
10
|
const {
|
|
11
11
|
dataId,
|
|
12
12
|
isRotated,
|
|
13
|
+
isActive,
|
|
13
14
|
customClass,
|
|
14
15
|
customProps,
|
|
15
16
|
tagAttributes,
|
|
16
17
|
a11yAttributes,
|
|
18
|
+
iconSize,
|
|
17
19
|
isDisabled,
|
|
18
20
|
isReadOnly,
|
|
19
21
|
renderCustomToggleIndicator
|
|
@@ -23,7 +25,8 @@ const ArrowIcon = props => {
|
|
|
23
25
|
containerClass = ''
|
|
24
26
|
} = customClass;
|
|
25
27
|
return isRenderable(renderCustomToggleIndicator) ? renderNode(renderCustomToggleIndicator, {
|
|
26
|
-
|
|
28
|
+
isRotated,
|
|
29
|
+
isActive,
|
|
27
30
|
isReadOnly,
|
|
28
31
|
isDisabled
|
|
29
32
|
}) : /*#__PURE__*/React.createElement(Container, {
|
|
@@ -35,10 +38,10 @@ const ArrowIcon = props => {
|
|
|
35
38
|
...a11yAttributes,
|
|
36
39
|
...customProps,
|
|
37
40
|
dataId: `${dataId}_downIcon`,
|
|
38
|
-
className: `${style.arrowIcon} ${isRotated ? style.rotated : ''} ${containerClass}`
|
|
41
|
+
className: `${style.arrowIcon} ${isRotated ? style.rotated : ''} ${isActive ? style.active : ''} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readonly : ''} ${containerClass}`
|
|
39
42
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
40
43
|
name: "ZD-down",
|
|
41
|
-
size:
|
|
44
|
+
size: iconSize,
|
|
42
45
|
iconClass: iconClass
|
|
43
46
|
}));
|
|
44
47
|
};
|
|
@@ -28,7 +28,16 @@
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
.rotated,
|
|
31
|
+
.active,
|
|
31
32
|
.arrowContainer:hover .arrowIcon,
|
|
32
33
|
.transparentContainer:hover .arrowIcon {
|
|
33
34
|
--local-arrowIcon-color: var(--zdt_arrowicon_hover_icon);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.disabled {
|
|
38
|
+
composes: disabled from '../../common/common.module.css';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.readonly {
|
|
42
|
+
composes: curdefault from '../../common/common.module.css';
|
|
34
43
|
}
|
|
@@ -24,6 +24,30 @@ describe('ArrowIcon', () => {
|
|
|
24
24
|
}));
|
|
25
25
|
expect(asFragment()).toMatchSnapshot();
|
|
26
26
|
});
|
|
27
|
+
test('Should be render isActive is true', () => {
|
|
28
|
+
const {
|
|
29
|
+
asFragment
|
|
30
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
31
|
+
isActive: true
|
|
32
|
+
}));
|
|
33
|
+
expect(asFragment()).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('Should be render isDisabled is true', () => {
|
|
36
|
+
const {
|
|
37
|
+
asFragment
|
|
38
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
39
|
+
isDisabled: true
|
|
40
|
+
}));
|
|
41
|
+
expect(asFragment()).toMatchSnapshot();
|
|
42
|
+
});
|
|
43
|
+
test('Should be render isReadOnly is true', () => {
|
|
44
|
+
const {
|
|
45
|
+
asFragment
|
|
46
|
+
} = render( /*#__PURE__*/React.createElement(ArrowIcon, {
|
|
47
|
+
isReadOnly: true
|
|
48
|
+
}));
|
|
49
|
+
expect(asFragment()).toMatchSnapshot();
|
|
50
|
+
});
|
|
27
51
|
test('Should be render with customClass', () => {
|
|
28
52
|
const {
|
|
29
53
|
asFragment
|
|
@@ -1,10 +1,73 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`ArrowIcon Should be render isActive is true 1`] = `
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
class="arrowIcon active inflex coldir both"
|
|
8
|
+
data-id="undefined_downIcon"
|
|
9
|
+
data-selector-id="container"
|
|
10
|
+
data-test-id="undefined_downIcon"
|
|
11
|
+
>
|
|
12
|
+
<i
|
|
13
|
+
aria-hidden="true"
|
|
14
|
+
class="zd_font_icons basic icon-down "
|
|
15
|
+
data-id="fontIcon"
|
|
16
|
+
data-selector-id="fontIcon"
|
|
17
|
+
data-test-id="fontIcon"
|
|
18
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
19
|
+
/>
|
|
20
|
+
</div>
|
|
21
|
+
</DocumentFragment>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`ArrowIcon Should be render isDisabled is true 1`] = `
|
|
25
|
+
<DocumentFragment>
|
|
26
|
+
<div
|
|
27
|
+
aria-hidden="true"
|
|
28
|
+
class="arrowIcon disabled inflex coldir both"
|
|
29
|
+
data-id="undefined_downIcon"
|
|
30
|
+
data-selector-id="container"
|
|
31
|
+
data-test-id="undefined_downIcon"
|
|
32
|
+
>
|
|
33
|
+
<i
|
|
34
|
+
aria-hidden="true"
|
|
35
|
+
class="zd_font_icons basic icon-down "
|
|
36
|
+
data-id="fontIcon"
|
|
37
|
+
data-selector-id="fontIcon"
|
|
38
|
+
data-test-id="fontIcon"
|
|
39
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
</DocumentFragment>
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
exports[`ArrowIcon Should be render isReadOnly is true 1`] = `
|
|
46
|
+
<DocumentFragment>
|
|
47
|
+
<div
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
class="arrowIcon readonly inflex coldir both"
|
|
50
|
+
data-id="undefined_downIcon"
|
|
51
|
+
data-selector-id="container"
|
|
52
|
+
data-test-id="undefined_downIcon"
|
|
53
|
+
>
|
|
54
|
+
<i
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
class="zd_font_icons basic icon-down "
|
|
57
|
+
data-id="fontIcon"
|
|
58
|
+
data-selector-id="fontIcon"
|
|
59
|
+
data-test-id="fontIcon"
|
|
60
|
+
style="--zd-iconfont-size: var(--zd_font_size7);"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</DocumentFragment>
|
|
64
|
+
`;
|
|
65
|
+
|
|
3
66
|
exports[`ArrowIcon Should be render isRotated is true 1`] = `
|
|
4
67
|
<DocumentFragment>
|
|
5
68
|
<div
|
|
6
69
|
aria-hidden="true"
|
|
7
|
-
class="arrowIcon rotated
|
|
70
|
+
class="arrowIcon rotated inflex coldir both"
|
|
8
71
|
data-id="undefined_downIcon"
|
|
9
72
|
data-selector-id="container"
|
|
10
73
|
data-test-id="undefined_downIcon"
|
|
@@ -25,7 +88,7 @@ exports[`ArrowIcon Should be render with a11yAttributes 1`] = `
|
|
|
25
88
|
<DocumentFragment>
|
|
26
89
|
<div
|
|
27
90
|
aria-hidden="true"
|
|
28
|
-
class="arrowIcon
|
|
91
|
+
class="arrowIcon inflex coldir both"
|
|
29
92
|
data-a11y-focus="true"
|
|
30
93
|
data-id="undefined_downIcon"
|
|
31
94
|
data-selector-id="container"
|
|
@@ -47,7 +110,7 @@ exports[`ArrowIcon Should be render with customClass 1`] = `
|
|
|
47
110
|
<DocumentFragment>
|
|
48
111
|
<div
|
|
49
112
|
aria-hidden="true"
|
|
50
|
-
class="arrowIcon
|
|
113
|
+
class="arrowIcon arrowIcon_containerClass inflex coldir both"
|
|
51
114
|
data-id="undefined_downIcon"
|
|
52
115
|
data-selector-id="container"
|
|
53
116
|
data-test-id="undefined_downIcon"
|
|
@@ -68,7 +131,7 @@ exports[`ArrowIcon Should be render with customProps 1`] = `
|
|
|
68
131
|
<DocumentFragment>
|
|
69
132
|
<div
|
|
70
133
|
aria-hidden="true"
|
|
71
|
-
class="arrowIcon
|
|
134
|
+
class="arrowIcon inflex coldir both"
|
|
72
135
|
data-id="undefined_downIcon"
|
|
73
136
|
data-selector-id="container"
|
|
74
137
|
data-test-id="hereIsTestId"
|
|
@@ -89,7 +152,7 @@ exports[`ArrowIcon Should be render with dataId 1`] = `
|
|
|
89
152
|
<DocumentFragment>
|
|
90
153
|
<div
|
|
91
154
|
aria-hidden="true"
|
|
92
|
-
class="arrowIcon
|
|
155
|
+
class="arrowIcon inflex coldir both"
|
|
93
156
|
data-id="ArrowIcon-test-dataId_downIcon"
|
|
94
157
|
data-selector-id="container"
|
|
95
158
|
data-test-id="ArrowIcon-test-dataId_downIcon"
|
|
@@ -118,7 +181,7 @@ exports[`ArrowIcon Should be render with tagAttributes 1`] = `
|
|
|
118
181
|
<DocumentFragment>
|
|
119
182
|
<div
|
|
120
183
|
aria-hidden="true"
|
|
121
|
-
class="arrowIcon
|
|
184
|
+
class="arrowIcon inflex coldir both"
|
|
122
185
|
data-id="undefined_downIcon"
|
|
123
186
|
data-selector-id="container"
|
|
124
187
|
data-test-id="undefined_downIcon"
|
|
@@ -140,7 +203,7 @@ exports[`ArrowIcon rendering the defult props 1`] = `
|
|
|
140
203
|
<DocumentFragment>
|
|
141
204
|
<div
|
|
142
205
|
aria-hidden="true"
|
|
143
|
-
class="arrowIcon
|
|
206
|
+
class="arrowIcon inflex coldir both"
|
|
144
207
|
data-id="undefined_downIcon"
|
|
145
208
|
data-selector-id="container"
|
|
146
209
|
data-test-id="undefined_downIcon"
|
|
@@ -11,5 +11,7 @@ export default {
|
|
|
11
11
|
a11yAttributes: PropTypes.object,
|
|
12
12
|
renderCustomToggleIndicator: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
|
|
13
13
|
isDisabled: PropTypes.bool,
|
|
14
|
-
isReadOnly: PropTypes.bool
|
|
14
|
+
isReadOnly: PropTypes.bool,
|
|
15
|
+
isActive: PropTypes.bool,
|
|
16
|
+
iconSize: PropTypes.string
|
|
15
17
|
};
|
package/es/utils/Common.js
CHANGED
|
@@ -159,7 +159,7 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
159
159
|
const value = typeof option === 'object' ? option[impTextField || textField] : allowValueFallback ? option : '';
|
|
160
160
|
const secondaryValue = typeof option === 'object' ? option[impSecondaryField || secondaryField] : '';
|
|
161
161
|
const photoURL = typeof option === 'object' ? option[impImageField || imageField] : '';
|
|
162
|
-
const
|
|
162
|
+
const colorConfig = selectn('colorConfig', option); // grouping options (group select/MultiSelect)
|
|
163
163
|
|
|
164
164
|
id = !getIsEmptyValue(id) ? optionIdGrouping(id, prefixText) : '';
|
|
165
165
|
const additionalSearchFieldData = searchFields.reduce((value, item) => {
|
|
@@ -200,8 +200,8 @@ export const makeFormatOptions = () => createSelector([getOptions, getValueField
|
|
|
200
200
|
optionDetails.listItemProps = listStyle || listItemProps;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
if (
|
|
204
|
-
optionDetails.
|
|
203
|
+
if (colorConfig) {
|
|
204
|
+
optionDetails.colorConfig = colorConfig;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
if (listStyleCustomProps || listItemCustomProps) {
|
package/es/v1/Popup/Popup.js
CHANGED
|
@@ -5,7 +5,7 @@ import hoistStatics from 'hoist-non-react-statics';
|
|
|
5
5
|
/**** Methods ****/
|
|
6
6
|
|
|
7
7
|
import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from "../../utils/Common.js";
|
|
8
|
-
import viewPort from
|
|
8
|
+
import viewPort from '@zohodesk/dotkit/es/react/components/Popup/utils/viewPort.js';
|
|
9
9
|
import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from "../../Popup/PositionMapping.js";
|
|
10
10
|
import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
|
|
11
11
|
let lastOpenedGroup = [];
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
display: initial;
|
|
20
20
|
}
|
|
21
21
|
.font_regular {
|
|
22
|
-
font-
|
|
22
|
+
font-weight: var(--zd-fw-normal);
|
|
23
23
|
}
|
|
24
24
|
.font_light {
|
|
25
|
-
font-
|
|
25
|
+
font-weight: var(--zd-fw-light);
|
|
26
26
|
}
|
|
27
27
|
.font_semibold {
|
|
28
|
-
font-
|
|
28
|
+
font-weight: var(--zd-fw-semibold);
|
|
29
29
|
composes: ftsmooth from '../../../common/common.module.css';
|
|
30
30
|
}
|
|
31
31
|
.font_bold {
|
|
32
|
-
font-
|
|
32
|
+
font-weight: var(--zd-fw-bold);
|
|
33
33
|
composes: ftsmooth from '../../../common/common.module.css';
|
|
34
34
|
}
|
|
35
35
|
.fontStyles_normal{
|
|
@@ -29,6 +29,8 @@ require("@zohodesk/variables/assets/fontsizeVariables.module.css");
|
|
|
29
29
|
|
|
30
30
|
require("@zohodesk/variables/es/fontFamilyVariables.module.css");
|
|
31
31
|
|
|
32
|
+
require("@zohodesk/variables/es/fontWeightVariables.module.css");
|
|
33
|
+
|
|
32
34
|
require("@zohodesk/variables/assets/transitionVariables.module.css");
|
|
33
35
|
|
|
34
36
|
require("@zohodesk/variables/assets/no_transitionVariables.module.css");
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
-moz-box-sizing: border-box;
|
|
9
9
|
-ms-box-sizing: border-box;
|
|
10
10
|
}
|
|
11
|
-
.container {
|
|
12
|
-
font-family: var(--zd_regular);
|
|
11
|
+
.container, .container button, .container input, .container textarea ,.container select {
|
|
12
|
+
/* font-family: var(--zd_regular); */
|
|
13
|
+
font-family: var(--zd-font-family), var(--zd_fallback_font, ZDLato);
|
|
13
14
|
}
|
|
14
15
|
.tooltip {
|
|
15
16
|
height: 0 ;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
--button_cursor: pointer;
|
|
6
6
|
--button_font_size: var(--zd_font_size13);
|
|
7
7
|
--button_text_color: var(--zdt_button_default_text);
|
|
8
|
-
--
|
|
8
|
+
--button_font_weight: var(--zd-fw-normal);
|
|
9
9
|
--button_text_transform: capitalize;
|
|
10
10
|
--button_bg_color: var(--zdt_button_default_bg);
|
|
11
11
|
--button_border_radius: 4px;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
position: relative;
|
|
50
50
|
font-size: var(--button_font_size);
|
|
51
51
|
color: var(--button_text_color);
|
|
52
|
-
font-
|
|
52
|
+
font-weight: var(--button_font_weight);
|
|
53
53
|
text-transform: var(--button_text_transform);
|
|
54
54
|
min-width: var(--button_min_width);
|
|
55
55
|
height: var(--button_height);
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.bold {
|
|
66
|
-
--
|
|
66
|
+
--button_font_weight: var(--zd-fw-semibold);
|
|
67
67
|
composes: ftsmooth from '../../common/common.module.css';
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -623,7 +623,7 @@
|
|
|
623
623
|
}
|
|
624
624
|
|
|
625
625
|
.loader {
|
|
626
|
-
color: var(--dot_mirror)
|
|
626
|
+
color: var(--dot_mirror);
|
|
627
627
|
}
|
|
628
628
|
|
|
629
629
|
[dir=ltr] .strike {
|
|
@@ -633,34 +633,43 @@
|
|
|
633
633
|
[dir=rtl] .strike {
|
|
634
634
|
background-image: repeating-linear-gradient(-120deg, var(--button_strike_color) 0 1px, transparent 1px 8px);
|
|
635
635
|
}
|
|
636
|
+
|
|
636
637
|
.primaryStrike {
|
|
637
638
|
--button_strike_color: var(--zdt_button_primary_strike);
|
|
638
639
|
}
|
|
640
|
+
|
|
639
641
|
.primaryfilledStrike {
|
|
640
642
|
--button_strike_color: var(--zdt_button_primaryFilled_strike);
|
|
641
643
|
--button_border_color: var(--zdt_button_primaryfill_bg);
|
|
642
644
|
}
|
|
645
|
+
|
|
643
646
|
.dangerStrike {
|
|
644
647
|
--button_strike_color: var(--zdt_button_danger_strike);
|
|
645
648
|
}
|
|
649
|
+
|
|
646
650
|
.dangerfilledStrike {
|
|
647
651
|
--button_strike_color: var(--zdt_button_dangerFilled_strike);
|
|
648
652
|
--button_border_color: var(--zdt_button_dangerfill_bg);
|
|
649
653
|
}
|
|
654
|
+
|
|
650
655
|
.secondaryStrike {
|
|
651
656
|
--button_strike_color: var(--zdt_button_secondary_border);
|
|
652
657
|
}
|
|
658
|
+
|
|
653
659
|
.secondaryfilledStrike {
|
|
654
660
|
--button_strike_color: var(--zdt_button_secondaryFilled_strike);
|
|
655
661
|
--button_border_color: var(--zdt_button_secondaryfill_bg);
|
|
656
662
|
}
|
|
663
|
+
|
|
657
664
|
.tertiaryfilledStrike {
|
|
658
665
|
--button_strike_color: var(--zdt_button_tertiaryFilled_strike);
|
|
659
666
|
--button_border_color: var(--zdt_button_tertiaryfill_bg);
|
|
660
667
|
}
|
|
668
|
+
|
|
661
669
|
.successStrike {
|
|
662
670
|
--button_strike_color: var(--zdt_button_success_strike);
|
|
663
671
|
}
|
|
672
|
+
|
|
664
673
|
.successfilledStrike {
|
|
665
674
|
--button_strike_color: var(--zdt_button_successFilled_strike);
|
|
666
675
|
--button_border_color: var(--zdt_button_successfill_border);
|