@atom63/ui-react 0.2.0-beta.14 → 0.2.0-beta.16

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 (92) hide show
  1. package/dist/chart/index.d.ts +48 -0
  2. package/dist/chart/index.js +309 -0
  3. package/dist/chart/index.js.map +1 -0
  4. package/dist/chunk-3LGXD3HE.js +450 -0
  5. package/dist/chunk-3LGXD3HE.js.map +1 -0
  6. package/dist/{chunk-ASV4A4YB.js → chunk-4HE5IB6K.js} +4 -12
  7. package/dist/chunk-4HE5IB6K.js.map +1 -0
  8. package/dist/chunk-6HKGC3HE.js +3 -0
  9. package/dist/chunk-6HKGC3HE.js.map +1 -0
  10. package/dist/chunk-6VV4EBOO.js +25 -0
  11. package/dist/chunk-6VV4EBOO.js.map +1 -0
  12. package/dist/{chunk-GRRWPMZI.js → chunk-77CBRRVT.js} +47 -7
  13. package/dist/chunk-77CBRRVT.js.map +1 -0
  14. package/dist/{chunk-IXWOWQBP.js → chunk-ALARPBUL.js} +5 -22
  15. package/dist/chunk-ALARPBUL.js.map +1 -0
  16. package/dist/{chunk-L5KFLZUC.js → chunk-BQONJKNA.js} +4 -4
  17. package/dist/{chunk-L5KFLZUC.js.map → chunk-BQONJKNA.js.map} +1 -1
  18. package/dist/{chunk-CFFGYLY3.js → chunk-CO6KHYO5.js} +26 -4
  19. package/dist/chunk-CO6KHYO5.js.map +1 -0
  20. package/dist/chunk-FHL2NLXP.js +101 -0
  21. package/dist/chunk-FHL2NLXP.js.map +1 -0
  22. package/dist/chunk-HPUHI2YJ.js +69 -0
  23. package/dist/chunk-HPUHI2YJ.js.map +1 -0
  24. package/dist/{chunk-BSDSLG3L.js → chunk-IEHYTNLS.js} +7 -4
  25. package/dist/chunk-IEHYTNLS.js.map +1 -0
  26. package/dist/{chunk-TAXYD4I4.js → chunk-IPUBANIB.js} +3 -2
  27. package/dist/chunk-IPUBANIB.js.map +1 -0
  28. package/dist/chunk-QU33S646.js +118 -0
  29. package/dist/chunk-QU33S646.js.map +1 -0
  30. package/dist/{chunk-WLLPGOQ7.js → chunk-SL6J2Y6I.js} +18 -6
  31. package/dist/chunk-SL6J2Y6I.js.map +1 -0
  32. package/dist/{chunk-3R74FOXV.js → chunk-VUUSD5AG.js} +3 -3
  33. package/dist/{chunk-3R74FOXV.js.map → chunk-VUUSD5AG.js.map} +1 -1
  34. package/dist/{chunk-CJAWGKA5.js → chunk-Y52BV635.js} +16 -4
  35. package/dist/chunk-Y52BV635.js.map +1 -0
  36. package/dist/components/art-plate/index.js +7 -0
  37. package/dist/components/art-plate/index.js.map +1 -0
  38. package/dist/components/command/index.js +1 -1
  39. package/dist/components/drawer/index.js +1 -1
  40. package/dist/components/feedback-state/index.js +1 -1
  41. package/dist/components/form/index.js +1 -1
  42. package/dist/components/layered-scene/index.js +7 -0
  43. package/dist/components/layered-scene/index.js.map +1 -0
  44. package/dist/components/pagination/index.js +1 -1
  45. package/dist/components/segmented-control/index.js +1 -1
  46. package/dist/components/sheet/index.js +1 -1
  47. package/dist/components/sidebar/index.js +3 -3
  48. package/dist/components/sidebar-nav-tree/index.js +4 -4
  49. package/dist/components/table/index.js +2 -1
  50. package/dist/{index-DlcaeyJS.d.ts → index-B0PHovoW.d.ts} +10 -3
  51. package/dist/index.d.ts +123 -11
  52. package/dist/index.js +35 -30
  53. package/dist/media/index.d.ts +24 -3
  54. package/dist/media/index.js +9 -361
  55. package/dist/media/index.js.map +1 -1
  56. package/dist/media/media-lightbox/parts/index.js +2 -1
  57. package/dist/preview/index.d.ts +1 -1
  58. package/dist/preview/index.js +7 -7
  59. package/dist/theme/index.d.ts +6 -2
  60. package/dist/theme/index.js +10 -1
  61. package/dist/theme/index.js.map +1 -1
  62. package/package.json +11 -3
  63. package/src/components/alert-dialog/alert-dialog.css +1 -1
  64. package/src/components/art-plate/art-plate.css +172 -0
  65. package/src/components/autocomplete/autocomplete.css +21 -11
  66. package/src/components/chart/chart.css +316 -0
  67. package/src/components/checkbox/checkbox.css +1 -1
  68. package/src/components/command/command.css +13 -0
  69. package/src/components/feedback-state/feedback-state.css +2 -1
  70. package/src/components/field/field.css +1 -1
  71. package/src/components/form/form.css +1 -1
  72. package/src/components/input/input.css +3 -3
  73. package/src/components/input-otp/input-otp.css +3 -3
  74. package/src/components/layered-scene/layered-scene.css +117 -0
  75. package/src/components/load-more-trigger/load-more-trigger.css +4 -2
  76. package/src/components/radio/radio.css +1 -1
  77. package/src/components/rating/rating.css +18 -17
  78. package/src/components/segmented-control/segmented-control.css +11 -11
  79. package/src/components/select/select.css +3 -3
  80. package/src/components/table/table.css +5 -0
  81. package/src/components/textarea/textarea.css +3 -3
  82. package/src/styles/recipes.css +3 -0
  83. package/dist/chunk-ASV4A4YB.js.map +0 -1
  84. package/dist/chunk-BSDSLG3L.js.map +0 -1
  85. package/dist/chunk-CFFGYLY3.js.map +0 -1
  86. package/dist/chunk-CJAWGKA5.js.map +0 -1
  87. package/dist/chunk-GRRWPMZI.js.map +0 -1
  88. package/dist/chunk-IXWOWQBP.js.map +0 -1
  89. package/dist/chunk-T7FUZUZO.js +0 -70
  90. package/dist/chunk-T7FUZUZO.js.map +0 -1
  91. package/dist/chunk-TAXYD4I4.js.map +0 -1
  92. package/dist/chunk-WLLPGOQ7.js.map +0 -1
