ps99-api 2.6.3 → 2.6.4

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.
@@ -480,8 +480,16 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
480
480
  }, [isMobile, collectionName, finalItems.length]); // Re-evaluate on collection change or mobile resize, or items load
481
481
 
482
482
 
483
- // Scroll Direction // Header Logic
484
- const { showHeader, handleScroll, scrollRef, headerRef, headerHeight, contentPadding } = useCollapsibleHeader({ deps: [loading] });
483
+ // Scroll Direction / Header Logic
484
+ // Check if content is short to disable collapsible header (prevents popping)
485
+ const ITEM_HEIGHT = viewMode === 'list' ? 100 : 150; // Approximate
486
+ const estimatedContentHeight = finalItems.length * ITEM_HEIGHT / (viewMode === 'grid' ? 2 : 1); // Rough estimate
487
+ const isShortContent = estimatedContentHeight < window.innerHeight * 1.5;
488
+
489
+ const { showHeader, handleScroll, scrollRef, headerRef, headerHeight, contentPadding } = useCollapsibleHeader({
490
+ deps: [loading, finalItems.length, viewMode],
491
+ disabled: isShortContent // Disable collapsing if content is short
492
+ });
485
493
 
486
494
  // Loading State
487
495
  if (loading) {
@@ -644,7 +652,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
644
652
  flexDirection: "column",
645
653
  overflow: "hidden",
646
654
  backgroundColor: "#ffffff",
647
- height: "100%", // ensure it fills parent
655
+ height: "100dvh", // ensure it fills parent with dynamic viewport height
648
656
  position: 'relative' // Context for absolute header
649
657
  }}
650
658
  >
@@ -821,6 +829,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
821
829
  width={width}
822
830
  initialScrollOffset={initialScrollOffset}
823
831
  onScroll={handleScroll}
832
+ bottomPadding={120} // Account for Android footer/nav
824
833
  itemData={{
825
834
  items: finalItems,
826
835
  navigate,
@@ -854,6 +863,7 @@ const CollectionConfigIndex: React.FC<CollectionConfigIndexProps> = () => {
854
863
  initialScrollOffset={initialScrollOffset}
855
864
  onScroll={handleScroll}
856
865
  style={{ overflowX: "hidden" }}
866
+ bottomPadding={120} // Account for Android footer/nav
857
867
  itemData={{
858
868
  items: finalItems,
859
869
  columnCount: colCount,
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useEffect } from 'react';
2
2
 
3
- export const FixedSizeList = ({ children, itemCount, itemSize, height, width, onScroll, initialScrollOffset, itemData }: any) => {
3
+ export const FixedSizeList = ({ children, itemCount, itemSize, height, width, onScroll, initialScrollOffset, itemData, bottomPadding = 0 }: any) => {
4
4
  const items = [];
5
5
  for (let i = 0; i < itemCount; i++) {
6
6
  items.push(
@@ -25,11 +25,12 @@ export const FixedSizeList = ({ children, itemCount, itemSize, height, width, on
25
25
  onScroll={(e) => onScroll && onScroll({ scrollOffset: e.currentTarget.scrollTop })}
26
26
  >
27
27
  {items}
28
+ {bottomPadding > 0 && <div style={{ height: bottomPadding }} />}
28
29
  </div>
29
30
  );
30
31
  };
31
32
 
32
- export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, rowHeight, height, width, onScroll, initialScrollOffset, itemData, style }: any) => {
33
+ export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, rowHeight, height, width, onScroll, initialScrollOffset, itemData, style, bottomPadding = 0 }: any) => {
33
34
  const items = [];
34
35
  for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
35
36
  for (let columnIndex = 0; columnIndex < columnCount; columnIndex++) {
@@ -65,7 +66,7 @@ export const FixedSizeGrid = ({ children, columnCount, rowCount, columnWidth, ro
65
66
  style={{ height, width, overflowY: "auto", overflowX: "hidden", position: 'relative', ...style }}
66
67
  onScroll={(e) => onScroll && onScroll({ scrollTop: e.currentTarget.scrollTop })}
67
68
  >
68
- <div style={{ height: rowCount * rowHeight, width: columnWidth * columnCount }}>
69
+ <div style={{ height: rowCount * rowHeight + bottomPadding, width: columnWidth * columnCount }}>
69
70
  {items}
70
71
  </div>
71
72
  </div>
@@ -5,10 +5,11 @@ interface UseCollapsibleHeaderOptions {
5
5
  triggerStart?: number; // Scroll position to start checking
6
6
  threshold?: number; // Scroll delta threshold
7
7
  deps?: any[]; // Dependencies to re-run the ResizeObserver effect
8
+ disabled?: boolean; // Disable collapsing behavior
8
9
  }
9
10
 
10
11
  export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {}) => {
11
- const { defaultHeight = 120, triggerStart = 50, threshold = 10, deps = [] } = options;
12
+ const { defaultHeight = 120, triggerStart = 50, threshold = 10, deps = [], disabled = false } = options;
12
13
 
13
14
  // Header Visibility Logic
14
15
  const [showHeader, setShowHeader] = useState(true);
@@ -16,6 +17,11 @@ export const useCollapsibleHeader = (options: UseCollapsibleHeaderOptions = {})
16
17
  const scrollRef = useRef<number>(0);
17
18
 
18
19
  const handleScroll = ({ scrollOffset, scrollTop }: { scrollOffset?: number, scrollTop?: number }) => {
20
+ if (disabled) {
21
+ setShowHeader(true);
22
+ return;
23
+ }
24
+
19
25
  const currentScrollTop = scrollTop ?? scrollOffset ?? 0;
20
26
  const scrollDelta = currentScrollTop - lastScrollTop.current;
21
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ps99-api",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "Pet Simulator Public API wrapper written in Typescript.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",