@djangocfg/ui-tools 2.1.118 → 2.1.120

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.
Files changed (78) hide show
  1. package/dist/JsonTree-G2TPWQ4C.mjs +4 -0
  2. package/dist/{JsonTree-6RYAOPSS.mjs.map → JsonTree-G2TPWQ4C.mjs.map} +1 -1
  3. package/dist/JsonTree-TWXUBBIG.cjs +10 -0
  4. package/dist/{JsonTree-7OH6CIHT.cjs.map → JsonTree-TWXUBBIG.cjs.map} +1 -1
  5. package/dist/{Mermaid.client-PNXEC6YL.cjs → Mermaid.client-AF4WOQZR.cjs} +9 -11
  6. package/dist/Mermaid.client-AF4WOQZR.cjs.map +1 -0
  7. package/dist/{Mermaid.client-OKACITCW.mjs → Mermaid.client-W4QXJX7Q.mjs} +9 -11
  8. package/dist/Mermaid.client-W4QXJX7Q.mjs.map +1 -0
  9. package/dist/{PlaygroundLayout-SYMEAG3J.cjs → PlaygroundLayout-RZMJWH3Y.cjs} +25 -25
  10. package/dist/{PlaygroundLayout-SYMEAG3J.cjs.map → PlaygroundLayout-RZMJWH3Y.cjs.map} +1 -1
  11. package/dist/{PlaygroundLayout-UQRBU5RH.mjs → PlaygroundLayout-UQABCZ6K.mjs} +4 -4
  12. package/dist/{PlaygroundLayout-UQRBU5RH.mjs.map → PlaygroundLayout-UQABCZ6K.mjs.map} +1 -1
  13. package/dist/{chunk-UOMPPIED.mjs → chunk-4G4UGMOP.mjs} +3 -3
  14. package/dist/chunk-4G4UGMOP.mjs.map +1 -0
  15. package/dist/{chunk-47T5ECYV.cjs → chunk-CY3CQS26.cjs} +3 -3
  16. package/dist/chunk-CY3CQS26.cjs.map +1 -0
  17. package/dist/{chunk-5QT3QYFZ.cjs → chunk-EGYUND4E.cjs} +2 -2
  18. package/dist/chunk-EGYUND4E.cjs.map +1 -0
  19. package/dist/{chunk-DI3HUXHK.cjs → chunk-OYLQZT62.cjs} +2 -2
  20. package/dist/chunk-OYLQZT62.cjs.map +1 -0
  21. package/dist/{chunk-W6YHQI4F.mjs → chunk-OYYCGIBF.mjs} +2 -2
  22. package/dist/chunk-OYYCGIBF.mjs.map +1 -0
  23. package/dist/{chunk-G6PRZP5I.mjs → chunk-XZZ22EHP.mjs} +2 -2
  24. package/dist/chunk-XZZ22EHP.mjs.map +1 -0
  25. package/dist/{components-EASJYK45.mjs → components-4YSJ5ALL.mjs} +3 -3
  26. package/dist/{components-CJ2IB65O.cjs.map → components-4YSJ5ALL.mjs.map} +1 -1
  27. package/dist/{components-CJ2IB65O.cjs → components-BSTP3VLD.cjs} +7 -7
  28. package/dist/{components-EASJYK45.mjs.map → components-BSTP3VLD.cjs.map} +1 -1
  29. package/dist/index.cjs +27 -27
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.mjs +10 -10
  34. package/dist/index.mjs.map +1 -1
  35. package/package.json +12 -5
  36. package/src/tools/AudioPlayer/AudioPlayer.story.tsx +102 -0
  37. package/src/tools/Gallery/Gallery.story.tsx +231 -0
  38. package/src/tools/Gallery/components/Gallery.tsx +3 -3
  39. package/src/tools/Gallery/components/compact/GalleryCompact.tsx +363 -0
  40. package/src/tools/Gallery/components/compact/index.ts +1 -0
  41. package/src/tools/Gallery/components/index.ts +17 -12
  42. package/src/tools/Gallery/components/{GalleryLightbox.tsx → lightbox/GalleryLightbox.tsx} +6 -6
  43. package/src/tools/Gallery/components/lightbox/index.ts +1 -0
  44. package/src/tools/Gallery/components/{GalleryImage.tsx → media/GalleryImage.tsx} +1 -1
  45. package/src/tools/Gallery/components/{GalleryMedia.tsx → media/GalleryMedia.tsx} +1 -1
  46. package/src/tools/Gallery/components/{GalleryVideo.tsx → media/GalleryVideo.tsx} +1 -1
  47. package/src/tools/Gallery/components/media/index.ts +3 -0
  48. package/src/tools/Gallery/components/{GalleryCarousel.tsx → preview/GalleryCarousel.tsx} +114 -6
  49. package/src/tools/Gallery/components/{GalleryGrid.tsx → preview/GalleryGrid.tsx} +1 -1
  50. package/src/tools/Gallery/components/preview/index.ts +2 -0
  51. package/src/tools/Gallery/components/{GalleryThumbnails.tsx → thumbnails/GalleryThumbnails.tsx} +1 -1
  52. package/src/tools/Gallery/components/{GalleryThumbnailsVirtual.tsx → thumbnails/GalleryThumbnailsVirtual.tsx} +2 -2
  53. package/src/tools/Gallery/components/thumbnails/index.ts +2 -0
  54. package/src/tools/JsonForm/JsonForm.story.tsx +134 -0
  55. package/src/tools/JsonTree/JsonTree.story.tsx +140 -0
  56. package/src/tools/JsonTree/index.tsx +1 -1
  57. package/src/tools/LottiePlayer/LottiePlayer.story.tsx +95 -0
  58. package/src/tools/Map/Map.story.tsx +300 -0
  59. package/src/tools/Mermaid/Mermaid.story.tsx +131 -0
  60. package/src/tools/Mermaid/hooks/useMermaidCleanup.ts +2 -5
  61. package/src/tools/Mermaid/hooks/useMermaidRenderer.ts +7 -1
  62. package/src/tools/Mermaid/hooks/useMermaidValidation.ts +4 -2
  63. package/src/tools/Mermaid/index.tsx +1 -1
  64. package/src/tools/PrettyCode/PrettyCode.story.tsx +116 -0
  65. package/src/tools/PrettyCode/index.tsx +1 -1
  66. package/src/tools/VideoPlayer/VideoPlayer.story.tsx +87 -0
  67. package/src/tools/VideoPlayer/utils/resolvers.ts +2 -2
  68. package/dist/JsonTree-6RYAOPSS.mjs +0 -4
  69. package/dist/JsonTree-7OH6CIHT.cjs +0 -10
  70. package/dist/Mermaid.client-OKACITCW.mjs.map +0 -1
  71. package/dist/Mermaid.client-PNXEC6YL.cjs.map +0 -1
  72. package/dist/chunk-47T5ECYV.cjs.map +0 -1
  73. package/dist/chunk-5QT3QYFZ.cjs.map +0 -1
  74. package/dist/chunk-DI3HUXHK.cjs.map +0 -1
  75. package/dist/chunk-G6PRZP5I.mjs.map +0 -1
  76. package/dist/chunk-UOMPPIED.mjs.map +0 -1
  77. package/dist/chunk-W6YHQI4F.mjs.map +0 -1
  78. package/src/tools/Gallery/components/GalleryCompact.tsx +0 -173
