@synerise/ds-utils 0.26.5 → 0.27.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.27.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@0.26.6...@synerise/ds-utils@0.27.0) (2024-05-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * **list-item:** added prefix, suffix, ordered props ([3927035](https://github.com/synerise/synerise-design/commit/39270352b6a681f3ac402edb6c2fb7a245883304))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.26.6](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@0.26.5...@synerise/ds-utils@0.26.6) (2024-05-16)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-utils
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.26.5](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@0.26.4...@synerise/ds-utils@0.26.5) (2024-05-10)
7
26
 
8
27
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as hexToRgba } from './hexToRgba/hexToRgba';
2
2
  export { default as toCamelCase } from './toCamelCase/toCamelCase';
3
3
  export { useOnClickOutside } from './useOnClickOutside/useOnClickOutside';
4
+ export { renderWithHighlight } from './renderWithHighlight/renderWithHighlight';
4
5
  export { default as selectColorByLetter } from './selectColorByLetter/selectColorByLetter';
5
6
  export { default as focusWithArrowKeys } from './focusWithArrowKeys/focusWithArrowKeys';
6
7
  export { default as escapeRegEx } from './regex/regex';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as hexToRgba } from './hexToRgba/hexToRgba';
2
2
  export { default as toCamelCase } from './toCamelCase/toCamelCase';
3
3
  export { useOnClickOutside } from './useOnClickOutside/useOnClickOutside';
4
+ export { renderWithHighlight } from './renderWithHighlight/renderWithHighlight';
4
5
  export { default as selectColorByLetter } from './selectColorByLetter/selectColorByLetter';
5
6
  export { default as focusWithArrowKeys } from './focusWithArrowKeys/focusWithArrowKeys';
6
7
  export { default as escapeRegEx } from './regex/regex';
@@ -0,0 +1,2 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const renderWithHighlight: (name: string, highlight?: string, className?: string, testId?: string) => ReactNode;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { escapeRegEx } from '../index';
3
+ export var renderWithHighlight = function renderWithHighlight(name, highlight, className, testId) {
4
+ if (className === void 0) {
5
+ className = 'string-highlight';
6
+ }
7
+
8
+ if (testId === void 0) {
9
+ testId = 'string-highlight';
10
+ }
11
+
12
+ if (!highlight || highlight === '') {
13
+ return name;
14
+ }
15
+
16
+ var index = name.toLocaleLowerCase().indexOf(highlight.toLocaleLowerCase());
17
+
18
+ if (index === -1) {
19
+ return name;
20
+ }
21
+
22
+ var escapedHighlight = escapeRegEx(highlight);
23
+ var startOfQuery = name.toLocaleLowerCase().search(escapedHighlight.toLowerCase());
24
+ var endOfQuery = startOfQuery + highlight.length;
25
+ var resultArray = [name.substring(0, startOfQuery), /*#__PURE__*/React.createElement("span", {
26
+ key: name,
27
+ className: className,
28
+ "data-testid": testId
29
+ }, name.substring(startOfQuery, endOfQuery)), name.substring(endOfQuery, name.length)];
30
+ return resultArray;
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-utils",
3
- "version": "0.26.5",
3
+ "version": "0.27.0",
4
4
  "description": "Utils UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,7 +32,7 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-data-format": "^0.4.9",
35
+ "@synerise/ds-data-format": "^0.5.0",
36
36
  "latinize": "^0.5.0"
37
37
  },
38
38
  "peerDependencies": {
@@ -43,5 +43,5 @@
43
43
  "devDependencies": {
44
44
  "@testing-library/react": "10.0.1"
45
45
  },
46
- "gitHead": "dea3898f262a7c333c6fd8ef806036ed4368bde7"
46
+ "gitHead": "6bd94c78745df68ee3b853120a863ab24fc233ef"
47
47
  }