@synerise/ds-utils 1.4.1 → 1.4.2

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,14 @@
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
+ ## [1.4.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.4.1...@synerise/ds-utils@1.4.2) (2025-09-16)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-utils
9
+
10
+
11
+
12
+
13
+
6
14
  ## [1.4.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.4.0...@synerise/ds-utils@1.4.1) (2025-08-28)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-utils
package/dist/index.d.ts CHANGED
@@ -15,7 +15,6 @@ export { useIsMounted } from './useIsMounted/useIsMounted';
15
15
  export { default as useElementInView } from './useElementInView/useElementInView';
16
16
  export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
17
17
  export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
18
- export * from './testing';
19
18
  export * from './useScrollContain/useScrollContain';
20
19
  export * from './useSearchResults';
21
20
  export * from './useKeyboardShortcuts/useKeyboardShortcuts';
package/dist/index.js CHANGED
@@ -15,7 +15,6 @@ export { useIsMounted } from './useIsMounted/useIsMounted';
15
15
  export { default as useElementInView } from './useElementInView/useElementInView';
16
16
  export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
17
17
  export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
18
- export * from './testing';
19
18
  export * from './useScrollContain/useScrollContain';
20
19
  export * from './useSearchResults';
21
20
  export * from './useKeyboardShortcuts/useKeyboardShortcuts';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { escapeRegEx } from '../index';
