@synerise/ds-utils 1.1.0 → 1.2.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 +24 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -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/useResizeObserver/useResizeObserver.js +10 -3
- 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,30 @@
|
|
|
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.2.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-utils@1.1.1...@synerise/ds-utils@1.2.0) (2025-06-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **factors:** relative date type ([e3d17f1](https://github.com/synerise/synerise-design/commit/e3d17f18350044322c06c6b51263d69f97ee7dba))
|
|
12
|
+
* **filter:** change dnd lib and update ux ([f5a979e](https://github.com/synerise/synerise-design/commit/f5a979e6c9e5d9c8251c3f57da8ce57c416dadab))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [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)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* **core:** make translation imports static ([76df190](https://github.com/synerise/synerise-design/commit/76df19067366d42ab324eeb25c6b7418991b2d6b))
|
|
24
|
+
* **item-picker:** invoke latest loadItems function on refresh ([f358c0a](https://github.com/synerise/synerise-design/commit/f358c0ac4ccefb6ed51f7ad641376a80c70a1fa4))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [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)
|
|
7
31
|
|
|
8
32
|
|
package/dist/index.d.ts
CHANGED
|
@@ -14,12 +14,14 @@ export { default as usePrevious } from './usePrevious/usePrevious';
|
|
|
14
14
|
export { default as useElementInView } from './useElementInView/useElementInView';
|
|
15
15
|
export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
|
|
16
16
|
export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
|
|
17
|
+
export * from './testing';
|
|
17
18
|
export * from './useScrollContain/useScrollContain';
|
|
18
19
|
export * from './useSearchResults';
|
|
19
20
|
export * from './useKeyboardShortcuts/useKeyboardShortcuts';
|
|
20
21
|
export * from './omitKeys/omitKeys';
|
|
21
22
|
export * from './useTraceUpdate';
|
|
22
23
|
export * from './getPopupContainer';
|
|
24
|
+
export * from './useLatestRef';
|
|
23
25
|
export declare const NOOP: () => void;
|
|
24
26
|
export type { HandledEventsType } from './useOnClickOutside/useOnClickOutside';
|
|
25
27
|
export type { DataAttributes, ExactlyOne, LiteralStringUnion, WithHTMLAttributes, DeepPartial, RequiredProps, } from './types/types';
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,12 @@ export { default as usePrevious } from './usePrevious/usePrevious';
|
|
|
14
14
|
export { default as useElementInView } from './useElementInView/useElementInView';
|
|
15
15
|
export { default as useOverscrollBlock } from './useOverscrollBlock/useOverscrollBlock';
|
|
16
16
|
export { default as useResizeToFit } from './useResizeToFit/useResizeToFit';
|
|
17
|
+
export * from './testing';
|
|
17
18
|
export * from './useScrollContain/useScrollContain';
|
|
18
19
|
export * from './useSearchResults';
|
|
19
20
|
export * from './useKeyboardShortcuts/useKeyboardShortcuts';
|
|
20
21
|
export * from './omitKeys/omitKeys';
|
|
21
22
|
export * from './useTraceUpdate';
|
|
22
23
|
export * from './getPopupContainer';
|
|
24
|
+
export * from './useLatestRef';
|
|
23
25
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLatestRef';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLatestRef';
|
|
@@ -4,9 +4,16 @@ var useResizeObserver = function useResizeObserver(elementRef, resizeHandler) {
|
|
|
4
4
|
dimensions = _useState[0],
|
|
5
5
|
setDimensions = _useState[1];
|
|
6
6
|
var resizeObserver = useRef(new ResizeObserver(function (entries) {
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
var runHandler = function runHandler() {
|
|
8
|
+
var contentRect = entries[0].contentRect;
|
|
9
|
+
setDimensions(contentRect);
|
|
10
|
+
resizeHandler && resizeHandler(contentRect);
|
|
11
|
+
};
|
|
12
|
+
if ('requestAnimationFrame' in window) {
|
|
13
|
+
window.requestAnimationFrame(runHandler);
|
|
14
|
+
} else {
|
|
15
|
+
setTimeout(runHandler, 0);
|
|
16
|
+
}
|
|
10
17
|
})).current;
|
|
11
18
|
var observe = useCallback(function () {
|
|
12
19
|
elementRef.current && resizeObserver.observe(elementRef.current);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
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": "93bc81d59d20bc8f3bc80c5d56ae7f7c0838380d"
|
|
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() { 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
|
-
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;
|