@codeleap/web 3.12.6 → 3.12.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/web",
3
- "version": "3.12.6",
3
+ "version": "3.12.8",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -99,7 +99,7 @@ export const Drawer = (props: DrawerProps) => {
99
99
  closeIcon,
100
100
  } = allProps as DrawerProps
101
101
 
102
- usePopState(open, toggle, scrollLocked)
102
+ // usePopState(open, toggle, scrollLocked)
103
103
 
104
104
  const [hiddenStyle, axis, positioning] = resolveHiddenDrawerPosition(position)
105
105
 
@@ -5,7 +5,7 @@ import { EmptyPlaceholder } from '../EmptyPlaceholder'
5
5
  import { GridPresets } from './styles'
6
6
  import { GridProps } from './types'
7
7
  import { ListLayout, useInfiniteScroll } from '../List'
8
- import { ItemMasonryProps, ListMasonry } from '../../lib'
8
+ import { ItemMasonryProps, ListMasonry, useMasonryReload } from '../../lib'
9
9
 
10
10
  export * from './styles'
11
11
  export * from './types'
@@ -31,6 +31,7 @@ const defaultProps: Partial<GridProps> = {
31
31
  rowItemsSpacing: 8,
32
32
  overscan: 2,
33
33
  reloadTimeout: 350,
34
+ showFooter: true,
34
35
  }
35
36
 
