@synerise/ds-utils 1.3.1 → 1.4.1
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 +19 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/testing/renderWithProvider/renderWithProvider.d.ts +2 -1
- package/dist/testing/renderWithProvider/renderWithProvider.js +8 -5
- package/dist/types/types.d.ts +6 -0
- package/dist/useBreakpoint/useBreakpoint.d.ts +3 -2
- package/dist/useBreakpoint/useBreakpoint.js +1 -1
- package/dist/useIsMounted/useIsMounted.d.ts +0 -1
- package/dist/useLatestRef/useLatestRef.d.ts +0 -1
- package/dist/useOverscrollBlock/useOverscrollBlock.d.ts +0 -1
- package/dist/useResizeObserver/useResizeObserver.d.ts +1 -1
- package/dist/useResizeToFit/useResizeToFit.d.ts +0 -1
- package/dist/useScrollContain/useScrollContain.d.ts +0 -1
- package/dist/useSearchResults/search.utils.d.ts +3 -3
- package/dist/useSearchResults/search.utils.js +2 -2
- package/dist/useSearchResults/useSearchResults.d.ts +3 -3
- package/package.json +3 -3
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
|
+
## [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
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.4.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.3.1...@synerise/ds-utils@1.4.0) (2025-07-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **data-format:** conditionally apply timezone offset ([aa91c76](https://github.com/synerise/synerise-design/commit/aa91c76a88261745bbfd46e0a0dd779877931624))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.3.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.3.0...@synerise/ds-utils@1.3.1) (2025-07-01)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-utils
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { default as escapeRegEx } from './regex/regex';
|
|
|
8
8
|
export { default as doubleClickListener } from './doubleClickListener/doubleClickListener';
|
|
9
9
|
export { default as useResize } from './useResize/useResize';
|
|
10
10
|
export { default as useResizeObserver } from './useResizeObserver/useResizeObserver';
|
|
11
|
-
export
|
|
11
|
+
export * from './useBreakpoint/useBreakpoint';
|
|
12
12
|
export { default as useCombinedRefs } from './useCombinedRefs/useCombinedRefs';
|
|
13
13
|
export { default as usePrevious } from './usePrevious/usePrevious';
|
|
14
14
|
export { useIsMounted } from './useIsMounted/useIsMounted';
|
|
@@ -24,4 +24,4 @@ export * from './useTraceUpdate';
|
|
|
24
24
|
export * from './getPopupContainer';
|
|
25
25
|
export * from './useLatestRef';
|
|
26
26
|
export declare const NOOP: () => void;
|
|
27
|
-
export type { DataAttributes, ExactlyOne, LiteralStringUnion, WithHTMLAttributes, DeepPartial, RequiredProps, } from './types/types';
|
|
27
|
+
export type { DataAttributes, ExactlyOne, LiteralStringUnion, WithHTMLAttributes, DeepPartial, RequiredProps, ObjectStringKeys, } from './types/types';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export { default as escapeRegEx } from './regex/regex';
|
|
|
8
8
|
export { default as doubleClickListener } from './doubleClickListener/doubleClickListener';
|
|
9
9
|
export { default as useResize } from './useResize/useResize';
|
|
10
10
|
export { default as useResizeObserver } from './useResizeObserver/useResizeObserver';
|
|
11
|
-
export
|
|
11
|
+
export * from './useBreakpoint/useBreakpoint';
|
|
12
12
|
export { default as useCombinedRefs } from './useCombinedRefs/useCombinedRefs';
|
|
13
13
|
export { default as usePrevious } from './usePrevious/usePrevious';
|
|
14
14
|
export { useIsMounted } from './useIsMounted/useIsMounted';
|
|
@@ -3,7 +3,8 @@ import { type DSProviderProps } from '@synerise/ds-core';
|
|
|
3
3
|
import { type DataFormatNotationType } from '@synerise/ds-data-format';
|
|
4
4
|
import { type RenderOptions, type RenderResult } from '@testing-library/react';
|
|
5
5
|
type Options = Omit<RenderOptions, 'queries'>;
|
|
6
|
-
declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps,
|
|
6
|
+
declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps, "onErrorIntl" | "dataFormatConfig">> & {
|
|
7
7
|
notation?: DataFormatNotationType;
|
|
8
|
+
applyTimeZoneOffset?: boolean;
|
|
8
9
|
}) => RenderResult;
|
|
9
10
|
export default renderWithProvider;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["notation"];
|
|
1
|
+
var _excluded = ["notation", "applyTimeZoneOffset"];
|
|
2
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
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
4
|
import React from 'react';
|
|
@@ -9,12 +9,15 @@ import { NOOP } from '../../index';
|
|
|
9
9
|
var _renderWithProvider = function renderWithProvider(node, options, props) {
|
|
10
10
|
var _ref = props || {},
|
|
11
11
|
notation = _ref.notation,
|
|
12
|
+
applyTimeZoneOffset = _ref.applyTimeZoneOffset,
|
|
12
13
|
providerProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
14
|
+
var dataFormatConfigProps = applyTimeZoneOffset !== undefined || notation ? _extends({}, notation ? getDataFormatConfigFromNotation(notation) : {}, {
|
|
15
|
+
applyTimeZoneOffset: applyTimeZoneOffset
|
|
16
|
+
}) : {};
|
|
13
17
|
var rendered = render(/*#__PURE__*/React.createElement(DSProvider, _extends({
|
|
14
|
-
onErrorIntl: NOOP
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} : {}, providerProps), node), options);
|
|
18
|
+
onErrorIntl: NOOP,
|
|
19
|
+
dataFormatConfig: dataFormatConfigProps
|
|
20
|
+
}, providerProps), node), options);
|
|
18
21
|
return _extends({}, rendered, {
|
|
19
22
|
rerender: function rerender(ui, opt) {
|
|
20
23
|
return _renderWithProvider(ui, _extends({
|
package/dist/types/types.d.ts
CHANGED
|
@@ -20,3 +20,9 @@ export type DeepPartial<T> = T extends object ? {
|
|
|
20
20
|
* Makes selected props of the base type required
|
|
21
21
|
*/
|
|
22
22
|
export type RequiredProps<BaseType, PropName extends keyof BaseType> = Required<Pick<BaseType, PropName>> & Omit<BaseType, PropName>;
|
|
23
|
+
/**
|
|
24
|
+
* Literal string union of keys from object
|
|
25
|
+
*/
|
|
26
|
+
export type ObjectStringKeys<T> = {
|
|
27
|
+
[K in keyof T]: T[K] extends string ? K : never;
|
|
28
|
+
}[keyof T];
|
|
@@ -2,15 +2,16 @@ export type Dimensions = {
|
|
|
2
2
|
width: number;
|
|
3
3
|
height: number;
|
|
4
4
|
};
|
|
5
|
+
export type BreakpointKey = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
5
6
|
export type Breakpoint = {
|
|
6
7
|
min: number;
|
|
7
8
|
max: number;
|
|
8
9
|
columns: number;
|
|
9
|
-
name:
|
|
10
|
+
name: BreakpointKey;
|
|
10
11
|
};
|
|
11
12
|
export type DimensionsWithBreakpoint = {
|
|
12
13
|
dimensions: Dimensions;
|
|
13
14
|
breakpoint?: Breakpoint;
|
|
14
15
|
};
|
|
15
|
-
declare const useBreakpoint: () => DimensionsWithBreakpoint;
|
|
16
|
+
export declare const useBreakpoint: () => DimensionsWithBreakpoint;
|
|
16
17
|
export default useBreakpoint;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
declare const useResizeObserver: (elementRef: RefObject<HTMLElement | undefined>, resizeHandler?: (
|
|
2
|
+
declare const useResizeObserver: (elementRef: RefObject<HTMLElement | undefined>, resizeHandler?: (dimensions: DOMRect) => void) => DOMRect;
|
|
3
3
|
export default useResizeObserver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactText } from 'react';
|
|
2
2
|
import { type BaseGroupType } from './useSearchResults';
|
|
3
|
-
export declare const isItemInGroup: <GroupType extends BaseGroupType<GroupType>>(groupId?: ReactText, currentGroup?: GroupType
|
|
4
|
-
export declare const getActiveTabGroup: <GroupType extends BaseGroupType<GroupType>>(tabIndex: number, groups?: GroupType[]
|
|
5
|
-
export declare const getGroupName: <GroupType extends BaseGroupType<GroupType>>(groupId: ReactText, groups: BaseGroupType<GroupType>[]) => string | undefined;
|
|
3
|
+
export declare const isItemInGroup: <GroupType extends BaseGroupType<GroupType>>(groupId?: ReactText, currentGroup?: GroupType) => boolean;
|
|
4
|
+
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;
|
|
@@ -11,9 +11,9 @@ export var getActiveTabGroup = function getActiveTabGroup(tabIndex, groups) {
|
|
|
11
11
|
};
|
|
12
12
|
export var getGroupName = function getGroupName(groupId, groups) {
|
|
13
13
|
var _groups$flatMap$find;
|
|
14
|
-
return (_groups$flatMap$find = groups.flatMap(function (group) {
|
|
14
|
+
return groupId ? (_groups$flatMap$find = groups.flatMap(function (group) {
|
|
15
15
|
return group.subGroups ? group.subGroups : group;
|
|
16
16
|
}).find(function (group) {
|
|
17
17
|
return group.id === groupId;
|
|
18
|
-
})) == null ? void 0 : _groups$flatMap$find.name;
|
|
18
|
+
})) == null ? void 0 : _groups$flatMap$find.name : undefined;
|
|
19
19
|
};
|
|
@@ -10,8 +10,8 @@ export type BaseGroupType<SubGroupType> = {
|
|
|
10
10
|
name: string;
|
|
11
11
|
subGroups?: SubGroupType[];
|
|
12
12
|
};
|
|
13
|
-
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
|
|
13
|
+
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
14
|
searchResults: GroupedListItemType[];
|
|
15
|
-
getActiveTabGroup: <GroupType_1 extends BaseGroupType<GroupType_1>>(tabIndex: number, groups?: GroupType_1[]
|
|
16
|
-
getGroupName: <
|
|
15
|
+
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;
|
|
17
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Utils UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"types": "dist/index.d.ts",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@synerise/ds-data-format": "^1.
|
|
36
|
+
"@synerise/ds-data-format": "^1.1.1",
|
|
37
37
|
"latinize": "^0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react": ">=16.9.0 <= 18.3.1",
|
|
42
42
|
"styled-components": "^5.3.3"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "5f5d424cf8c7fa89e231c36a45f5ab3e4cfac8e7"
|
|
45
45
|
}
|