@opensite/ui 2.3.6 → 2.3.8

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.
@@ -812,7 +812,7 @@ function AboutSplitHero({
812
812
  }
813
813
  }, [background]);
814
814
  const desktopOrder = directionConfig.desktop === "mediaRight" ? "lg:flex-row" : "lg:flex-row-reverse";
815
- const mobileOrder = directionConfig.mobile === "mediaTop" ? "flex-col" : "flex-col-reverse";
815
+ const mobileOrder = directionConfig.mobile === "mediaTop" ? "flex-col-reverse" : "flex-col";
816
816
  const contentArea = /* @__PURE__ */ jsxRuntime.jsxs(
817
817
  "div",
818
818
  {
@@ -791,7 +791,7 @@ function AboutSplitHero({
791
791
  }
792
792
  }, [background]);
793
793
  const desktopOrder = directionConfig.desktop === "mediaRight" ? "lg:flex-row" : "lg:flex-row-reverse";
794
- const mobileOrder = directionConfig.mobile === "mediaTop" ? "flex-col" : "flex-col-reverse";
794
+ const mobileOrder = directionConfig.mobile === "mediaTop" ? "flex-col-reverse" : "flex-col";
795
795
  const contentArea = /* @__PURE__ */ jsxs(
796
796
  "div",
797
797
  {
@@ -6,6 +6,7 @@ var clsx = require('clsx');
6
6
  var tailwindMerge = require('tailwind-merge');
7
7
  var img = require('@page-speed/img');
8
8
  var jsxRuntime = require('react/jsx-runtime');
9
+ var lightbox = require('@page-speed/lightbox');
9
10
 
10
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
12
 
@@ -401,11 +402,31 @@ function AboutStoryGallery({
401
402
  imagesClassName,
402
403
  optixFlowConfig,
403
404
  background,
404
- spacing = "py-8 md:py-32",
405
+ spacing = "lg",
405
406
  containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
406
407
  pattern,
407
408
  patternOpacity
408
409
  }) {
410
+ const [lightboxOpen, setLightboxOpen] = React.useState(false);
411
+ const [lightboxIndex, setLightboxIndex] = React.useState(0);
412
+ const lightboxItems = React.useMemo(
413
+ () => (images ?? []).map((img, index) => ({
414
+ id: `gallery-image-${index}`,
415
+ type: "image",
416
+ src: img.src,
417
+ alt: img.alt,
418
+ download: true,
419
+ share: true
420
+ })),
421
+ [images]
422
+ );
423
+ const handleImageClick = React.useCallback((index) => {
424
+ setLightboxIndex(index);
425
+ setLightboxOpen(true);
426
+ }, []);
427
+ const handleLightboxClose = React.useCallback(() => {
428
+ setLightboxOpen(false);
429
+ }, []);
409
430
  const imagesContent = React.useMemo(() => {
410
431
  if (imagesSlot) return imagesSlot;
411
432
  if (!images || images.length === 0) return null;
@@ -417,21 +438,38 @@ function AboutStoryGallery({
417
438
  imagesClassName
418
439
  ),
419
440
  children: images.map((image, idx) => /* @__PURE__ */ jsxRuntime.jsx(
420
- img.Img,
441
+ "div",
421
442
  {
422
- src: image.src,
423
- alt: image.alt,
424
443
  className: cn(
425
- "h-64 w-full rounded-xl object-cover",
426
- image.className
444
+ "cursor-pointer overflow-hidden",
445
+ "rounded-xl transition-transform duration-500",
446
+ "hover:scale-[1.02] hover:shadow-lg"
427
447
  ),
428
- optixFlowConfig
448
+ onClick: () => handleImageClick(idx),
449
+ role: "button",
450
+ tabIndex: 0,
451
+ onKeyDown: (e) => {
452
+ if (e.key === "Enter" || e.key === " ") {
453
+ e.preventDefault();
454
+ handleImageClick(idx);
455
+ }
456
+ },
457
+ "aria-label": `View ${image.alt} in lightbox`,
458
+ children: /* @__PURE__ */ jsxRuntime.jsx(
459
+ img.Img,
460
+ {
461
+ src: image.src,
462
+ alt: image.alt,
463
+ className: cn("h-64 w-full object-cover", image.className),
464
+ optixFlowConfig
465
+ }
466
+ )
429
467
  },
430
468
  idx
431
469
  ))
432
470
  }
433
471
  );
434
- }, [imagesSlot, images, imagesClassName, optixFlowConfig]);
472
+ }, [imagesSlot, images, imagesClassName, optixFlowConfig, handleImageClick]);
435
473
  return /* @__PURE__ */ jsxRuntime.jsxs(
436
474
  Section,
437
475
  {
@@ -464,7 +502,28 @@ function AboutStoryGallery({
464
502
  }
465
503
  ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("mt-6", descriptionClassName), children: description }))
466
504
  ] }),
