@synerise/ds-utils 0.26.6 → 0.28.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,28 @@
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.28.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@0.27.0...@synerise/ds-utils@0.28.0) (2024-07-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * **badge:** added IconBadge ([4f44b60](https://github.com/synerise/synerise-design/commit/4f44b60b3eff77eb6c21b9ba0ec0cdf745100eff))
12
+
13
+
14
+
15
+
16
+
17
+ # [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)
18
+
19
+
20
+ ### Features
21
+
22
+ * **list-item:** added prefix, suffix, ordered props ([3927035](https://github.com/synerise/synerise-design/commit/39270352b6a681f3ac402edb6c2fb7a245883304))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [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)
7
29
 
8
30
  **Note:** Version bump only for package @synerise/ds-utils
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';
@@ -13,6 +14,7 @@ export { default as usePrevious } from './usePrevious/usePrevious';
13
14
  export { default as useElementInView } from './useElementInView/useElementInView';
14
15
  export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
15
16
  export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
17
+ export * from './omitKeys/omitKeys';
16
18
  export * from './useTraceUpdate';
17
19
  export * from './getPopupContainer';
18
20
  export declare const NOOP: () => void;
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';
@@ -13,6 +14,7 @@ export { default as usePrevious } from './usePrevious/usePrevious';
13
14
  export { default as useElementInView } from './useElementInView/useElementInView';
14
15
  export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
15
16
  export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
17
+ export * from './omitKeys/omitKeys';
16
18
  export * from './useTraceUpdate';
17
19
  export * from './getPopupContainer';
18
20
  export var NOOP = function NOOP() {}; // eslint-disable-line @typescript-eslint/no-empty-function
@@ -0,0 +1,3 @@
1
+ export declare const omitKeys: (keys: string[], obj: Record<string, unknown>) => {
2
+ [k: string]: unknown;
3
+ };
@@ -0,0 +1,6 @@
1
+ export var omitKeys = function omitKeys(keys, obj) {
2
+ return Object.fromEntries(Object.entries(obj).filter(function (_ref) {
3
+ var key = _ref[0];
4
+ return !keys.includes(key);
5
+ }));
6
+ };
@@ -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.6",
3
+ "version": "0.28.0",
4
4
  "description": "Utils UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,16 +32,13 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-data-format": "^0.5.0",
35
+ "@synerise/ds-data-format": "^0.5.1",
36
36
  "latinize": "^0.5.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@synerise/ds-core": "*",
40
- "react": ">=16.9.0 < 17.0.0",
40
+ "react": ">=16.9.0 <= 17.0.2",
41
41
  "styled-components": "5.0.1"
42
42
  },
43
- "devDependencies": {
44
- "@testing-library/react": "10.0.1"
45
- },
46
- "gitHead": "fc089bbf34c691a313b3fa648851d7831a23e3d0"
43
+ "gitHead": "6e5e5202d6c6f1c2caf6bfef799009813b437b3d"
47
44
  }