@djangocfg/ui-tools 2.1.124 → 2.1.126
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.
|
|
3
|
+
"version": "2.1.126",
|
|
4
4
|
"description": "Heavy React tools with lazy loading - for Electron, Vite, CRA, Next.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-tools",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"check": "tsc --noEmit"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@djangocfg/i18n": "^2.1.
|
|
66
|
-
"@djangocfg/ui-core": "^2.1.
|
|
65
|
+
"@djangocfg/i18n": "^2.1.126",
|
|
66
|
+
"@djangocfg/ui-core": "^2.1.126",
|
|
67
67
|
"lucide-react": "^0.545.0",
|
|
68
68
|
"react": "^19.0.0",
|
|
69
69
|
"react-dom": "^19.0.0",
|
|
70
|
-
"tailwindcss": "^4.
|
|
70
|
+
"tailwindcss": "^4.1.18",
|
|
71
71
|
"zustand": "^5.0.0",
|
|
72
72
|
"consola": "^3.4.2"
|
|
73
73
|
},
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"@maplibre/maplibre-gl-geocoder": "^1.7.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@djangocfg/i18n": "^2.1.
|
|
98
|
+
"@djangocfg/i18n": "^2.1.126",
|
|
99
99
|
"@djangocfg/playground": "workspace:*",
|
|
100
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
101
|
-
"@djangocfg/ui-core": "^2.1.
|
|
100
|
+
"@djangocfg/typescript-config": "^2.1.126",
|
|
101
|
+
"@djangocfg/ui-core": "^2.1.126",
|
|
102
102
|
"@types/mapbox__mapbox-gl-draw": "^1.4.8",
|
|
103
103
|
"@types/node": "^24.7.2",
|
|
104
104
|
"@types/react": "^19.1.0",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"lucide-react": "^0.545.0",
|
|
107
107
|
"react": "^19.0.0",
|
|
108
108
|
"react-dom": "^19.0.0",
|
|
109
|
-
"tailwindcss": "^4.
|
|
109
|
+
"tailwindcss": "^4.1.18",
|
|
110
110
|
"tsup": "^8.5.0",
|
|
111
111
|
"typescript": "^5.9.3"
|
|
112
112
|
},
|
|
@@ -252,7 +252,7 @@ export const GalleryLightbox = memo(function GalleryLightbox({
|
|
|
252
252
|
{currentImage && (
|
|
253
253
|
<div
|
|
254
254
|
className={cn(
|
|
255
|
-
'relative
|
|
255
|
+
'relative w-full h-full select-none',
|
|
256
256
|
isZoomed ? 'cursor-grab' : enableZoom ? 'cursor-zoom-in' : 'cursor-default',
|
|
257
257
|
isDragging && 'cursor-grabbing'
|
|
258
258
|
)}
|
|
@@ -267,7 +267,8 @@ export const GalleryLightbox = memo(function GalleryLightbox({
|
|
|
267
267
|
>
|
|
268
268
|
<GalleryMedia
|
|
269
269
|
media={currentImage}
|
|
270
|
-
className="
|
|
270
|
+
className="w-full h-full pointer-events-none"
|
|
271
|
+
objectFit="contain"
|
|
271
272
|
showLoading
|
|
272
273
|
priority
|
|
273
274
|
autoPlay
|
|
@@ -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 CSS background-image for
|
|
12
|
+
* Uses CSS background-image for cover mode, <img> for contain mode
|
|
13
13
|
*/
|
|
14
14
|
export const GalleryImage = memo(function GalleryImage({
|
|
15
15
|
image,
|
|
@@ -18,6 +18,7 @@ export const GalleryImage = memo(function GalleryImage({
|
|
|
18
18
|
onError,
|
|
19
19
|
onClick,
|
|
20
20
|
priority = false,
|
|
21
|
+
objectFit = 'cover',
|
|
21
22
|
className,
|
|
22
23
|
}: GalleryImageProps) {
|
|
23
24
|
const t = useTypedT<I18nTranslations>()
|
|
@@ -26,8 +27,13 @@ export const GalleryImage = memo(function GalleryImage({
|
|
|
26
27
|
const { isLoading, isLoaded, hasError } = useImageLoader(image.src, callbacks)
|
|
27
28
|
|
|
28
29
|
const backgroundStyle = useMemo(() =>
|
|
29
|
-
isLoaded
|
|
30
|
-
|
|
30
|
+
isLoaded && objectFit === 'cover' ? {
|
|
31
|
+
backgroundImage: `url(${image.src})`,
|
|
32
|
+
backgroundSize: 'cover',
|
|
33
|
+
backgroundPosition: 'center',
|
|
34
|
+
backgroundRepeat: 'no-repeat',
|
|
35
|
+
} : undefined
|
|
36
|
+
, [isLoaded, image.src, objectFit])
|
|
31
37
|
|
|
32
38
|
if (hasError) {
|
|
33
39
|
return (
|
|
@@ -45,10 +51,33 @@ export const GalleryImage = memo(function GalleryImage({
|
|
|
45
51
|
)
|
|
46
52
|
}
|
|
47
53
|
|
|
54
|
+
// Use <img> tag for contain mode (lightbox)
|
|
55
|
+
if (objectFit === 'contain') {
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
className={cn(
|
|
59
|
+
'w-full h-full flex items-center justify-center',
|
|
60
|
+
isLoading && 'bg-muted animate-pulse',
|
|
61
|
+
className
|
|
62
|
+
)}
|
|
63
|
+
onClick={onClick}
|
|
64
|
+
>
|
|
65
|
+
{isLoaded && (
|
|
66
|
+
<img
|
|
67
|
+
src={image.src}
|
|
68
|
+
alt={image.alt || 'Gallery image'}
|
|
69
|
+
className="max-w-full max-h-full object-contain animate-in fade-in-0 duration-300"
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Use background-image for cover mode (thumbnails, grid)
|
|
48
77
|
return (
|
|
49
78
|
<div
|
|
50
79
|
className={cn(
|
|
51
|
-
'w-full h-full
|
|
80
|
+
'w-full h-full',
|
|
52
81
|
isLoading && 'bg-muted animate-pulse',
|
|
53
82
|
isLoaded && 'animate-in fade-in-0 duration-300',
|
|
54
83
|
className
|
|
@@ -20,6 +20,8 @@ export interface GalleryMediaProps {
|
|
|
20
20
|
priority?: boolean
|
|
21
21
|
/** Autoplay video */
|
|
22
22
|
autoPlay?: boolean
|
|
23
|
+
/** Object fit mode: cover for thumbnails/grid, contain for lightbox */
|
|
24
|
+
objectFit?: 'cover' | 'contain'
|
|
23
25
|
/** Additional CSS class */
|
|
24
26
|
className?: string
|
|
25
27
|
}
|
|
@@ -35,6 +37,7 @@ export const GalleryMedia = memo(function GalleryMedia({
|
|
|
35
37
|
onClick,
|
|
36
38
|
priority = false,
|
|
37
39
|
autoPlay = false,
|
|
40
|
+
objectFit = 'cover',
|
|
38
41
|
className,
|
|
39
42
|
}: GalleryMediaProps) {
|
|
40
43
|
const isVideo = media.type === 'video' && media.videoSrc
|
|
@@ -60,6 +63,7 @@ export const GalleryMedia = memo(function GalleryMedia({
|
|
|
60
63
|
onError={onError}
|
|
61
64
|
onClick={onClick}
|
|
62
65
|
priority={priority}
|
|
66
|
+
objectFit={objectFit}
|
|
63
67
|
className={className}
|
|
64
68
|
/>
|
|
65
69
|
)
|
|
@@ -136,6 +136,8 @@ export interface GalleryImageProps {
|
|
|
136
136
|
onClick?: () => void
|
|
137
137
|
/** Priority loading */
|
|
138
138
|
priority?: boolean
|
|
139
|
+
/** Object fit mode: cover for thumbnails/grid, contain for lightbox */
|
|
140
|
+
objectFit?: 'cover' | 'contain'
|
|
139
141
|
/** Additional CSS class */
|
|
140
142
|
className?: string
|
|
141
143
|
}
|