467
- imagesContent
505
+ imagesContent,
506
+ lightboxOpen && /* @__PURE__ */ jsxRuntime.jsx(
507
+ lightbox.Lightbox,
508
+ {
509
+ items: lightboxItems,
510
+ initialIndex: lightboxIndex,
511
+ layout: "horizontal",
512
+ controls: {
513
+ navigation: true,
514
+ thumbnails: true,
515
+ download: true,
516
+ share: true,
517
+ fullscreen: true,
518
+ captions: true,
519
+ counter: true
520
+ },
521
+ onClose: handleLightboxClose,
522
+ enableKeyboardShortcuts: true,
523
+ closeOnEscape: true,
524
+ closeOnBackdropClick: true
525
+ }
526
+ )
468
527
  ]
469
528
  }
470
529
  );
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import React, { useMemo } from 'react';
2
+ import React, { useState, useMemo, useCallback } from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { Img } from '@page-speed/img';
6
6
  import { jsx, jsxs } from 'react/jsx-runtime';
7
+ import { Lightbox } from '@page-speed/lightbox';
7
8
 
8
9
  // components/blocks/about/about-story-gallery.tsx
9
10
  function cn(...inputs) {
@@ -395,11 +396,31 @@ function AboutStoryGallery({
395
396
  imagesClassName,
396
397
  optixFlowConfig,
397
398
  background,
398
- spacing = "py-8 md:py-32",
399
+ spacing = "lg",
399
400
  containerClassName = "px-6 sm:px-6 md:px-8 lg:px-8",
400
401
  pattern,
401
402
  patternOpacity
402
403
  }) {
404
+ const [lightboxOpen, setLightboxOpen] = useState(false);
405
+ const [lightboxIndex, setLightboxIndex] = useState(0);
406
+ const lightboxItems = useMemo(
407
+ () => (images ?? []).map((img, index) => ({
408
+ id: `gallery-image-${index}`,
409
+ type: "image",
410
+ src: img.src,
411
+ alt: img.alt,
412
+ download: true,
413
+ share: true
414
+ })),
415
+ [images]
416
+ );
417
+ const handleImageClick = useCallback((index) => {
418
+ setLightboxIndex(index);
419
+ setLightboxOpen(true);
420
+ }, []);
421
+ const handleLightboxClose = useCallback(() => {
422
+ setLightboxOpen(false);
423
+ }, []);
403
424
  const imagesContent = useMemo(() => {
404
425
  if (imagesSlot) return imagesSlot;
405
426
  if (!images || images.length === 0) return null;
@@ -411,21 +432,38 @@ function AboutStoryGallery({
411
432
  imagesClassName
412
433
  ),
413
434
  children: images.map((image, idx) => /* @__PURE__ */ jsx(
414
- Img,
435
+ "div",
415
436
  {
416
- src: image.src,
417
- alt: image.alt,
418
437
  className: cn(
419
- "h-64 w-full rounded-xl object-cover",
420
- image.className
438
+ "cursor-pointer overflow-hidden",
439
+ "rounded-xl transition-transform duration-500",
440
+ "hover:scale-[1.02] hover:shadow-lg"
421
441
  ),
422
- optixFlowConfig
442
+ onClick: () => handleImageClick(idx),
443
+ role: "button",
444
+ tabIndex: 0,
445
+ onKeyDown: (e) => {
446
+ if (e.key === "Enter" || e.key === " ") {
447
+ e.preventDefault();
448
+ handleImageClick(idx);
449
+ }
450
+ },
451
+ "aria-label": `View ${image.alt} in lightbox`,
452
+ children: /* @__PURE__ */ jsx(
453
+ Img,
454
+ {
455
+ src: image.src,
456
+ alt: image.alt,
457
+ className: cn("h-64 w-full object-cover", image.className),
458
+ optixFlowConfig
459
+ }
460
+ )
423
461
  },
424
462
  idx
425
463
  ))
426
464
  }
427
465
  );
428
- }, [imagesSlot, images, imagesClassName, optixFlowConfig]);
466
+ }, [imagesSlot, images, imagesClassName, optixFlowConfig, handleImageClick]);
429
467
  return /* @__PURE__ */ jsxs(
430
468
  Section,
431
469
  {
@@ -458,7 +496,28 @@ function AboutStoryGallery({
458
496
  }
459
497
  ) : /* @__PURE__ */ jsx("div", { className: cn("mt-6", descriptionClassName), children: description }))
460
498
  ] }),
461
- imagesContent
499
+ imagesContent,
500
+ lightboxOpen && /* @__PURE__ */ jsx(
501
+ Lightbox,
502
+ {
503
+ items: lightboxItems,
504
+ initialIndex: lightboxIndex,
505
+ layout: "horizontal",
506
+ controls: {
507
+ navigation: true,
508
+ thumbnails: true,
509
+ download: true,
510
+ share: true,
511
+ fullscreen: true,
512
+ captions: true,
513
+ counter: true
514
+ },
515
+ onClose: handleLightboxClose,
516
+ enableKeyboardShortcuts: true,
517
+ closeOnEscape: true,
518
+ closeOnBackdropClick: true
519
+ }
520
+ )
462
521
  ]
463
522
  }
464
523
  );