@synerise/ds-utils 1.0.1 → 1.1.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 +29 -0
- package/dist/focusWithArrowKeys/focusWithArrowKeys.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -1
- package/dist/testing/renderWithProvider/renderWithProvider.d.ts +2 -4
- package/dist/testing/renderWithProvider/renderWithProvider.js +14 -13
- package/dist/types/types.d.ts +6 -1
- package/dist/useBreakpoint/useBreakpoint.js +1 -1
- package/dist/useElementInView/useElementInView.js +1 -1
- package/dist/useLatestRef/index.d.ts +1 -0
- package/dist/useLatestRef/index.js +1 -0
- package/dist/useLatestRef/useLatestRef.d.ts +2 -0
- package/dist/useLatestRef/useLatestRef.js +8 -0
- package/dist/useSearchResults/useSearchResults.js +1 -1
- package/package.json +2 -2
- package/dist/testing/renderWithLocalesLoaded/renderWithLocalesLoaded.d.ts +0 -10
- package/dist/testing/renderWithLocalesLoaded/renderWithLocalesLoaded.js +0 -30
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.1.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.1.0...@synerise/ds-utils@1.1.1) (2025-05-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **core:** make translation imports static ([76df190](https://github.com/synerise/synerise-design/commit/76df19067366d42ab324eeb25c6b7418991b2d6b))
|
|
12
|
+
* **item-picker:** invoke latest loadItems function on refresh ([f358c0a](https://github.com/synerise/synerise-design/commit/f358c0ac4ccefb6ed51f7ad641376a80c70a1fa4))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [1.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.0.1...@synerise/ds-utils@1.1.0) (2025-05-07)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **item-picker:** focus in search on section change ([9b41649](https://github.com/synerise/synerise-design/commit/9b416499c0cb2fa78447eb5769ae9f9a0f35b6d4))
|
|
24
|
+
* **table:** update batch selection for table with limit ([a63698a](https://github.com/synerise/synerise-design/commit/a63698adf24e59aa3b220f3840ecdc43d60d62a5))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* **toast:** toast component ([0cb20d0](https://github.com/synerise/synerise-design/commit/0cb20d07b48d1c768a0ddf133b1970a4a13444ca))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
6
35
|
## [1.0.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.0.0...@synerise/ds-utils@1.0.1) (2025-03-18)
|
|
7
36
|
|
|
8
37
|
**Note:** Version bump only for package @synerise/ds-utils
|
|
@@ -31,6 +31,8 @@ var focusWithArrowKeys = function focusWithArrowKeys(keyDownEvent, focusableItem
|
|
|
31
31
|
if (isItemFocused) {
|
|
32
32
|
var prevSibling = activeElement.previousElementSibling;
|
|
33
33
|
_elementToFocusOn = prevSibling !== null && hasFocusableElementInside(prevSibling, selector) ? prevSibling : focusableElements[activeElementIndex - 1];
|
|
34
|
+
} else {
|
|
35
|
+
_elementToFocusOn = focusableElements[focusableElements.length - 1];
|
|
34
36
|
}
|
|
35
37
|
if (_elementToFocusOn) {
|
|
36
38
|
_elementToFocusOn.focus();
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from './useKeyboardShortcuts/useKeyboardShortcuts';
|
|
|
20
20
|
export * from './omitKeys/omitKeys';
|
|
21
21
|
export * from './useTraceUpdate';
|
|
22
22
|
export * from './getPopupContainer';
|
|
23
|
+
export * from './useLatestRef';
|
|
23
24
|
export declare const NOOP: () => void;
|
|
24
25
|
export type { HandledEventsType } from './useOnClickOutside/useOnClickOutside';
|
|
25
|
-
export type { ExactlyOne, LiteralStringUnion, WithHTMLAttributes, DeepPartial } from './types/types';
|
|
26
|
+
export type { DataAttributes, ExactlyOne, LiteralStringUnion, WithHTMLAttributes, DeepPartial, RequiredProps, } from './types/types';
|
package/dist/index.js
CHANGED
|
@@ -20,4 +20,5 @@ export * from './useKeyboardShortcuts/useKeyboardShortcuts';
|
|
|
20
20
|
export * from './omitKeys/omitKeys';
|
|
21
21
|
export * from './useTraceUpdate';
|
|
22
22
|
export * from './getPopupContainer';
|
|
23
|
+
export * from './useLatestRef';
|
|
23
24
|
export var NOOP = function NOOP() {}; // eslint-disable-line @typescript-eslint/no-empty-function
|
package/dist/testing/index.d.ts
CHANGED
package/dist/testing/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
// eslint-disable-next-line import/prefer-default-export
|
|
2
2
|
export { default as renderWithProvider } from './renderWithProvider/renderWithProvider';
|
|
3
|
-
export { default as renderWithLocalesLoaded } from './renderWithLocalesLoaded/renderWithLocalesLoaded';
|
|
4
3
|
export { sleep } from './sleep';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
3
|
+
import { DSProviderProps } from '@synerise/ds-core';
|
|
3
4
|
import { DataFormatNotationType } from '@synerise/ds-data-format';
|
|
4
5
|
type Options = Omit<RenderOptions, 'queries'>;
|
|
5
|
-
declare const renderWithProvider: (node: ReactNode, options?: Options, props?: {
|
|
6
|
-
locale?: string;
|
|
6
|
+
declare const renderWithProvider: (node: ReactNode, options?: Options, props?: Partial<Omit<DSProviderProps, 'onErrorIntl' | 'dataFormatConfig'>> & {
|
|
7
7
|
notation?: DataFormatNotationType;
|
|
8
|
-
timeZone?: string;
|
|
9
|
-
onDSLocalesLoaded?: () => void;
|
|
10
8
|
}) => RenderResult;
|
|
11
9
|
export default renderWithProvider;
|
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
var _excluded = ["notation"];
|
|
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; }
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { render } from '@testing-library/react';
|
|
4
6
|
import { DSProvider } from '@synerise/ds-core';
|
|
5
7
|
import { getDataFormatConfigFromNotation } from '@synerise/ds-data-format';
|
|
6
8
|
import { NOOP } from '../../index';
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} : {}), node), options);
|
|
9
|
+
var _renderWithProvider = function renderWithProvider(node, options, props) {
|
|
10
|
+
var _ref = props || {},
|
|
11
|
+
notation = _ref.notation,
|
|
12
|
+
providerProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
13
|
+
var rendered = render(/*#__PURE__*/React.createElement(DSProvider, _extends({
|
|
14
|
+
onErrorIntl: NOOP
|
|
15
|
+
}, notation ? {
|
|
16
|
+
dataFormatConfig: getDataFormatConfigFromNotation(notation)
|
|
17
|
+
} : {}, providerProps), node), options);
|
|
17
18
|
return _extends({}, rendered, {
|
|
18
19
|
rerender: function rerender(ui, opt) {
|
|
19
|
-
return
|
|
20
|
+
return _renderWithProvider(ui, _extends({
|
|
20
21
|
container: rendered.container
|
|
21
22
|
}, opt));
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
25
|
};
|
|
25
|
-
export default
|
|
26
|
+
export default _renderWithProvider;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,7 +11,12 @@ export type ExactlyOne<T, U> = (T & {
|
|
|
11
11
|
}) | (U & {
|
|
12
12
|
[K in keyof T]?: never;
|
|
13
13
|
});
|
|
14
|
-
export type
|
|
14
|
+
export type DataAttributes = Record<`data-${string}`, string>;
|
|
15
|
+
export type WithHTMLAttributes<ElementType extends HTMLElement, BaseType> = BaseType & Omit<HTMLAttributes<ElementType>, keyof BaseType> & DataAttributes;
|
|
15
16
|
export type DeepPartial<T> = T extends object ? {
|
|
16
17
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
17
18
|
} : T;
|
|
19
|
+
/**
|
|
20
|
+
* Makes selected props of the base type required
|
|
21
|
+
*/
|
|
22
|
+
export type RequiredProps<BaseType, PropName extends keyof BaseType> = Required<Pick<BaseType, PropName>> & Omit<BaseType, PropName>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1
|
+
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); }
|
|
2
2
|
import React from 'react';
|
|
3
3
|
var BREAKPOINTS = {
|
|
4
4
|
xxl: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1
|
+
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); }
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
var useElementInView = function useElementInView(options, rootElementRef) {
|
|
4
4
|
var elementRef = useRef(null);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLatestRef';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLatestRef';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
1
|
+
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); }
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { getActiveTabGroup, getGroupName, isItemInGroup } from './search.utils';
|
|
4
4
|
export var useSearchResults = function useSearchResults(items, groups, activeTab, groupByGroupName, activeGroup, searchQuery, maxSearchResultsInGroup) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Utils UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -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": "9e9cc54e3690b4d51323f91c81b3b79305984da6"
|
|
45
45
|
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
3
|
-
import { DataFormatNotationType } from '@synerise/ds-data-format';
|
|
4
|
-
type Options = Omit<RenderOptions, 'queries'>;
|
|
5
|
-
declare const renderWithLocalesLoaded: (node: ReactNode, options?: Options, props?: {
|
|
6
|
-
locale?: string;
|
|
7
|
-
notation?: DataFormatNotationType;
|
|
8
|
-
timeZone?: string;
|
|
9
|
-
}) => Promise<RenderResult>;
|
|
10
|
-
export default renderWithLocalesLoaded;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { render } from '@testing-library/react';
|
|
4
|
-
import { DSProvider } from '@synerise/ds-core';
|
|
5
|
-
import { getDataFormatConfigFromNotation } from '@synerise/ds-data-format';
|
|
6
|
-
import renderWithProvider from '../renderWithProvider/renderWithProvider';
|
|
7
|
-
import { NOOP } from '../../index';
|
|
8
|
-
var renderWithLocalesLoaded = function renderWithLocalesLoaded(node, options, props) {
|
|
9
|
-
return new Promise(function (resolve) {
|
|
10
|
-
var _props$locale, _props$timeZone;
|
|
11
|
-
var onDSLocalesLoaded = function onDSLocalesLoaded() {
|
|
12
|
-
return resolve(_extends({}, rendered, {
|
|
13
|
-
rerender: function rerender(ui, opt) {
|
|
14
|
-
return renderWithProvider(ui, _extends({
|
|
15
|
-
container: rendered.container
|
|
16
|
-
}, opt));
|
|
17
|
-
}
|
|
18
|
-
}));
|
|
19
|
-
};
|
|
20
|
-
var rendered = render( /*#__PURE__*/React.createElement(DSProvider, _extends({
|
|
21
|
-
locale: (_props$locale = props == null ? void 0 : props.locale) != null ? _props$locale : undefined,
|
|
22
|
-
onErrorIntl: NOOP,
|
|
23
|
-
onDSLocalesLoaded: onDSLocalesLoaded,
|
|
24
|
-
timeZone: (_props$timeZone = props == null ? void 0 : props.timeZone) != null ? _props$timeZone : undefined
|
|
25
|
-
}, props != null && props.notation ? {
|
|
26
|
-
dataFormatConfig: getDataFormatConfigFromNotation(props.notation)
|
|
27
|
-
} : {}), node), options);
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
export default renderWithLocalesLoaded;
|