@wordpress/dataviews 15.0.0 → 16.0.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 +6 -0
- package/build/components/dataform-controls/datetime.cjs.map +2 -2
- package/build/components/dataviews-context/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/use-scroll-state.cjs.map +1 -1
- package/build/components/dataviews-layouts/utils/item-click-wrapper.cjs.map +2 -2
- package/build/hooks/use-form-validity.cjs.map +1 -1
- package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
- package/build-module/components/dataviews-context/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/use-scroll-state.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs.map +2 -2
- package/build-module/hooks/use-form-validity.mjs.map +1 -1
- package/build-types/components/dataviews-context/index.d.ts +2 -2
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts +5 -9
- package/build-types/components/dataviews-layouts/table/use-scroll-state.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/utils/item-click-wrapper.d.ts.map +1 -1
- package/build-wp/index.js +106 -118
- package/package.json +18 -18
- package/src/components/dataform-controls/datetime.tsx +1 -1
- package/src/components/dataviews-context/index.ts +4 -2
- package/src/components/dataviews-layouts/table/use-scroll-state.ts +6 -6
- package/src/components/dataviews-layouts/utils/item-click-wrapper.tsx +1 -3
- package/src/hooks/use-form-validity.ts +2 -2
|
@@ -46,8 +46,10 @@ type DataViewsContextType< Item > = {
|
|
|
46
46
|
) => ReactElement;
|
|
47
47
|
isItemClickable: ( item: Item ) => boolean;
|
|
48
48
|
containerWidth: number;
|
|
49
|
-
containerRef: React.
|
|
50
|
-
resizeObserverRef:
|
|
49
|
+
containerRef: React.MutableRefObject< HTMLDivElement | null >;
|
|
50
|
+
resizeObserverRef:
|
|
51
|
+
| ( ( element?: HTMLDivElement | null ) => void )
|
|
52
|
+
| React.RefObject< HTMLDivElement >;
|
|
51
53
|
defaultLayouts: NormalizedSupportedLayouts;
|
|
52
54
|
filters: NormalizedFilter[];
|
|
53
55
|
isShowingFilter: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { MutableRefObject } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -30,16 +30,16 @@ const isScrolledToEnd = ( element: Element ) => {
|
|
|
30
30
|
*
|
|
31
31
|
* See https://github.com/Automattic/wp-calypso/pull/103005#discussion_r2077567912.
|
|
32
32
|
*
|
|
33
|
-
* @param params The parameters for the hook.
|
|
34
|
-
* @param params.scrollContainerRef The ref to the scroll container element.
|
|
35
|
-
* @param [params.enabledHorizontal=false] Whether to track horizontal scroll end.
|
|
36
|
-
* @return
|
|
33
|
+
* @param {Object} params The parameters for the hook.
|
|
34
|
+
* @param {MutableRefObject<HTMLDivElement | null>} params.scrollContainerRef The ref to the scroll container element.
|
|
35
|
+
* @param {boolean} [params.enabledHorizontal=false] Whether to track horizontal scroll end.
|
|
36
|
+
* @return {{ isHorizontalScrollEnd: boolean, isVerticallyScrolled: boolean }} The scroll state.
|
|
37
37
|
*/
|
|
38
38
|
export function useScrollState( {
|
|
39
39
|
scrollContainerRef,
|
|
40
40
|
enabledHorizontal = false,
|
|
41
41
|
}: {
|
|
42
|
-
scrollContainerRef:
|
|
42
|
+
scrollContainerRef: React.MutableRefObject< HTMLDivElement | null >;
|
|
43
43
|
enabledHorizontal?: boolean;
|
|
44
44
|
} ): { isHorizontalScrollEnd: boolean; isVerticallyScrolled: boolean } {
|
|
45
45
|
const [ isHorizontalScrollEnd, setIsHorizontalScrollEnd ] =
|
|
@@ -86,9 +86,7 @@ export function ItemClickWrapper< Item >( {
|
|
|
86
86
|
className: `${ className } ${ className }--clickable`,
|
|
87
87
|
...extraProps,
|
|
88
88
|
children,
|
|
89
|
-
} )
|
|
90
|
-
Pick< React.DOMAttributes< Element >, 'onClick' | 'onKeyDown' >
|
|
91
|
-
>;
|
|
89
|
+
} );
|
|
92
90
|
|
|
93
91
|
// Clone the element and enhance onClick to stop propagation
|
|
94
92
|
return cloneElement( renderedElement, {
|
|
@@ -392,8 +392,8 @@ function handleCustomValidationAsync< Item >(
|
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
type PromiseHandler< Item > = {
|
|
395
|
-
customCounterRef: React.
|
|
396
|
-
elementsCounterRef: React.
|
|
395
|
+
customCounterRef: React.MutableRefObject< Record< string, number > >;
|
|
396
|
+
elementsCounterRef: React.MutableRefObject< Record< string, number > >;
|
|
397
397
|
setFormValidity: React.Dispatch< React.SetStateAction< FormValidity > >;
|
|
398
398
|
path: string[];
|
|
399
399
|
item: Item;
|