2
+ import escapeRegEx from '../regex/regex';
3
3
  export var renderWithHighlight = function renderWithHighlight(name, highlight, className, testId) {
4
4
  if (className === void 0) {
5
5
  className = 'string-highlight';
@@ -1,5 +1,4 @@
1
- import { type ReactText } from 'react';
2
- import { type BaseGroupType } from './useSearchResults';
3
- export declare const isItemInGroup: <GroupType extends BaseGroupType<GroupType>>(groupId?: ReactText, currentGroup?: GroupType) => boolean;
1
+ import { type BaseGroupType } from './types';
2
+ export declare const isItemInGroup: <GroupType extends BaseGroupType<GroupType>>(groupId?: string | number, currentGroup?: GroupType) => boolean;
4
3
  export declare const getActiveTabGroup: <GroupType extends BaseGroupType<GroupType>>(tabIndex: number, groups?: GroupType[]) => GroupType | undefined;
5
- export declare const getGroupName: <GroupType extends BaseGroupType<GroupType>>(groupId: ReactText | undefined, groups: BaseGroupType<GroupType>[]) => string | undefined;
4
+ export declare const getGroupName: <GroupType extends BaseGroupType<GroupType>>(groupId: string | number | undefined, groups: BaseGroupType<GroupType>[]) => string | undefined;
@@ -0,0 +1,11 @@
1
+ export type BaseItemType = {
2
+ id: string | number | null;
3
+ groupId?: string | number;
4
+ subtitle?: string;
5
+ name: string;
6
+ };
7
+ export type BaseGroupType<SubGroupType> = {
8
+ id: string | number;
9
+ name: string;
10
+ subGroups?: SubGroupType[];
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,17 +1,6 @@
1
- import { type ReactText } from 'react';
2
- export type BaseItemType = {
3
- id: ReactText | null;
4
- groupId?: ReactText;
5
- subtitle?: string;
6
- name: string;
7
- };
8
- export type BaseGroupType<SubGroupType> = {
9
- id: ReactText;
10
- name: string;
11
- subGroups?: SubGroupType[];
12
- };
1
+ import { type BaseGroupType, type BaseItemType } from './types';
13
2
  export declare const useSearchResults: <ItemType extends BaseItemType, GroupType extends BaseGroupType<GroupType>, GroupedListItemType>(items: ItemType[], groups: GroupType[], activeTab: number, groupByGroupName: (items: ItemType[], max?: number) => GroupedListItemType[], activeGroup?: GroupType, searchQuery?: string, maxSearchResultsInGroup?: number) => {
14
3
  searchResults: GroupedListItemType[];
15
4
  getActiveTabGroup: <GroupType_1 extends BaseGroupType<GroupType_1>>(tabIndex: number, groups?: GroupType_1[]) => GroupType_1 | undefined;
16
- getGroupName: <GroupType_1 extends BaseGroupType<GroupType_1>>(groupId: ReactText | undefined, groups: BaseGroupType<GroupType_1>[]) => string | undefined;
5
+ getGroupName: <GroupType_1 extends BaseGroupType<GroupType_1>>(groupId: string | number | undefined, groups: BaseGroupType<GroupType_1>[]) => string | undefined;
17
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-utils",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Utils UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -25,6 +25,7 @@
25
25
  "prepublish": "npm run build",
26
26
  "test": "jest",
27
27
  "types": "tsc --noEmit",
28
+ "check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
28
29
  "upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
29
30
  },
30
31
  "sideEffects": [
@@ -33,13 +34,12 @@
33
34
  ],
34
35
  "types": "dist/index.d.ts",
35
36
  "dependencies": {
36
- "@synerise/ds-data-format": "^1.1.1",
37
37
  "latinize": "^0.5.0"
38
38
  },
39
39
  "peerDependencies": {
40
- "@synerise/ds-core": "*",
40
+ "@synerise/ds-core": "^1",
41
41
  "react": ">=16.9.0 <= 18.3.1",
42
42
  "styled-components": "^5.3.3"
43
43
  },
44
- "gitHead": "5f5d424cf8c7fa89e231c36a45f5ab3e4cfac8e7"
44
+ "gitHead": "5beb6ab5f2d77b9e98e04caab7dff20b8436078b"
45
45
  }
@@ -1,2 +0,0 @@
1
- export { default as renderWithProvider } from './renderWithProvider/renderWithProvider';
2
- export { sleep } from './sleep';
@@ -1,2 +0,0 @@
1
- export { default as renderWithProvider } from './renderWithProvider/renderWithProvider';
2
- export { sleep } from './sleep';
@@ -1,10 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import { type DSProviderProps } from '@synerise/ds-core';
3
- import { type DataFormatNotationType } from '@synerise/ds-data-format';
4
- import { type RenderOptions, type RenderResult } from '@testing-library/react';
5
- type Options = Omit<RenderOptions, 'queries'>;
6
- declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps, "onErrorIntl" | "dataFormatConfig">> & {
7
- notation?: DataFormatNotationType;
8
- applyTimeZoneOffset?: boolean;
9
- }) => RenderResult;
10
- export default renderWithProvider;
@@ -1,29 +0,0 @@
1
- var _excluded = ["notation", "applyTimeZoneOffset"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React from 'react';
5
- import { DSProvider } from '@synerise/ds-core';
6
- import { getDataFormatConfigFromNotation } from '@synerise/ds-data-format';
7
- import { render } from '@testing-library/react';
8
- import { NOOP } from '../../index';
9
- var _renderWithProvider = function renderWithProvider(node, options, props) {
10
- var _ref = props || {},
11
- notation = _ref.notation,
12
- applyTimeZoneOffset = _ref.applyTimeZoneOffset,
13
- providerProps = _objectWithoutPropertiesLoose(_ref, _excluded);
14
- var dataFormatConfigProps = applyTimeZoneOffset !== undefined || notation ? _extends({}, notation ? getDataFormatConfigFromNotation(notation) : {}, {
15
- applyTimeZoneOffset: applyTimeZoneOffset
16
- }) : {};
17
- var rendered = render(/*#__PURE__*/React.createElement(DSProvider, _extends({
18
- onErrorIntl: NOOP,
19
- dataFormatConfig: dataFormatConfigProps
20
- }, providerProps), node), options);
21
- return _extends({}, rendered, {
22
- rerender: function rerender(ui, opt) {
23
- return _renderWithProvider(ui, _extends({
24
- container: rendered.container
25
- }, opt));
26
- }
27
- });
28
- };
29
- export default _renderWithProvider;
@@ -1 +0,0 @@
1
- export declare const sleep: (duration?: number) => Promise<unknown>;
@@ -1,8 +0,0 @@
1
- export var sleep = function sleep(duration) {
2
- if (duration === void 0) {
3
- duration = 1000;
4
- }
5
- return new Promise(function (resolve) {
6
- return setTimeout(resolve, duration);
7
- });
8
- };