@@ -1,369 +1,17 @@
1
- import { useReducedMotion, Lightbox, revealOrigin, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxRefs, useLightboxConfig, useLightboxState, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET, AXIS_LOCK_THRESHOLD } from '../chunk-IXWOWQBP.js';
2
- export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-IXWOWQBP.js';
1
+ import { Lightbox, revealOrigin, supportsViewTransitions, preferCheapMediaTransition, runMediaViewTransition, useLightboxRefs, useLightboxConfig, useLightboxState, CHROME_IN, CHROME_OUT, CHROME_EXIT_OFFSET, AXIS_LOCK_THRESHOLD } from '../chunk-ALARPBUL.js';
2
+ export { DEFAULT_MEDIA_LIGHTBOX_LABELS } from '../chunk-ALARPBUL.js';
3
3
  import '../chunk-IPU75YIQ.js';
4
+ import { Image } from '../chunk-3LGXD3HE.js';
5
+ export { Image, clearImageAnimationCache } from '../chunk-3LGXD3HE.js';
6
+ import { useReducedMotion } from '../chunk-6VV4EBOO.js';
4
7
  import '../chunk-WKORZULQ.js';
5
8
  import { cn } from '../chunk-AJLHJRK6.js';
6
- import { motion, AnimatePresence } from 'motion/react';
7
- import * as React from 'react';
8
- import { memo, forwardRef, createContext, useRef, useEffect, useState, useCallback, useMemo, useContext } from 'react';
9
- import { jsxs, jsx } from 'react/jsx-runtime';
10
9
  import { Plus, LoaderCircle, ZoomOut, ZoomIn, X, ChevronLeft, ChevronRight, Play, Maximize } from 'lucide-react';
10
+ import { AnimatePresence, motion } from 'motion/react';
11
+ import { forwardRef, createContext, useRef, useState, useCallback, useMemo, useContext, useEffect } from 'react';
12
+ import { jsxs, jsx } from 'react/jsx-runtime';
11
13
  import { Dialog } from '@base-ui/react/dialog';
12
14
 
