@zohodesk/components 1.6.7-exp-0 → 1.6.8
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
CHANGED
|
@@ -7,6 +7,8 @@ Dot UI is a customizable React component library built to deliver a clean, acces
|
|
|
7
7
|
- **Typography**
|
|
8
8
|
- `breakSpaces` value supported for the **$ui_whiteSpace** prop.
|
|
9
9
|
- Prefixless prop fallbacks are supported
|
|
10
|
+
- `tagName` config in **highlightText** has been renamed to `as`. (fallback supported)
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
# 1.6.7
|
|
12
14
|
|
|
@@ -11,9 +11,11 @@ export function highlightText(config) {
|
|
|
11
11
|
shouldExcludeIndices = false,
|
|
12
12
|
isCaseSensitive: enableCaseSensitiveMatch = false,
|
|
13
13
|
isWholeWord: matchWholeWordOnly = false,
|
|
14
|
-
as:
|
|
14
|
+
as: asTag,
|
|
15
|
+
tagName: tagNameLegacy,
|
|
15
16
|
renderHighlight: customRenderer
|
|
16
17
|
} = config;
|
|
18
|
+
const wrapperTagName = asTag ?? tagNameLegacy ?? 'span';
|
|
17
19
|
|
|
18
20
|
if (!sourceText || !highlightData?.length) {
|
|
19
21
|
return sourceText;
|
|
@@ -55,7 +57,7 @@ export function highlightText(config) {
|
|
|
55
57
|
shouldExcludeIndices: itemConfiguration.shouldExcludeIndices !== undefined ? itemConfiguration.shouldExcludeIndices : shouldExcludeIndices,
|
|
56
58
|
isCaseSensitive: itemConfiguration.isCaseSensitive !== undefined ? itemConfiguration.isCaseSensitive : enableCaseSensitiveMatch,
|
|
57
59
|
matchWholeWordOnly: itemConfiguration.isWholeWord !== undefined ? itemConfiguration.isWholeWord : matchWholeWordOnly,
|
|
58
|
-
wrapperTagName: itemConfiguration.as !== undefined ? itemConfiguration.as : wrapperTagName,
|
|
60
|
+
wrapperTagName: itemConfiguration.as !== undefined ? itemConfiguration.as : itemConfiguration.tagName !== undefined ? itemConfiguration.tagName : wrapperTagName,
|
|
59
61
|
customStyle: customStyle,
|
|
60
62
|
customRenderer: itemConfiguration.renderHighlight !== undefined ? itemConfiguration.renderHighlight : customRenderer,
|
|
61
63
|
highlightClasses: typographyClass,
|
|
@@ -24,6 +24,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
24
24
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
25
25
|
|
|
26
26
|
function highlightText(config) {
|
|
27
|
+
var _ref;
|
|
28
|
+
|
|
27
29
|
var sourceText = config.text,
|
|
28
30
|
highlightData = config.data,
|
|
29
31
|
_config$styleConfigur = config.styleConfiguration,
|
|
@@ -34,9 +36,10 @@ function highlightText(config) {
|
|
|
34
36
|
enableCaseSensitiveMatch = _config$isCaseSensiti === void 0 ? false : _config$isCaseSensiti,
|
|
35
37
|
_config$isWholeWord = config.isWholeWord,
|
|
36
38
|
matchWholeWordOnly = _config$isWholeWord === void 0 ? false : _config$isWholeWord,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
asTag = config.as,
|
|
40
|
+
tagNameLegacy = config.tagName,
|
|
39
41
|
customRenderer = config.renderHighlight;
|
|
42
|
+
var wrapperTagName = (_ref = asTag !== null && asTag !== void 0 ? asTag : tagNameLegacy) !== null && _ref !== void 0 ? _ref : 'span';
|
|
40
43
|
|
|
41
44
|
if (!sourceText || !(highlightData !== null && highlightData !== void 0 && highlightData.length)) {
|
|
42
45
|
return sourceText;
|
|
@@ -78,7 +81,7 @@ function highlightText(config) {
|
|
|
78
81
|
shouldExcludeIndices: itemConfiguration.shouldExcludeIndices !== undefined ? itemConfiguration.shouldExcludeIndices : shouldExcludeIndices,
|
|
79
82
|
isCaseSensitive: itemConfiguration.isCaseSensitive !== undefined ? itemConfiguration.isCaseSensitive : enableCaseSensitiveMatch,
|
|
80
83
|
matchWholeWordOnly: itemConfiguration.isWholeWord !== undefined ? itemConfiguration.isWholeWord : matchWholeWordOnly,
|
|
81
|
-
wrapperTagName: itemConfiguration.as !== undefined ? itemConfiguration.as : wrapperTagName,
|
|
84
|
+
wrapperTagName: itemConfiguration.as !== undefined ? itemConfiguration.as : itemConfiguration.tagName !== undefined ? itemConfiguration.tagName : wrapperTagName,
|
|
82
85
|
customStyle: customStyle,
|
|
83
86
|
customRenderer: itemConfiguration.renderHighlight !== undefined ? itemConfiguration.renderHighlight : customRenderer,
|
|
84
87
|
highlightClasses: typographyClass,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"@zohodesk/hooks": "2.0.8",
|
|
84
84
|
"@zohodesk/icons": "1.2.8",
|
|
85
85
|
"@zohodesk/layout": "3.1.0",
|
|
86
|
-
"@zohodesk/svg": "1.3.
|
|
86
|
+
"@zohodesk/svg": "1.3.5",
|
|
87
87
|
"@zohodesk/utils": "1.3.16",
|
|
88
88
|
"@zohodesk/variables": "1.3.1",
|
|
89
89
|
"@zohodesk/virtualizer": "1.0.13",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"@zohodesk/icons": "1.2.8",
|
|
104
104
|
"@zohodesk/variables": "1.3.1",
|
|
105
|
-
"@zohodesk/svg": "1.3.
|
|
105
|
+
"@zohodesk/svg": "1.3.5",
|
|
106
106
|
"@zohodesk/virtualizer": "1.0.13",
|
|
107
107
|
"velocity-react": "1.4.3",
|
|
108
108
|
"react-sortable-hoc": "^0.8.3",
|