@djangocfg/ui-tools 2.1.121 → 2.1.124

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": "@djangocfg/ui-tools",
3
- "version": "2.1.121",
3
+ "version": "2.1.124",
4
4
  "description": "Heavy React tools with lazy loading - for Electron, Vite, CRA, Next.js apps",
5
5
  "keywords": [
6
6
  "ui-tools",
@@ -62,8 +62,8 @@
62
62
  "check": "tsc --noEmit"
63
63
  },
64
64
  "peerDependencies": {
65
- "@djangocfg/i18n": "^2.1.121",
66
- "@djangocfg/ui-core": "^2.1.121",
65
+ "@djangocfg/i18n": "^2.1.124",
66
+ "@djangocfg/ui-core": "^2.1.124",
67
67
  "lucide-react": "^0.545.0",
68
68
  "react": "^19.0.0",
69
69
  "react-dom": "^19.0.0",
@@ -95,10 +95,10 @@
95
95
  "@maplibre/maplibre-gl-geocoder": "^1.7.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@djangocfg/i18n": "^2.1.121",
98
+ "@djangocfg/i18n": "^2.1.124",
99
99
  "@djangocfg/playground": "workspace:*",
100
- "@djangocfg/typescript-config": "^2.1.121",
101
- "@djangocfg/ui-core": "^2.1.121",
100
+ "@djangocfg/typescript-config": "^2.1.124",
101
+ "@djangocfg/ui-core": "^2.1.124",
102
102
  "@types/mapbox__mapbox-gl-draw": "^1.4.8",
103
103
  "@types/node": "^24.7.2",
104
104
  "@types/react": "^19.1.0",
@@ -198,7 +198,7 @@ export const Interactive = () => {
198
198
  <div>
199
199
  <h3 className="text-lg font-semibold mb-4">GalleryCompact</h3>
200
200
  <div className="grid grid-cols-1 md:grid-cols-3 gap-6">
201
- <div className="rounded-xl border border-border overflow-hidden">
201
+ <div className="rounded-xl border border-border overflow-hidden bg-black">
202
202
  <GalleryCompact
203
203
  images={SAMPLE_IMAGES}
204
204
  aspectRatio={aspectRatio}
@@ -78,7 +78,7 @@ export const GalleryCompact = memo(function GalleryCompact({
78
78
  const aspectRatioStyle = aspectRatioMap[aspectRatio]
79
79
  const containerStyle = aspectRatioStyle ? { aspectRatio: aspectRatioStyle } : undefined
80
80
  const hasFixedAspect = aspectRatio !== 'auto'
81
- const containerClass = hasFixedAspect ? 'relative w-full' : 'relative w-full h-full'
81
+ const containerClass = hasFixedAspect ? 'relative w-full overflow-hidden' : 'relative w-full h-full overflow-hidden'
82
82
 
83
83
  useEffect(() => {
84
84
  setIsMounted(true)
@@ -9,7 +9,7 @@ import type { GalleryImageProps } from '../../types'
9
9
 
10
10
  /**
11
11
  * GalleryImage - Single image with loading state and error handling
12
- * Uses useImageLoader for preloading images before displaying
12
+ * Uses CSS background-image for reliable cover behavior
13
13
  */
14
14
  export const GalleryImage = memo(function GalleryImage({
15
15
  image,
@@ -25,6 +25,10 @@ export const GalleryImage = memo(function GalleryImage({
25
25
  const callbacks = useMemo(() => ({ onLoad, onError }), [onLoad, onError])
26
26
  const { isLoading, isLoaded, hasError } = useImageLoader(image.src, callbacks)
27
27
 
28
+ const backgroundStyle = useMemo(() =>
29
+ isLoaded ? { backgroundImage: `url(${image.src})` } : undefined
30
+ , [isLoaded, image.src])
31
+
28
32
  if (hasError) {
29
33
  return (
30
34
  <div
@@ -43,24 +47,16 @@ export const GalleryImage = memo(function GalleryImage({
43
47
 
44
48
  return (
45
49
  <div
46
- className={cn('relative w-full h-full overflow-hidden', className)}
47
- onClick={onClick}
48
- >
49
- {/* Loading skeleton */}
50
- {showLoading && isLoading && (
51
- <div className="absolute inset-0 bg-muted animate-pulse" />
50
+ className={cn(
51
+ 'w-full h-full bg-cover bg-center bg-no-repeat',
52
+ isLoading && 'bg-muted animate-pulse',
53
+ isLoaded && 'animate-in fade-in-0 duration-300',
54
+ className
52
55
  )}
53
-
54
- {/* Image - only render when preloaded */}
55
- {isLoaded && (
56
- <img
57
- src={image.src}
58
- alt={image.alt || 'Gallery image'}
59
- className="absolute inset-0 w-full h-full object-cover animate-in fade-in-0 duration-300"
60
- loading={priority ? 'eager' : 'lazy'}
61
- decoding="async"
62
- />
63
- )}
64
- </div>
56
+ style={backgroundStyle}
57
+ onClick={onClick}
58
+ role="img"
59
+ aria-label={image.alt || 'Gallery image'}
60
+ />
65
61
  )
66
62
  })