13
- function useIntersectionObserver(options = {}) {
14
- const {
15
- threshold = 0.1,
16
- root = null,
17
- rootMargin = "50px",
18
- // Load content 50px before it enters viewport
19
- freezeOnceVisible = false
20
- } = options;
21
- const elementRef = useRef(null);
22
- const [isIntersecting, setIsIntersecting] = useState(false);
23
- useEffect(() => {
24
- const element = elementRef.current;
25
- if (!element) return;
26
- const observer = new IntersectionObserver(
27
- ([entry]) => {
28
- const isElementIntersecting = entry.isIntersecting;
29
- setIsIntersecting(isElementIntersecting);
30
- if (isElementIntersecting && freezeOnceVisible) {
31
- observer.unobserve(element);
32
- }
33
- },
34
- { threshold, root, rootMargin }
35
- );
36
- observer.observe(element);
37
- return () => {
38
- observer.disconnect();
39
- };
40
- }, [threshold, root, rootMargin, freezeOnceVisible]);
41
- return [elementRef, isIntersecting];
42
- }
43
-
44
- // src/media/hooks/use-lazy-media.ts
45
- function useLazyMedia(options = {}) {
46
- const {
47
- rootMargin = "100px",
48
- // Start loading 100px before entering viewport
49
- threshold = 0.1,
50
- enabled = true
51
- } = options;
52
- const [hasLoaded, setHasLoaded] = useState(!enabled);
53
- const [elementRef, isIntersecting] = useIntersectionObserver({
54
- rootMargin,
55
- threshold,
56
- freezeOnceVisible: true
57
- // Once visible, stay loaded
58
- });
59
- const shouldLoad = isIntersecting || hasLoaded;
60
- const markAsLoaded = useCallback(() => {
61
- setHasLoaded(true);
62
- }, []);
63
- return {
64
- ref: elementRef,
65
- shouldLoad,
66
- isIntersecting,
67
- hasLoaded,
68
- markAsLoaded
69
- };
70
- }
71
- var MOBILE_BREAKPOINT = 768;
72
- function useIsMobile() {
73
- const [isMobile, setIsMobile] = React.useState(void 0);
74
- React.useEffect(() => {
75
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
76
- const onChange = () => {
77
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
78
- };
79
- mql.addEventListener("change", onChange);
80
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
81
- return () => mql.removeEventListener("change", onChange);
82
- }, []);
83
- return !!isMobile;
84
- }
85
- function Skeleton({ className }) {
86
- return /* @__PURE__ */ jsx("div", { className: cn("animate-pulse rounded-md bg-muted", className) });
87
- }
88
- var animatedImagesCache = /* @__PURE__ */ new Set();
89
- var IMAGE_REVEAL_INITIAL = { opacity: 0, scale: 1.02 };
90
- var IMAGE_REVEAL_ANIMATE = { opacity: 1, scale: 1 };
91
- var IMAGE_REVEAL_TRANSITION = {
92
- duration: 0.4,
93
- ease: [0.25, 0.46, 0.45, 0.94]
94
- };
95
- var clearImageAnimationCache = () => animatedImagesCache.clear();
96
- var Image = ({
97
- src,
98
- alt,
99
- className,
100
- imageClassName,
101
- aspectRatio = "16/9",
102
- fallbackText = "No image provided",
103
- errorText = "Failed to load image",
104
- showSkeleton = true,
105
- skeletonClassName,
106
- containerClassName,
107
- lazy = true,
108
- rootMargin = "100px",
109
- priority = false,
110
- forceNoLazy = false,
111
- onLoad,
112
- onError,
113
- decoding = "async",
114
- fetchPriority = "auto",
115
- ...props
116
- }) => {
117
- const [isLoading, setIsLoading] = useState(true);
118
- const [hasError, setHasError] = useState(false);
119
- const [imageSrc, setImageSrc] = useState(null);
120
- const [imageDimensions, setImageDimensions] = useState(
121
- null
122
- );
123
- const isMobile = useIsMobile();
124
- const reducedMotion = useReducedMotion();
125
- const shouldUseLazy = lazy && !priority && !forceNoLazy;
126
- const { ref: lazyRef, shouldLoad } = useLazyMedia({
127
- rootMargin: shouldUseLazy ? rootMargin : "0px",
128
- // Reduce unnecessary triggering
129
- enabled: shouldUseLazy
130
- });
131
- useEffect(() => {
132
- if (!src) {
133
- setHasError(true);
134
- setIsLoading(false);
135
- return;
136
- }
137
- if (!shouldUseLazy || shouldLoad) {
138
- if (imageSrc === src) {
139
- return;
140
- }
141
- setIsLoading(true);
142
- setHasError(false);
143
- const img = new window.Image();
144
- if (decoding) {
145
- img.decoding = decoding;
146
- }
147
- if (fetchPriority && "fetchPriority" in img) {
148
- img.fetchPriority = fetchPriority;
149
- }
150
- const loadImage = () => {
151
- if ("decode" in img && decoding === "async") {
152
- img.decode().then(() => {
153
- setImageSrc(src);
154
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
155
- setIsLoading(false);
156
- onLoad?.();
157
- }).catch(() => {
158
- setImageSrc(src);
159
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
160
- setIsLoading(false);
161
- onLoad?.();
162
- });
163
- } else {
164
- img.onload = () => {
165
- setImageSrc(src);
166
- setImageDimensions({ width: img.naturalWidth, height: img.naturalHeight });
167
- setIsLoading(false);
168
- onLoad?.();
169
- };
170
- }
171
- };
172
- img.onerror = () => {
173
- setIsLoading(false);
174
- if (onError) {
175
- onError();
176
- return;
177
- }
178
- setHasError(true);
179
- };
180
- img.src = src;
181
- loadImage();
182
- }
183
- }, [src, shouldUseLazy, shouldLoad, imageSrc, onLoad, onError, decoding, fetchPriority]);
184
- const getAspectRatioClass = () => {
185
- switch (aspectRatio) {
186
- case "auto": {
187
- if (isLoading && !imageDimensions) {
188
- return "aspect-[4/3]";
189
- }
190
- return "";
191
- }
192
- case "1/1": {
193
- return "aspect-square";
194
- }
195
- case "4/3": {
196
- return "aspect-[4/3]";
197
- }
198
- case "3/4": {
199
- return "aspect-[3/4]";
200
- }
201
- case "16/9": {
202
- return "aspect-video";
203
- }
204
- case "9/16": {
205
- return "aspect-[9/16]";
206
- }
207
- case "2/3": {
208
- return "aspect-[2/3]";
209
- }
210
- case "3/2": {
211
- return "aspect-[3/2]";
212
- }
213
- case "5/4": {
214
- return "aspect-[5/4]";
215
- }
216
- case "21/9": {
217
- return "aspect-[21/9]";
218
- }
219
- case "9/21": {
220
- return "aspect-[9/21]";
221
- }
222
- default: {
223
- return "aspect-video";
224
- }
225
- }
226
- };
227
- if (!src) {
228
- return /* @__PURE__ */ jsx(
229
- "div",
230
- {
231
- className: cn(
232
- "flex items-center justify-center bg-muted p-8",
233
- getAspectRatioClass(),
234
- containerClassName,
235
- className
236
- ),
237
- ...props,
238
- children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: fallbackText })
239
- }
240
- );
241
- }
242
- if (hasError) {
243
- return /* @__PURE__ */ jsx(
244
- "div",
245
- {
246
- className: cn(
247
- "flex items-center justify-center bg-muted p-8",
248
- getAspectRatioClass(),
249
- containerClassName,
250
- className
251
- ),
252
- ...props,
253
- children: /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: errorText })
254
- }
255
- );
256
- }
257
- const aspectRatioStyle = aspectRatio === "auto" && imageDimensions ? { aspectRatio: `${imageDimensions.width} / ${imageDimensions.height}` } : void 0;
258
- return /* @__PURE__ */ jsxs(
259
- "div",
260
- {
261
- className: cn("relative", getAspectRatioClass(), className, containerClassName),
262
- ref: shouldUseLazy ? lazyRef : void 0,
263
- style: aspectRatioStyle,
264
- ...props,
265
- children: [
266
- isLoading && showSkeleton && /* @__PURE__ */ jsx(Skeleton, { className: cn("absolute inset-0 h-full w-full", skeletonClassName) }),
267
- imageSrc && /* @__PURE__ */ jsx(
268
- ImageDisplay,
269
- {
270
- alt,
271
- aspectRatio,
272
- imageClassName,
273
- imageDimensions,
274
- imageSrc,
275
- isMobile,
276
- reducedMotion
277
- }
278
- )
279
- ]
280
- }
281
- );
282
- };
283
- var ImageDisplayComponent = ({
284
- imageSrc,
285
- alt,
286
- imageClassName,
287
- aspectRatio,
288
- imageDimensions,
289
- isMobile,
290
- reducedMotion
291
- }) => {
292
- const hasAnimatedBefore = animatedImagesCache.has(imageSrc);
293
- const animationTimerRef = useRef(null);
294
- useEffect(() => {
295
- if (!hasAnimatedBefore) {
296
- animationTimerRef.current = setTimeout(() => {
297
- animatedImagesCache.add(imageSrc);
298
- }, 500);
299
- }
300
- return () => {
301
- if (animationTimerRef.current) {
302
- clearTimeout(animationTimerRef.current);
303
- }
304
- };
305
- }, [imageSrc, hasAnimatedBefore]);
306
- const skipAnimation = hasAnimatedBefore || reducedMotion || isMobile;
307
- if (aspectRatio === "auto") {
308
- return skipAnimation ? /* @__PURE__ */ jsx(
309
- "img",
310
- {
311
- alt: alt || "Image",
312
- className: cn("h-auto w-full object-cover", imageClassName),
313
- decoding: "async",
314
- height: imageDimensions?.height ?? 600,
315
- src: imageSrc,
316
- style: { pointerEvents: "none" },
317
- width: imageDimensions?.width ?? 800
318
- }
319
- ) : /* @__PURE__ */ jsx(
320
- motion.img,
321
- {
322
- alt: alt || "Image",
323
- animate: { opacity: 1, scale: 1 },
324
- className: cn("h-auto w-full object-cover", imageClassName),
325
- decoding: "async",
326
- height: imageDimensions?.height ?? 600,
327
- initial: IMAGE_REVEAL_INITIAL,
328
- src: imageSrc,
329
- style: { pointerEvents: "none" },
330
- transition: IMAGE_REVEAL_TRANSITION,
331
- width: imageDimensions?.width ?? 800
332
- }
333
- );
334
- }
335
- return /* @__PURE__ */ jsx("div", { "aria-label": alt || "Image", className: "absolute inset-0 overflow-hidden", role: "img", children: skipAnimation ? (
336
- // Static for mobile/reduced motion/already animated - no animation conflicts
337
- /* @__PURE__ */ jsx(
338
- "div",
339
- {
340
- className: cn("absolute inset-0 bg-cover bg-center bg-no-repeat", imageClassName),
341
- style: {
342
- backgroundImage: `url("${imageSrc}")`,
343
- pointerEvents: "none"
344
- }
345
- }
346
- )
347
- ) : (
348
- // Framer Motion for desktop - but only animate on initial load
349
- /* @__PURE__ */ jsx(
350
- motion.div,
351
- {
352
- animate: IMAGE_REVEAL_ANIMATE,
353
- className: cn("absolute inset-0 bg-cover bg-center bg-no-repeat", imageClassName),
354
- initial: IMAGE_REVEAL_INITIAL,
355
- style: {
356
- backgroundImage: `url("${imageSrc}")`,
357
- pointerEvents: "none"
358
- },
359
- transition: IMAGE_REVEAL_TRANSITION
360
- }
361
- )
362
- ) });
363
- };
364
- var ImageDisplay = memo(ImageDisplayComponent, (prevProps, nextProps) => {
365
- return prevProps.imageSrc === nextProps.imageSrc && prevProps.aspectRatio === nextProps.aspectRatio && prevProps.isMobile === nextProps.isMobile && prevProps.reducedMotion === nextProps.reducedMotion;
366
- });
367
15
  var CHROME_IDLE_MS = 2500;
368
16
  function isRevealingPointer(event) {
369
17
  return event.pointerType !== "touch" && event.pointerType !== "pen";
@@ -1688,6 +1336,6 @@ function VideoThumbnail({ src, className }) {
1688
1336
  );
1689
1337
  }
1690
1338
 
1691
- export { Image, MediaLightbox, MediaLightboxZoomCursor, Video, VideoDialog, VideoManagerContext, VideoManagerProvider, VideoModal, VideoThumbnail, clearImageAnimationCache, isVideoSrc, useMediaLightbox, useMediaLightboxZoomCursor, useVideoManager };
1339
+ export { MediaLightbox, MediaLightboxZoomCursor, Video, VideoDialog, VideoManagerContext, VideoManagerProvider, VideoModal, VideoThumbnail, isVideoSrc, useMediaLightbox, useMediaLightboxZoomCursor, useVideoManager };
1692
1340
  //# sourceMappingURL=index.js.map
1693
1341
  //# sourceMappingURL=index.js.map