@@ -1,173 +0,0 @@
1
- 'use client'
2
-
3
- import { memo, useCallback, useEffect, useState } from 'react'
4
- import { cn } from '@djangocfg/ui-core/lib'
5
- import {
6
- Carousel,
7
- CarouselContent,
8
- CarouselItem,
9
- type CarouselApi,
10
- } from '@djangocfg/ui-core/components'
11
- import { ImageOff } from 'lucide-react'
12
- import { GalleryMedia } from './GalleryMedia'
13
- import type { GalleryMediaItem } from '../types'
14
-
15
- export interface GalleryCompactProps {
16
- /** Array of images to display */
17
- images: GalleryMediaItem[]
18
- /** Show dots indicator (default: true) */
19
- showDots?: boolean
20
- /** Max dots to show (default: 5) */
21
- maxDots?: number
22
- /** Show counter badge (default: false) */
23
- showCounter?: boolean
24
- /** On image click callback */
25
- onClick?: () => void
26
- /** Additional CSS class */
27
- className?: string
28
- }
29
-
30
- /**
31
- * GalleryCompact - Minimal carousel for property cards
32
- *
33
- * Features:
34
- * - Simple swipe carousel
35
- * - Dots indicator (mobile-style)
36
- * - No arrows, thumbnails, or lightbox
37
- * - Fills parent container
38
- * - Stops event propagation on navigation
39
- */
40
- export const GalleryCompact = memo(function GalleryCompact({
41
- images,
42
- showDots = true,
43
- maxDots = 5,
44
- showCounter = false,
45
- onClick,
46
- className,
47
- }: GalleryCompactProps) {
48
- const [api, setApi] = useState<CarouselApi>()
49
- const [currentIndex, setCurrentIndex] = useState(0)
50
-
51
- const total = images.length
52
- const hasMultiple = total > 1
53
-
54
- // Listen to carousel changes
55
- useEffect(() => {
56
- if (!api) return
57
-
58
- const onSelect = () => {
59
- setCurrentIndex(api.selectedScrollSnap())
60
- }
61
-
62
- api.on('select', onSelect)
63
- return () => {
64
- api.off('select', onSelect)
65
- }
66
- }, [api])
67
-
68
- // Dot click handler - stops propagation to prevent card click
69
- const handleDotClick = useCallback(
70
- (e: React.MouseEvent, index: number) => {
71
- e.preventDefault()
72
- e.stopPropagation()
73
- api?.scrollTo(index)
74
- },
75
- [api]
76
- )
77
-
78
- // Handle container click
79
- const handleClick = useCallback(
80
- (e: React.MouseEvent) => {
81
- // Don't trigger if clicking on dots
82
- if ((e.target as HTMLElement).closest('[data-dots]')) {
83
- return
84
- }
85
- onClick?.()
86
- },
87
- [onClick]
88
- )
89
-
90
- // Empty state
91
- if (total === 0) {
92
- return (
93
- <div className={cn('relative w-full h-full bg-muted flex items-center justify-center', className)}>
94
- <ImageOff className="w-8 h-8 text-muted-foreground/50" />
95
- </div>
96
- )
97
- }
98
-
99
- // Single image - no carousel needed
100
- if (!hasMultiple) {
101
- return (
102
- <div className={cn('relative w-full h-full', className)} onClick={onClick}>
103
- <GalleryMedia
104
- media={images[0]}
105
- className="w-full h-full"
106
- priority
107
- />
108
- </div>
109
- )
110
- }
111
-
112
- // Calculate visible dots
113
- const visibleDots = images.slice(0, maxDots).map((_, i) => i)
114
- const remainingCount = total > maxDots ? total - maxDots : 0
115
-
116
- return (
117
- <div className={cn('relative w-full h-full', className)} onClick={handleClick}>
118
- <Carousel
119
- setApi={setApi}
120
- opts={{
121
- loop: true,
122
- }}
123
- className="w-full h-full"
124
- >
125
- <CarouselContent className="-ml-0 h-full">
126
- {images.map((image, index) => (
127
- <CarouselItem key={image.id} className="pl-0 h-full">
128
- <GalleryMedia
129
- media={image}
130
- className="w-full h-full"
131
- priority={index === 0}
132
- />
133
- </CarouselItem>
134
- ))}
135
- </CarouselContent>
136
- </Carousel>
137
-
138
- {/* Dots indicator */}
139
- {showDots && (
140
- <div
141
- data-dots
142
- className="absolute bottom-3 left-1/2 -translate-x-1/2 flex items-center gap-1.5 z-10"
143
- onClick={(e) => e.stopPropagation()}
144
- >
145
- {visibleDots.map((index) => (
146
- <button
147
- key={index}
148
- type="button"
149
- className={cn(
150
- 'rounded-full transition-all',
151
- index === currentIndex
152
- ? 'w-2 h-2 bg-white shadow-[0_0_4px_rgba(255,255,255,0.8)]'
153
- : 'w-1.5 h-1.5 bg-white/50 hover:bg-white/70'
154
- )}
155
- onClick={(e) => handleDotClick(e, index)}
156
- aria-label={`Go to image ${index + 1}`}
157
- />
158
- ))}
159
- {remainingCount > 0 && (
160
- <span className="text-white/70 text-[10px] ml-0.5">+{remainingCount}</span>
161
- )}
162
- </div>
163
- )}
164
-
165
- {/* Counter badge */}
166
- {showCounter && (
167
- <div className="absolute bottom-3 right-3 z-10 bg-black/60 backdrop-blur-sm text-white text-xs px-2 py-1 rounded-full">
168
- {currentIndex + 1} / {total}
169
- </div>
170
- )}
171
- </div>
172
- )
173
- })