@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.
Files changed (107) hide show
  1. package/README.md +15 -1
  2. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +2 -0
  3. package/assets/Appearance/light/mode/Component_LightMode.module.css +2 -0
  4. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +2 -0
  5. package/es/CheckBox/CheckBox.js +21 -10
  6. package/es/CheckBox/CheckBox.module.css +21 -6
  7. package/es/CheckBox/__tests__/CheckBox.spec.js +9 -0
  8. package/es/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
  9. package/es/CheckBox/props/propTypes.js +4 -1
  10. package/es/ColorSelect/ColorSingleSelect.js +0 -1
  11. package/es/ColorSelect/__tests__/ColorMultiSelect.spec.js +15 -3
  12. package/es/ColorSelect/__tests__/ColorSingleSelect.spec.js +15 -3
  13. package/es/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +2 -2
  14. package/es/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +8 -8
  15. package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +7 -3
  16. package/es/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +17 -4
  17. package/es/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +3 -3
  18. package/es/ColorSelect/_shared/ColorIndicator/props/propTypes.js +1 -1
  19. package/es/ColorSelect/_shared/ColoredTag/props/propTypes.js +1 -0
  20. package/es/ColorSelect/_shared/helpers/renderHelpers.js +14 -10
  21. package/es/ColorSelect/props/propTypes.js +1 -0
  22. package/es/Label/Label.js +19 -1
  23. package/es/Label/__tests__/Label.spec.js +58 -0
  24. package/es/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
  25. package/es/Label/props/defaultProps.js +1 -0
  26. package/es/Label/props/propTypes.js +7 -1
  27. package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -6
  28. package/es/MultiSelect/MultiSelect.js +2 -2
  29. package/es/MultiSelect/Suggestions.js +2 -7
  30. package/es/MultiSelect/props/defaultProps.js +0 -2
  31. package/es/MultiSelect/props/propTypes.js +3 -11
  32. package/es/Radio/Radio.js +20 -9
  33. package/es/Radio/Radio.module.css +38 -5
  34. package/es/Radio/__tests__/Radio.spec.js +10 -0
  35. package/es/Radio/__tests__/__snapshots__/Radio.spec.js.snap +238 -81
  36. package/es/Radio/props/propTypes.js +4 -1
  37. package/es/Select/GroupSelect.js +1 -1
  38. package/es/Select/SelectWithAvatar.js +3 -3
  39. package/es/Select/SelectWithIcon.js +3 -10
  40. package/es/Select/props/defaultProps.js +2 -4
  41. package/es/Select/props/propTypes.js +3 -11
  42. package/es/Typography/Typography.js +9 -2
  43. package/es/Typography/__tests__/Typography.spec.js +427 -0
  44. package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +506 -0
  45. package/es/Typography/props/defaultProps.js +2 -1
  46. package/es/Typography/props/propTypes.js +24 -5
  47. package/es/Typography/utils/textHighlighter.js +139 -0
  48. package/es/common/common.module.css +1 -1
  49. package/es/shared/ArrowIcon/ArrowIcon.js +6 -3
  50. package/es/shared/ArrowIcon/ArrowIcon.module.css +9 -0
  51. package/es/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +24 -0
  52. package/es/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +70 -7
  53. package/es/shared/ArrowIcon/props/defaultProps.js +2 -0
  54. package/es/shared/ArrowIcon/props/propTypes.js +3 -1
  55. package/es/utils/dropDownUtils.js +3 -3
  56. package/lib/CheckBox/CheckBox.js +23 -9
  57. package/lib/CheckBox/CheckBox.module.css +21 -6
  58. package/lib/CheckBox/__tests__/CheckBox.spec.js +21 -12
  59. package/lib/CheckBox/__tests__/__snapshots__/CheckBox.spec.js.snap +162 -93
  60. package/lib/CheckBox/props/propTypes.js +5 -1
  61. package/lib/ColorSelect/ColorSingleSelect.js +1 -2
  62. package/lib/ColorSelect/__tests__/ColorMultiSelect.spec.js +15 -3
  63. package/lib/ColorSelect/__tests__/ColorSingleSelect.spec.js +15 -3
  64. package/lib/ColorSelect/__tests__/__snapshots__/ColorMultiSelect.spec.js.snap +2 -2
  65. package/lib/ColorSelect/__tests__/__snapshots__/ColorSingleSelect.spec.js.snap +8 -8
  66. package/lib/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +10 -4
  67. package/lib/ColorSelect/_shared/ColorIndicator/__tests__/ColorIndicator.spec.js +17 -4
  68. package/lib/ColorSelect/_shared/ColorIndicator/__tests__/__snapshots__/ColorIndicator.spec.js.snap +3 -3
  69. package/lib/ColorSelect/_shared/ColorIndicator/props/propTypes.js +1 -1
  70. package/lib/ColorSelect/_shared/ColoredTag/props/propTypes.js +1 -0
  71. package/lib/ColorSelect/_shared/helpers/renderHelpers.js +19 -13
  72. package/lib/ColorSelect/props/propTypes.js +1 -0
  73. package/lib/Label/Label.js +21 -1
  74. package/lib/Label/__tests__/Label.spec.js +58 -0
  75. package/lib/Label/__tests__/__snapshots__/Label.spec.js.snap +66 -0
  76. package/lib/Label/props/defaultProps.js +1 -0
  77. package/lib/Label/props/propTypes.js +8 -1
  78. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +3 -8
  79. package/lib/MultiSelect/MultiSelect.js +2 -2
  80. package/lib/MultiSelect/Suggestions.js +2 -6
  81. package/lib/MultiSelect/props/defaultProps.js +0 -2
  82. package/lib/MultiSelect/props/propTypes.js +5 -13
  83. package/lib/Radio/Radio.js +22 -8
  84. package/lib/Radio/Radio.module.css +38 -5
  85. package/lib/Radio/__tests__/Radio.spec.js +10 -0
  86. package/lib/Radio/__tests__/__snapshots__/Radio.spec.js.snap +238 -81
  87. package/lib/Radio/props/propTypes.js +5 -1
  88. package/lib/Select/GroupSelect.js +1 -2
  89. package/lib/Select/SelectWithAvatar.js +3 -4
  90. package/lib/Select/SelectWithIcon.js +3 -10
  91. package/lib/Select/props/defaultProps.js +3 -5
  92. package/lib/Select/props/propTypes.js +3 -11
  93. package/lib/Typography/Typography.js +9 -2
  94. package/lib/Typography/__tests__/Typography.spec.js +436 -0
  95. package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +506 -0
  96. package/lib/Typography/props/defaultProps.js +2 -1
  97. package/lib/Typography/props/propTypes.js +31 -6
  98. package/lib/Typography/utils/textHighlighter.js +160 -0
  99. package/lib/common/common.module.css +1 -1
  100. package/lib/shared/ArrowIcon/ArrowIcon.js +6 -3
  101. package/lib/shared/ArrowIcon/ArrowIcon.module.css +9 -0
  102. package/lib/shared/ArrowIcon/__tests__/ArrowIcon.spec.js +34 -10
  103. package/lib/shared/ArrowIcon/__tests__/__snapshots__/ArrowIcon.spec.js.snap +70 -7
  104. package/lib/shared/ArrowIcon/props/defaultProps.js +2 -0
  105. package/lib/shared/ArrowIcon/props/propTypes.js +3 -1
  106. package/lib/utils/dropDownUtils.js +3 -3
  107. package/package.json +2 -2