36
37
  export function Grid<T = any>(props: GridProps<T>) {
@@ -53,6 +54,7 @@ export function Grid<T = any>(props: GridProps<T>) {
53
54
  masonryProps = {},
54
55
  numColumns,
55
56
  reloadTimeout,
57
+ showFooter,
56
58
  } = allProps
57
59
 
58
60
  const variantStyles = useDefaultComponentStyle<'u:Grid', typeof GridPresets>('u:Grid', {
@@ -61,7 +63,12 @@ export function Grid<T = any>(props: GridProps<T>) {
61
63
  styles,
62
64
  })
63
65
 
64
- const { layoutProps, onLoadMore, onRefreshItems } = useInfiniteScroll(allProps)
66
+ const { layoutProps, onLoadMore } = useInfiniteScroll(allProps)
67
+
68
+ const { reloadingLayout, previousLength } = useMasonryReload({
69
+ data,
70
+ reloadTimeout,
71
+ })
65
72
 
66
73
  const separator = React.useMemo(() => {
67
74
  return separators ? <ListSeparatorComponent separatorStyles={variantStyles.separator} /> : null
@@ -97,6 +104,7 @@ export function Grid<T = any>(props: GridProps<T>) {
97
104
  {...allProps}
98
105
  {...layoutProps}
99
106
  variantStyles={variantStyles}
107
+ showFooter={reloadingLayout ? false : showFooter}
100
108
  >
101
109
  <ListMasonry
102
110
  items={data}
@@ -108,7 +116,8 @@ export function Grid<T = any>(props: GridProps<T>) {
108
116
  maxColumnCount={numColumns}
109
117
  onRender={onLoadMore}
110
118
  overscanBy={overscan}
111
- reloadTimeout={reloadTimeout}
119
+ previousItemsLength={previousLength}
120
+ reloadingLayout={reloadingLayout}
112
121
  {...masonryProps}
113
122
  />
114
123
  </ListLayout>
@@ -10,6 +10,7 @@ import { motion } from 'framer-motion'
10
10
  type ListLayoutProps = Omit<ListProps, 'renderItem'> & UseInfiniteScrollReturn['layoutProps'] & {
11
11
  variantStyles: StylesOf<ListComposition>
12
12
  children?: React.ReactNode
13
+ showFooter?: boolean
13
14
  }
14
15
 
15
16
  type ListRefreshControlComponent = Partial<ListLayoutProps> & {
@@ -65,6 +66,7 @@ export const ListLayout = (props: ListLayoutProps) => {
65
66
  isFetchingNextPage,
66
67
  ListLoadingIndicatorComponent,
67
68
  scrollableRef,
69
+ showFooter = true,
68
70
  } = props
69
71
 
70
72
  const getKeyStyle = React.useCallback((key: ListParts) => ([
@@ -94,7 +96,7 @@ export const ListLayout = (props: ListLayoutProps) => {
94
96
  ? <ListLoadingIndicatorComponent />
95
97
  : null}
96
98
 
97
- {!!ListFooterComponent ? <ListFooterComponent /> : null}
99
+ {(!!ListFooterComponent && showFooter) ? <ListFooterComponent /> : null}
98
100
  </View>
99
101
  )
100
102
  }
@@ -6,7 +6,7 @@ import { ListPresets } from './styles'
6
6
  import { useInfiniteScroll } from './useInfiniteScroll'
7
7
  import { ListProps } from './types'
8
8
  import { ListLayout } from './ListLayout'
9
- import { ItemMasonryProps, ListMasonry } from '../../lib'
9
+ import { ItemMasonryProps, ListMasonry, useMasonryReload } from '../../lib'
10
10
 
11
11
  export * from './styles'
12
12
  export * from './PaginationIndicator'
@@ -34,6 +34,7 @@ const defaultProps: Partial<ListProps> = {
34
34
  rowItemsSpacing: 8,
35
35
  overscan: 2,
36
36
  reloadTimeout: 350,
37
+ showFooter: true,
37
38
  }
38
39
 
39
40
  export function List<T = any>(props: ListProps<T>) {
@@ -54,6 +55,7 @@ export function List<T = any>(props: ListProps<T>) {
54
55
  separators,
55
56
  masonryProps = {},
56
57
  reloadTimeout,
58
+ showFooter,
57
59
  } = allProps
58
60
 
59
61
  const variantStyles = useDefaultComponentStyle<'u:List', typeof ListPresets>('u:List', {
@@ -64,6 +66,11 @@ export function List<T = any>(props: ListProps<T>) {
64
66
 
65
67
  const { layoutProps, onLoadMore } = useInfiniteScroll(allProps)
66
68
 
69
+ const { reloadingLayout, previousLength } = useMasonryReload({
70
+ data,
71
+ reloadTimeout,
72
+ })
73
+
67
74
  const separator = React.useMemo(() => {
68
75
  return separators ? <ListSeparatorComponent separatorStyles={variantStyles.separator} /> : null
69
76
  }, [])
@@ -96,6 +103,7 @@ export function List<T = any>(props: ListProps<T>) {
96
103
  {...allProps}
97
104
  {...layoutProps}
98
105
  variantStyles={variantStyles}
106
+ showFooter={reloadingLayout ? false : showFooter}
99
107
  >
100
108
  <ListMasonry
101
109
  items={data}
@@ -105,7 +113,8 @@ export function List<T = any>(props: ListProps<T>) {
105
113
  onRender={onLoadMore}
106
114
  overscanBy={overscan}
107
115
  columnCount={1}
108
- reloadTimeout={reloadTimeout}
116
+ previousItemsLength={previousLength}
117
+ reloadingLayout={reloadingLayout}
109
118
  {...masonryProps}
110
119
  />
111
120
  </ListLayout>
@@ -50,6 +50,7 @@ Data = T extends Array<infer D> ? D : never
50
50
  ref?: React.MutableRefObject<undefined>
51
51
  rowItemsSpacing?: number
52
52
  overscan?: number
53
- masonryProps?: Partial<Omit<ListMasonryProps<T>, 'previousItemsLength'>>
53
+ masonryProps?: Partial<ListMasonryProps<T>>
54
54
  reloadTimeout?: number
55
+ showFooter?: boolean
55
56
  } & ComponentCommonProps & UseInfiniteScrollArgs
@@ -35,7 +35,7 @@ export const Overlay = <T extends NativeHTMLElement>(overlayProps:OverlayProps<T
35
35
  styles,
36
36
  })
37
37
 
38
- usePopState(visible, props.onPress, scrollLocked)
38
+ // usePopState(visible, props.onPress, scrollLocked)
39
39
 
40
40
  const Component = props.onClick || props.onPress ? Touchable : View
41
41
 
@@ -72,7 +72,7 @@ export type ItemMasonryProps<T> = RenderComponentProps<T>
72
72
 
73
73
  export type ListMasonryProps<T> = MasonryProps<T> & {
74
74
  previousItemsLength: number
75
- reloadTimeout: UseMasonryReloadArgs['reloadTimeout']
75
+ reloadingLayout: boolean
76
76
  }
77
77
 
78
78
  export function MasonryComponent<Item>(props: ListMasonryProps<Item>) {
@@ -119,15 +119,8 @@ export function MasonryComponent<Item>(props: ListMasonryProps<Item>) {
119
119
  })
120
120
  }
121
121
 
122
- export function ListMasonry<Item>(props: Omit<ListMasonryProps<Item>, 'previousItemsLength'>) {
123
- const data = props?.items || []
124
-
125
- const { reloadingLayout, previousLength } = useMasonryReload({
126
- data,
127
- reloadTimeout: props?.reloadTimeout,
128
- })
129
-
130
- if (reloadingLayout) {
122
+ export function ListMasonry<Item>(props: ListMasonryProps<Item>) {
123
+ if (props?.reloadingLayout) {
131
124
  return (
132
125
  <EmptyPlaceholder loading title={''} description={null} />
133
126
  )
@@ -135,8 +128,7 @@ export function ListMasonry<Item>(props: Omit<ListMasonryProps<Item>, 'previousI
135
128
  return (
136
129
  <MasonryComponent
137
130
  {...props}
138
- items={data}
139
- previousItemsLength={previousLength}
131
+ items={props?.items || []}
140
132
  />
141
133
  )
142
134
  }