@@ -7,12 +7,15 @@ exports.propTypes = void 0;
7
7
 
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
 
10
+ var _propTypes2 = require("../../Typography/props/propTypes");
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
13
 
12
14
  var propTypes = {
13
15
  active: _propTypes["default"].bool,
14
16
  checked: _propTypes["default"].bool,
15
17
  disabled: _propTypes["default"].bool,
18
+ secondaryText: _propTypes["default"].string,
16
19
  disabledTitle: _propTypes["default"].string,
17
20
  getRef: _propTypes["default"].func,
18
21
  id: _propTypes["default"].string,
@@ -33,7 +36,8 @@ var propTypes = {
33
36
  }),
34
37
  customProps: _propTypes["default"].exact({
35
38
  ContainerProps: _propTypes["default"].object,
36
- LabelProps: _propTypes["default"].object
39
+ LabelProps: _propTypes["default"].object,
40
+ secondaryTextProps: _propTypes["default"].exact(_propTypes2.propTypes)
37
41
  }),
38
42
  a11y: _propTypes["default"].shape({
39
43
  ariaChecked: _propTypes["default"].bool,
@@ -700,8 +700,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
700
700
  TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
701
701
  _customProps$TextBoxP = customProps.TextBoxProps,
702
702
  TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP,
703
- _customProps$Suggesti = customProps.SuggestionsProps,
704
- SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
703
+ SuggestionsProps = customProps.SuggestionsProps;
705
704
  return /*#__PURE__*/_react["default"].createElement("div", {
706
705
  className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : '', " ").concat(iconOnHover && (isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverStyle : ''),
707
706
  "data-id": dataIdSlctComp,
@@ -221,8 +221,8 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
221
221
  needEffect = _this$props.needEffect,
222
222
  isLoading = _this$props.isLoading,
223
223
  dataSelectorId = _this$props.dataSelectorId,
224
- getTargetRef = _this$props.getTargetRef,
225
- customProps = _this$props.customProps;
224
+ customProps = _this$props.customProps,
225
+ getTargetRef = _this$props.getTargetRef;
226
226
  i18nKeys = Object.assign({}, i18nKeys, {
227
227
  emptyText: i18nKeys.emptyText || emptyMessage,
228
228
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
@@ -245,8 +245,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
245
245
  var ariaErrorId = this.getNextAriaId();
246
246
  var TextBoxProps = customProps.TextBoxProps,
247
247
  DropdownSearchTextBoxProps = customProps.DropdownSearchTextBoxProps,
248
- _customProps$Suggesti = customProps.SuggestionsProps,
249
- SuggestionsProps = _customProps$Suggesti === void 0 ? {} : _customProps$Suggesti;
248
+ SuggestionsProps = customProps.SuggestionsProps;
250
249
  return /*#__PURE__*/_react["default"].createElement("div", {
251
250
  className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : '', " ").concat(className ? className : ''),
252
251
  "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
@@ -431,8 +431,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
431
431
  htmlId = _this$props7.htmlId,
432
432
  isLoading = _this$props7.isLoading,
433
433
  dataSelectorId = _this$props7.dataSelectorId,
434
- customProps = _this$props7.customProps,
435
- customClass = _this$props7.customClass;
434
+ customProps = _this$props7.customProps;
436
435
  i18nKeys = Object.assign({}, i18nKeys, {
437
436
  emptyText: i18nKeys.emptyText || emptyMessage,
438
437
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
@@ -450,10 +449,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
450
449
  DropdownSearchTextBoxProps = _customProps$Dropdown === void 0 ? {} : _customProps$Dropdown,
451
450
  _customProps$TextBoxI = customProps.TextBoxIconProps,
452
451
  TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
453
- _customProps$ListItem = customProps.ListItemProps,
454
- ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem;
455
- var _customClass$dropBoxC = customClass.dropBoxClass,
456
- dropBoxClass = _customClass$dropBoxC === void 0 ? '' : _customClass$dropBoxC;
452
+ ListItemProps = customProps.ListItemProps;
457
453
  return /*#__PURE__*/_react["default"].createElement("div", {
458
454
  className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : ''),
459
455
  "data-title": isDisabled ? title : null,
@@ -546,10 +542,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
546
542
  size: boxSize,
547
543
  isPadding: false,
548
544
  isResponsivePadding: true,
549
- alignBox: "row",
550
- customClass: {
551
- customDropBox: dropBoxClass
552
- }
545
+ alignBox: "row"
553
546
  }, isLoading ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
554
547
  align: "both",
555
548
  className: _SelectModule["default"].loader
@@ -91,8 +91,7 @@ var GroupSelect_defaultProps = {
91
91
  allowValueFallback: true
92
92
  };
93
93
  exports.GroupSelect_defaultProps = GroupSelect_defaultProps;
94
-
95
- var SelectWithAvatar_defaultProps = _defineProperty({
94
+ var SelectWithAvatar_defaultProps = {
96
95
  animationStyle: 'bounce',
97
96
  defaultDropBoxPosition: 'bottom',
98
97
  dropBoxSize: 'small',
@@ -118,8 +117,7 @@ var SelectWithAvatar_defaultProps = _defineProperty({
118
117
  customProps: {},
119
118
  needEffect: true,
120
119
  isLoading: false
121
- }, "customProps", {});
122
-
120
+ };
123
121
  exports.SelectWithAvatar_defaultProps = SelectWithAvatar_defaultProps;
124
122
  var SelectWithIcon_defaultProps = (_SelectWithIcon_defau = {
125
123
  isReadOnly: false,
@@ -130,5 +128,5 @@ var SelectWithIcon_defaultProps = (_SelectWithIcon_defau = {
130
128
  needListBorder: false,
131
129
  needSearch: false,
132
130
  boxSize: 'default'
133
- }, _defineProperty(_SelectWithIcon_defau, "needListBorder", false), _defineProperty(_SelectWithIcon_defau, "needCloseOnSelect", true), _defineProperty(_SelectWithIcon_defau, "borderColor", 'default'), _defineProperty(_SelectWithIcon_defau, "needTick", true), _defineProperty(_SelectWithIcon_defau, "searchBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "size", 'medium'), _defineProperty(_SelectWithIcon_defau, "searchFields", []), _defineProperty(_SelectWithIcon_defau, "textBoxSize", 'medium'), _defineProperty(_SelectWithIcon_defau, "textBoxVariant", 'default'), _defineProperty(_SelectWithIcon_defau, "dataId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dataSelectorId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dropBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "needIcon", true), _defineProperty(_SelectWithIcon_defau, "iconSize", '14'), _defineProperty(_SelectWithIcon_defau, "i18nKeys", {}), _defineProperty(_SelectWithIcon_defau, "isLoading", false), _defineProperty(_SelectWithIcon_defau, "isAbsolutePositioningNeeded", true), _defineProperty(_SelectWithIcon_defau, "isRestrictScroll", false), _defineProperty(_SelectWithIcon_defau, "customProps", {}), _defineProperty(_SelectWithIcon_defau, "customClass", {}), _SelectWithIcon_defau);
131
+ }, _defineProperty(_SelectWithIcon_defau, "needListBorder", false), _defineProperty(_SelectWithIcon_defau, "needCloseOnSelect", true), _defineProperty(_SelectWithIcon_defau, "borderColor", 'default'), _defineProperty(_SelectWithIcon_defau, "needTick", true), _defineProperty(_SelectWithIcon_defau, "searchBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "size", 'medium'), _defineProperty(_SelectWithIcon_defau, "searchFields", []), _defineProperty(_SelectWithIcon_defau, "textBoxSize", 'medium'), _defineProperty(_SelectWithIcon_defau, "textBoxVariant", 'default'), _defineProperty(_SelectWithIcon_defau, "dataId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dataSelectorId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dropBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "needIcon", true), _defineProperty(_SelectWithIcon_defau, "iconSize", '14'), _defineProperty(_SelectWithIcon_defau, "i18nKeys", {}), _defineProperty(_SelectWithIcon_defau, "isLoading", false), _defineProperty(_SelectWithIcon_defau, "isAbsolutePositioningNeeded", true), _defineProperty(_SelectWithIcon_defau, "isRestrictScroll", false), _defineProperty(_SelectWithIcon_defau, "customProps", {}), _SelectWithIcon_defau);
134
132
  exports.SelectWithIcon_defaultProps = SelectWithIcon_defaultProps;
@@ -203,8 +203,7 @@ var GroupSelect_propTypes = {
203
203
  isDefaultSelectValue: _propTypes["default"].bool,
204
204
  customProps: _propTypes["default"].shape({
205
205
  TextBoxProps: _propTypes["default"].object,
206
- TextBoxIconProps: _propTypes["default"].object,
207
- SuggestionsProps: _propTypes["default"].object
206
+ TextBoxIconProps: _propTypes["default"].object
208
207
  }),
209
208
  allowValueFallback: _propTypes["default"].bool
210
209
  };
@@ -269,10 +268,7 @@ var SelectWithAvatar_propTypes = _objectSpread(_objectSpread({}, Select_propType
269
268
  htmlId: _propTypes["default"].string,
270
269
  needEffect: _propTypes["default"].bool,
271
270
  isLoading: _propTypes["default"].bool,
272
- dataSelectorId: _propTypes["default"].string,
273
- customProps: _propTypes["default"].shape({
274
- SuggestionsProps: _propTypes["default"].object
275
- })
271
+ dataSelectorId: _propTypes["default"].string
276
272
  });
277
273
 
278
274
  exports.SelectWithAvatar_propTypes = SelectWithAvatar_propTypes;
@@ -339,11 +335,7 @@ var SelectWithIcon_propTypes = {
339
335
  TextBoxProps: _propTypes["default"].object,
340
336
  DropdownSearchTextBoxProps: _propTypes["default"].object,
341
337
  SuggestionsProps: _propTypes["default"].object,
342
- TextBoxIconProps: _propTypes["default"].object,
343
- ListItemProps: _propTypes["default"].object
344
- }),
345
- customClass: _propTypes["default"].shape({
346
- dropBoxClass: _propTypes["default"].string
338
+ TextBoxIconProps: _propTypes["default"].object
347
339
  })
348
340
  };
349
341
  exports.SelectWithIcon_propTypes = SelectWithIcon_propTypes;
@@ -15,6 +15,8 @@ var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
15
15
 
16
16
  var _utils = require("@zohodesk/utils");
17
17
 
18
+ var _textHighlighter = require("./utils/textHighlighter");
19
+
18
20
  var _TypographyModule = _interopRequireDefault(require("./css/Typography.module.css"));
19
21
 
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -33,7 +35,10 @@ var Typography = function Typography(props) {
33
35
  customId = props.customId,
34
36
  $tagAttributes_text = props.$tagAttributes_text,
35
37
  $a11yAttributes_text = props.$a11yAttributes_text,
36
- customStyle = props.customStyle;
38
+ customStyle = props.customStyle,
39
+ $ui_highlightConfig = props.$ui_highlightConfig;
40
+ var _$ui_highlightConfig$ = $ui_highlightConfig.data,
41
+ highlightData = _$ui_highlightConfig$ === void 0 ? [] : _$ui_highlightConfig$;
37
42
  var style = (0, _utils.mergeStyle)(_TypographyModule["default"], customStyle);
38
43
 
39
44
  var _cssJSLogic = (0, _cssJSLogic2["default"])({
@@ -47,7 +52,9 @@ var Typography = function Typography(props) {
47
52
  'data-title': $i18n_dataTitle,
48
53
  'data-id': customId,
49
54
  'data-test-id': testId
50
- }, $tagAttributes_text), $a11yAttributes_text), children);
55
+ }, $tagAttributes_text), $a11yAttributes_text), highlightData && highlightData.length > 0 && typeof children === 'string' ? (0, _textHighlighter.highlightText)(_objectSpread(_objectSpread({}, $ui_highlightConfig), {}, {
56
+ text: children
57
+ })) : children);
51
58
  };
52
59
 
53
60
  Typography.propTypes = _propTypes.propTypes;
@@ -6,6 +6,8 @@ var _react2 = require("@testing-library/react");
6
6
 
7
7
  var _Typography = _interopRequireDefault(require("../Typography"));
8
8
 
9
+ var _Tag = _interopRequireDefault(require("../../Tag/Tag"));
10
+
9
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
12
 
11
13
  describe('Typography', function () {
@@ -227,6 +229,440 @@ describe('Typography', function () {
227
229
  }, "Heading")),
228
230
  asFragment = _render24.asFragment;
229
231
 
232
+ expect(asFragment()).toMatchSnapshot();
233
+ });
234
+ });
235
+ describe('Typography with highlight', function () {
236
+ test('should render highlighted word', function () {
237
+ var _render25 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
238
+ $ui_highlightConfig: {
239
+ data: ['sun'],
240
+ styleConfiguration: {
241
+ $ui_weight: 'bold'
242
+ }
243
+ }
244
+ }, "The sun was bright, the sun was warm, the sun was high in the sky.")),
245
+ asFragment = _render25.asFragment;
246
+
247
+ expect(asFragment()).toMatchSnapshot();
248
+ });
249
+ test('should render highlight by Index', function () {
250
+ var _render26 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
251
+ $ui_highlightConfig: {
252
+ data: [{
253
+ text: 'sun',
254
+ index: [1, 2]
255
+ }, {
256
+ text: 'under',
257
+ index: 1
258
+ }],
259
+ styleConfiguration: {
260
+ $ui_weight: 'bold',
261
+ $ui_decoration: 'underline'
262
+ }
263
+ }
264
+ }, "The sun was bright, I walked under the sun, I talked under the sun.")),
265
+ asFragment = _render26.asFragment;
266
+
267
+ expect(asFragment()).toMatchSnapshot();
268
+ });
269
+ test('should render separate Styles per Word', function () {
270
+ var _render27 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
271
+ $ui_highlightConfig: {
272
+ data: [{
273
+ text: 'sun',
274
+ styleConfiguration: {
275
+ $ui_weight: 'bold'
276
+ }
277
+ }, {
278
+ text: 'under',
279
+ styleConfiguration: {
280
+ $ui_decoration: 'underline'
281
+ }
282
+ }]
283
+ }
284
+ }, "The sun was bright, I walked under the sun, I talked under the sun.")),
285
+ asFragment = _render27.asFragment;
286
+
287
+ expect(asFragment()).toMatchSnapshot();
288
+ });
289
+ test('should render globally skip highlights at given indexes, with shouldExcludeIndices', function () {
290
+ var _render28 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
291
+ $ui_highlightConfig: {
292
+ data: [{
293
+ text: 'sun',
294
+ index: 1
295
+ }, {
296
+ text: 'moon',
297
+ index: [2, 3]
298
+ }],
299
+ shouldExcludeIndices: true,
300
+ styleConfiguration: {
301
+ $ui_weight: 'bold',
302
+ $ui_decoration: 'underline'
303
+ }
304
+ }
305
+ }, "The sun was bright, the sun was warm, the sun was high in the sky.")),
306
+ asFragment = _render28.asFragment;
307
+
308
+ expect(asFragment()).toMatchSnapshot();
309
+ });
310
+ test('should render with separate excluded index option per word', function () {
311
+ var _render29 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
312
+ $ui_highlightConfig: {
313
+ data: [{
314
+ text: 'sun',
315
+ index: 1,
316
+ shouldExcludeIndices: true
317
+ }, {
318
+ text: 'moon',
319
+ index: [2, 3],
320
+ shouldExcludeIndices: false
321
+ }],
322
+ styleConfiguration: {
323
+ $ui_weight: 'bold',
324
+ $ui_decoration: 'underline'
325
+ }
326
+ }
327
+ }, "The sun was bright, the moon was bright, the sun and moon again.")),
328
+ asFragment = _render29.asFragment;
329
+
330
+ expect(asFragment()).toMatchSnapshot();
331
+ });
332
+ test('should render with global tagName applied to all highlights', function () {
333
+ var _render30 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
334
+ $ui_highlightConfig: {
335
+ data: [{
336
+ text: 'sun'
337
+ }, {
338
+ text: 'moon'
339
+ }],
340
+ tagName: 'i'
341
+ }
342
+ }, "The sun and moon were bright.")),
343
+ asFragment = _render30.asFragment;
344
+
345
+ expect(asFragment()).toMatchSnapshot();
346
+ });
347
+ test('should render with separate tagName for each highlighted word', function () {
348
+ var _render31 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
349
+ $ui_highlightConfig: {
350
+ data: [{
351
+ text: 'sun',
352
+ tagName: 'i'
353
+ }, {
354
+ text: 'moon',
355
+ tagName: 'u'
356
+ }]
357
+ }
358
+ }, "The sun and moon were bright.")),
359
+ asFragment = _render31.asFragment;
360
+
361
+ expect(asFragment()).toMatchSnapshot();
362
+ });
363
+ test('should render with global case-sensitive option', function () {
364
+ var _render32 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
365
+ $ui_highlightConfig: {
366
+ data: [{
367
+ text: 'Sun'
368
+ }, {
369
+ text: 'moon'
370
+ }],
371
+ styleConfiguration: {
372
+ $ui_weight: 'bold',
373
+ $ui_decoration: 'underline'
374
+ },
375
+ isCaseSensitive: true
376
+ }
377
+ }, "The Sun was bright, the moon was bright, the sun was warm.")),
378
+ asFragment = _render32.asFragment;
379
+
380
+ expect(asFragment()).toMatchSnapshot();
381
+ });
382
+ test('should render with separate case-sensitive option per word', function () {
383
+ var _render33 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
384
+ $ui_highlightConfig: {
385
+ data: [{
386
+ text: 'Sun',
387
+ isCaseSensitive: true
388
+ }, {
389
+ text: 'Moon',
390
+ isCaseSensitive: false
391
+ }],
392
+ styleConfiguration: {
393
+ $ui_weight: 'bold',
394
+ $ui_decoration: 'underline'
395
+ }
396
+ }
397
+ }, "The Sun was bright, the Moon was bright, the sun was warm.")),
398
+ asFragment = _render33.asFragment;
399
+
400
+ expect(asFragment()).toMatchSnapshot();
401
+ });
402
+ test('should render with global whole-word match only', function () {
403
+ var _render34 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
404
+ $ui_highlightConfig: {
405
+ data: [{
406
+ text: 'Sun'
407
+ }, {
408
+ text: 'moon'
409
+ }],
410
+ styleConfiguration: {
411
+ $ui_weight: 'bold',
412
+ $ui_decoration: 'underline'
413
+ },
414
+ isWholeWord: true
415
+ }
416
+ }, "Sunflower is a flower. The Sun was bright, the moonlight was bright.")),
417
+ asFragment = _render34.asFragment;
418
+
419
+ expect(asFragment()).toMatchSnapshot();
420
+ });
421
+ test('should render with separate whole-word option per word', function () {
422
+ var _render35 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
423
+ $ui_highlightConfig: {
424
+ data: [{
425
+ text: 'Sun',
426
+ isWholeWord: true
427
+ }, {
428
+ text: 'moon',
429
+ isWholeWord: false
430
+ }],
431
+ styleConfiguration: {
432
+ $ui_weight: 'bold',
433
+ $ui_decoration: 'underline'
434
+ }
435
+ }
436
+ }, "Sunflower is a flower. The Sun was bright, the moonlight was bright.")),
437
+ asFragment = _render35.asFragment;
438
+
439
+ expect(asFragment()).toMatchSnapshot();
440
+ });
441
+ test('should render with global custom style for all highlights', function () {
442
+ var _render36 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
443
+ $ui_highlightConfig: {
444
+ data: [{
445
+ text: 'Sun'
446
+ }, {
447
+ text: 'moon'
448
+ }],
449
+ styleConfiguration: {
450
+ customStyle: {
451
+ backgroundColor: 'lightgreen'
452
+ }
453
+ }
454
+ }
455
+ }, "The sun and moon were bright.")),
456
+ asFragment = _render36.asFragment;
457
+
458
+ expect(asFragment()).toMatchSnapshot();
459
+ });
460
+ test('should render with separate custom style per word', function () {
461
+ var _render37 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
462
+ $ui_highlightConfig: {
463
+ data: [{
464
+ text: 'Sun',
465
+ styleConfiguration: {
466
+ customStyle: {
467
+ backgroundColor: 'lightgreen'
468
+ }
469
+ }
470
+ }, {
471
+ text: 'moon',
472
+ styleConfiguration: {
473
+ customStyle: {
474
+ backgroundColor: 'orange'
475
+ }
476
+ }
477
+ }]
478
+ }
479
+ }, "The sun and moon were bright.")),
480
+ asFragment = _render37.asFragment;
481
+
482
+ expect(asFragment()).toMatchSnapshot();
483
+ });
484
+ test('should render with global custom class for all highlights', function () {
485
+ var _render38 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
486
+ $ui_highlightConfig: {
487
+ data: [{
488
+ text: 'Sun'
489
+ }, {
490
+ text: 'moon'
491
+ }],
492
+ styleConfiguration: {
493
+ $ui_className: 'global_custom_class'
494
+ }
495
+ }
496
+ }, "The sun and moon were bright.")),
497
+ asFragment = _render38.asFragment;
498
+
499
+ expect(asFragment()).toMatchSnapshot();
500
+ });
501
+ test('should render with separate custom class for each highlighted word', function () {
502
+ var _render39 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
503
+ $ui_highlightConfig: {
504
+ data: [{
505
+ text: 'Sun',
506
+ styleConfiguration: {
507
+ $ui_className: 'separate_custom_class_sun'
508
+ }
509
+ }, {
510
+ text: 'moon',
511
+ styleConfiguration: {
512
+ $ui_className: 'separate_custom_class_moon'
513
+ }
514
+ }]
515
+ }
516
+ }, "The sun and moon were bright.")),
517
+ asFragment = _render39.asFragment;
518
+
519
+ expect(asFragment()).toMatchSnapshot();
520
+ });
521
+ test('should render customised render the highlight element for all highlighted words', function () {
522
+ var _render40 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
523
+ $ui_highlightConfig: {
524
+ data: [{
525
+ text: 'sun'
526
+ }],
527
+ renderHighlight: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
528
+ text: "Sun"
529
+ })
530
+ }
531
+ }, "The sun was bright.")),
532
+ asFragment = _render40.asFragment;
533
+
534
+ expect(asFragment()).toMatchSnapshot();
535
+ });
536
+ test('should render separate customised render the highlight element for each highlighted word', function () {
537
+ var _render41 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
538
+ $ui_highlightConfig: {
539
+ data: [{
540
+ text: 'Sun',
541
+ renderHighlight: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
542
+ text: "Sun"
543
+ })
544
+ }, {
545
+ text: 'moon',
546
+ renderHighlight: /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
547
+ text: "Moon"
548
+ })
549
+ }]
550
+ }
551
+ }, "The sun and moon were bright.")),
552
+ asFragment = _render41.asFragment;
553
+
554
+ expect(asFragment()).toMatchSnapshot();
555
+ });
556
+ test('should render for RegEx Characters check', function () {
557
+ var _render42 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
558
+ $ui_highlightConfig: {
559
+ data: [{
560
+ text: '$un'
561
+ }, {
562
+ text: 'm**n'
563
+ }],
564
+ styleConfiguration: {
565
+ customStyle: {
566
+ backgroundColor: 'lightgreen'
567
+ }
568
+ }
569
+ }
570
+ }, "The sun and moon were bright. and the m**n get sunlight from the $un, The Sun provides light to its nearby stars")),
571
+ asFragment = _render42.asFragment;
572
+
573
+ expect(asFragment()).toMatchSnapshot();
574
+ });
575
+ test('should render for combination of configuration check', function () {
576
+ var _render43 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
577
+ $ui_highlightConfig: {
578
+ data: [{
579
+ text: 'Sun',
580
+ index: 1,
581
+ shouldExcludeIndices: true,
582
+ isWholeWord: true,
583
+ isCaseSensitive: true
584
+ }],
585
+ styleConfiguration: {
586
+ customStyle: {
587
+ backgroundColor: 'lightgreen'
588
+ }
589
+ }
590
+ }
591
+ }, "The sun and moon were bright. and the moon get sunlight from the Sun, The Sun provides light to its nearby stars")),
592
+ asFragment = _render43.asFragment;
593
+
594
+ expect(asFragment()).toMatchSnapshot();
595
+ });
596
+ test('should render for priority based check - it priorities the global renderHighlight over the style configurations from the global', function () {
597
+ var _render44 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
598
+ $ui_highlightConfig: {
599
+ data: ['sunlight'],
600
+ styleConfiguration: {
601
+ $ui_decoration: 'underline'
602
+ },
603
+ renderHighlight: function renderHighlight(text) {
604
+ return /*#__PURE__*/_react["default"].createElement("a", {
605
+ href: "https://www.zoho.com",
606
+ target: "_blank",
607
+ rel: "noopener noreferrer"
608
+ }, " ", text, " ");
609
+ }
610
+ }
611
+ }, "1 Sun Moon 2 sun moon 3 sunmoon 4 SUN MOON 5 sun moon 6 sunlight moonlight")),
612
+ asFragment = _render44.asFragment;
613
+
614
+ expect(asFragment()).toMatchSnapshot();
615
+ });
616
+ test('should render for priority based check - it priorities the style configurations from the data object over the global renderHighlight', function () {
617
+ var _render45 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
618
+ $ui_highlightConfig: {
619
+ data: [{
620
+ text: 'sunlight',
621
+ styleConfiguration: {
622
+ $ui_decoration: 'underline'
623
+ }
624
+ }],
625
+ renderHighlight: function renderHighlight(text) {
626
+ return /*#__PURE__*/_react["default"].createElement("a", {
627
+ href: "https://www.zoho.com",
628
+ target: "_blank",
629
+ rel: "noopener noreferrer"
630
+ }, " ", text, " ");
631
+ }
632
+ }
633
+ }, "1 Sun Moon 2 sun moon 3 sunmoon 4 SUN MOON 5 sun moon 6 sunlight moonlight")),
634
+ asFragment = _render45.asFragment;
635
+
636
+ expect(asFragment()).toMatchSnapshot();
637
+ });
638
+ test('should render for priority based check - it priorities the renderHighlight from the data object over the global renderHighlight, global style configuration and style configuration from the data object', function () {
639
+ var _render46 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
640
+ $ui_highlightConfig: {
641
+ data: [{
642
+ text: 'sunlight',
643
+ styleConfiguration: {
644
+ $ui_decoration: 'underline'
645
+ },
646
+ renderHighlight: function renderHighlight(text) {
647
+ return /*#__PURE__*/_react["default"].createElement("b", null, " ", text, " ");
648
+ }
649
+ }],
650
+ styleConfiguration: {
651
+ customStyle: {
652
+ backgroundColor: 'lightgreen'
653
+ }
654
+ },
655
+ renderHighlight: function renderHighlight(text) {
656
+ return /*#__PURE__*/_react["default"].createElement("a", {
657
+ href: "https://www.zoho.com",
658
+ target: "_blank",
659
+ rel: "noopener noreferrer"
660
+ }, " ", text, " ");
661
+ }
662
+ }
663
+ }, "1 Sun Moon 2 sun moon 3 sunmoon 4 SUN MOON 5 sun moon 6 sunlight moonlight")),
664
+ asFragment = _render46.asFragment;
665
+
230
666
  expect(asFragment()).toMatchSnapshot();
231
667
  });
232
668
  });