@yamatozhen/design_system 1.0.0

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 (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +101 -0
  3. package/package.json +49 -0
  4. package/scripts/postinstall.js +105 -0
  5. package/template/app/ClientNav.tsx +310 -0
  6. package/template/app/globals.css +167 -0
  7. package/template/app/layout.tsx +128 -0
  8. package/template/app/themes/dark-mc.css +51 -0
  9. package/template/app/themes/dark.css +51 -0
  10. package/template/app/themes/light-mc.css +51 -0
  11. package/template/app/themes/light.css +51 -0
  12. package/template/app/themes/theme.css +82 -0
  13. package/template/components/layout/Lightbox/LightboxCard.tsx +100 -0
  14. package/template/components/layout/Lightbox/LightboxGallery.module.css +249 -0
  15. package/template/components/layout/Lightbox/LightboxGallery.tsx +72 -0
  16. package/template/components/layout/Lightbox/LightboxGrid.tsx +186 -0
  17. package/template/components/layout/Lightbox/LightboxModal.module.css +395 -0
  18. package/template/components/layout/Lightbox/LightboxModal.tsx +500 -0
  19. package/template/components/layout/Lightbox/demo.tsx +412 -0
  20. package/template/components/layout/Lightbox/index.ts +30 -0
  21. package/template/components/layout/Lightbox/types.ts +113 -0
  22. package/template/components/layout/Lightbox/useLightboxFilters.ts +140 -0
  23. package/template/components/layout/accordion/Accordion.module.css +149 -0
  24. package/template/components/layout/accordion/Accordion.tsx +114 -0
  25. package/template/components/layout/button/Button.module.css +305 -0
  26. package/template/components/layout/button/ButtonGroup.tsx +503 -0
  27. package/template/components/layout/button/FAB.tsx +118 -0
  28. package/template/components/layout/button/button.tsx +128 -0
  29. package/template/components/layout/button/drop.module.css +229 -0
  30. package/template/components/layout/button/drop.tsx +516 -0
  31. package/template/components/layout/hero/v1/heroSlideshow.module.css +107 -0
  32. package/template/components/layout/hero/v1/heroSlideshow.tsx +233 -0
  33. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.module.css +126 -0
  34. package/template/components/layout/modals/accessibilityModal/AccessibilityModal.tsx +290 -0
  35. package/template/components/layout/modals/alert/Alert.tsx +188 -0
  36. package/template/components/layout/navigation/MioCard.module.css +88 -0
  37. package/template/components/layout/navigation/MioCard.tsx +266 -0
  38. package/template/components/layout/navigation/Wrap.tsx +41 -0
  39. package/template/components/layout/navigation/nav/Nav.module.css +508 -0
  40. package/template/components/layout/navigation/nav/Nav.tsx +167 -0
  41. package/template/components/layout/navigation/nav/NavBar.tsx +419 -0
  42. package/template/components/layout/navigation/nav/NavContext.tsx +259 -0
  43. package/template/components/layout/navigation/nav/NavItem.tsx +173 -0
  44. package/template/components/layout/navigation/nav/NavNew.module.css +373 -0
  45. package/template/components/layout/navigation/nav/NavRail.tsx +315 -0
  46. package/template/components/layout/navigation/nav/NavSection.tsx +102 -0
  47. package/template/components/layout/navigation/nav/NavTab.tsx +25 -0
  48. package/template/components/layout/navigation/nav/navftb/NavFTB.module.css +252 -0
  49. package/template/components/layout/navigation/nav/navftb/NavFTB.tsx +399 -0
  50. package/template/components/layout/navigation/nav/navftb/useTabIndicator.ts +484 -0
  51. package/template/components/layout/navigation/nav/navheader/NavHeader.module.css +59 -0
  52. package/template/components/layout/navigation/nav/navheader/NavHeader.tsx +478 -0
  53. package/template/components/layout/pages/loadingScreen.tsx +102 -0
  54. package/template/components/layout/pages/maintenance/Maintenance.tsx +53 -0
  55. package/template/components/layout/pages/maintenance/maintenance.module.css +163 -0
  56. package/template/components/layout/switch/Switch.module.css +102 -0
  57. package/template/components/layout/switch/Switch.tsx +48 -0
  58. package/template/components/tools/Divider.tsx +11 -0
  59. package/template/components/tools/ProgressiveBlur.tsx +73 -0
  60. package/template/components/tools/ReduceMotionContext.tsx +5 -0
  61. package/template/components/tools/Sinewave.tsx +199 -0
  62. package/template/components/tools/SinewaveProgress.tsx +135 -0
  63. package/template/components/tools/badge/Badge.tsx +28 -0
  64. package/template/components/tools/flubber.d.ts +7 -0
  65. package/template/components/tools/icon/SocialIcons.tsx +88 -0
  66. package/template/components/tools/icon/icon.module.css +0 -0
  67. package/template/components/tools/icon/icon.tsx +125 -0
  68. package/template/components/tools/mobileViewProvider.tsx +58 -0
  69. package/template/components/tools/react-bits/ClickSpark.tsx +177 -0
  70. package/template/components/tools/react-bits/FadeContent.tsx +90 -0
  71. package/template/components/tools/react-bits/GlareHover.tsx +73 -0
  72. package/template/components/tools/react-bits/GradientText/GradientText.css +70 -0
  73. package/template/components/tools/react-bits/GradientText/GradientText.tsx +44 -0
  74. package/template/components/tools/react-bits/Magnet.tsx +118 -0
  75. package/template/components/tools/react-bits/Stepper/Stepper.css +134 -0
  76. package/template/components/tools/react-bits/Stepper/Stepper.tsx +412 -0
  77. package/template/components/tools/ripple/ripple.css +41 -0
  78. package/template/components/tools/ripple/ripple.tsx +53 -0
  79. package/template/components/tools/shape/ShapeLoader.tsx +101 -0
  80. package/template/components/tools/shape/ShapeMorph.tsx +190 -0
  81. package/template/components/tools/shape/ShapePaths.ts +116 -0
  82. package/template/components/tools/switch/Switch.module.css +102 -0
  83. package/template/components/tools/switch/Switch.tsx +48 -0
  84. package/template/components/tools/useBodyScrollLock.tsx +27 -0
  85. package/template/components/tools/useImageColor.ts +47 -0
  86. package/template/components/tools/useNavSheetDrag.tsx +196 -0
  87. package/template/public/fonts/material-symbols/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
@@ -0,0 +1,51 @@
1
+ .dark {
2
+ --md-sys-color-primary: rgb(140 207 240);
3
+ --md-sys-color-surface-tint: rgb(140 207 240);
4
+ --md-sys-color-on-primary: rgb(0 53 71);
5
+ --md-sys-color-primary-container: rgb(0 77 101);
6
+ --md-sys-color-on-primary-container: rgb(191 232 255);
7
+ --md-sys-color-secondary: rgb(180 202 214);
8
+ --md-sys-color-on-secondary: rgb(31 51 61);
9
+ --md-sys-color-secondary-container: rgb(54 73 84);
10
+ --md-sys-color-on-secondary-container: rgb(208 230 243);
11
+ --md-sys-color-tertiary: rgb(199 194 234);
12
+ --md-sys-color-on-tertiary: rgb(47 45 76);
13
+ --md-sys-color-tertiary-container: rgb(70 67 100);
14
+ --md-sys-color-on-tertiary-container: rgb(228 223 255);
15
+ --md-sys-color-error: rgb(255 180 171);
16
+ --md-sys-color-on-error: rgb(105 0 5);
17
+ --md-sys-color-error-container: rgb(147 0 10);
18
+ --md-sys-color-on-error-container: rgb(255 218 214);
19
+ --md-sys-color-background: rgb(15 20 23);
20
+ --md-sys-color-on-background: rgb(223 227 231);
21
+ --md-sys-color-surface: rgb(15 20 23);
22
+ --md-sys-color-on-surface: rgb(223 227 231);
23
+ --md-sys-color-surface-variant: rgb(64 72 76);
24
+ --md-sys-color-on-surface-variant: rgb(192 200 205);
25
+ --md-sys-color-outline: rgb(138 146 151);
26
+ --md-sys-color-outline-variant: rgb(64 72 76);
27
+ --md-sys-color-shadow: rgb(0 0 0);
28
+ --md-sys-color-scrim: rgb(0 0 0);
29
+ --md-sys-color-inverse-surface: rgb(223 227 231);
30
+ --md-sys-color-inverse-on-surface: rgb(44 49 52);
31
+ --md-sys-color-inverse-primary: rgb(21 102 131);
32
+ --md-sys-color-primary-fixed: rgb(191 232 255);
33
+ --md-sys-color-on-primary-fixed: rgb(0 31 42);
34
+ --md-sys-color-primary-fixed-dim: rgb(140 207 240);
35
+ --md-sys-color-on-primary-fixed-variant: rgb(0 77 101);
36
+ --md-sys-color-secondary-fixed: rgb(208 230 243);
37
+ --md-sys-color-on-secondary-fixed: rgb(8 30 39);
38
+ --md-sys-color-secondary-fixed-dim: rgb(180 202 214);
39
+ --md-sys-color-on-secondary-fixed-variant: rgb(54 73 84);
40
+ --md-sys-color-tertiary-fixed: rgb(228 223 255);
41
+ --md-sys-color-on-tertiary-fixed: rgb(26 24 54);
42
+ --md-sys-color-tertiary-fixed-dim: rgb(199 194 234);
43
+ --md-sys-color-on-tertiary-fixed-variant: rgb(70 67 100);
44
+ --md-sys-color-surface-dim: rgb(15 20 23);
45
+ --md-sys-color-surface-bright: rgb(53 58 61);
46
+ --md-sys-color-surface-container-lowest: rgb(10 15 18);
47
+ --md-sys-color-surface-container-low: rgb(23 28 31);
48
+ --md-sys-color-surface-container: rgb(27 32 35);
49
+ --md-sys-color-surface-container-high: rgb(38 43 46);
50
+ --md-sys-color-surface-container-highest: rgb(48 53 56);
51
+ }
@@ -0,0 +1,51 @@
1
+ .light-medium-contrast {
2
+ --md-sys-color-primary: rgb(0 59 79);
3
+ --md-sys-color-surface-tint: rgb(21 102 131);
4
+ --md-sys-color-on-primary: rgb(255 255 255);
5
+ --md-sys-color-primary-container: rgb(43 117 147);
6
+ --md-sys-color-on-primary-container: rgb(255 255 255);
7
+ --md-sys-color-secondary: rgb(37 57 67);
8
+ --md-sys-color-on-secondary: rgb(255 255 255);
9
+ --md-sys-color-secondary-container: rgb(92 112 123);
10
+ --md-sys-color-on-secondary-container: rgb(255 255 255);
11
+ --md-sys-color-tertiary: rgb(53 50 83);
12
+ --md-sys-color-on-tertiary: rgb(255 255 255);
13
+ --md-sys-color-tertiary-container: rgb(109 105 141);
14
+ --md-sys-color-on-tertiary-container: rgb(255 255 255);
15
+ --md-sys-color-error: rgb(116 0 6);
16
+ --md-sys-color-on-error: rgb(255 255 255);
17
+ --md-sys-color-error-container: rgb(207 44 39);
18
+ --md-sys-color-on-error-container: rgb(255 255 255);
19
+ --md-sys-color-background: rgb(246 250 254);
20
+ --md-sys-color-on-background: rgb(23 28 31);
21
+ --md-sys-color-surface: rgb(246 250 254);
22
+ --md-sys-color-on-surface: rgb(13 18 21);
23
+ --md-sys-color-surface-variant: rgb(220 227 233);
24
+ --md-sys-color-on-surface-variant: rgb(48 55 60);
25
+ --md-sys-color-outline: rgb(76 84 88);
26
+ --md-sys-color-outline-variant: rgb(102 110 115);
27
+ --md-sys-color-shadow: rgb(0 0 0);
28
+ --md-sys-color-scrim: rgb(0 0 0);
29
+ --md-sys-color-inverse-surface: rgb(44 49 52);
30
+ --md-sys-color-inverse-on-surface: rgb(237 241 245);
31
+ --md-sys-color-inverse-primary: rgb(140 207 240);
32
+ --md-sys-color-primary-fixed: rgb(43 117 147);
33
+ --md-sys-color-on-primary-fixed: rgb(255 255 255);
34
+ --md-sys-color-primary-fixed-dim: rgb(0 92 120);
35
+ --md-sys-color-on-primary-fixed-variant: rgb(255 255 255);
36
+ --md-sys-color-secondary-fixed: rgb(92 112 123);
37
+ --md-sys-color-on-secondary-fixed: rgb(255 255 255);
38
+ --md-sys-color-secondary-fixed-dim: rgb(68 88 98);
39
+ --md-sys-color-on-secondary-fixed-variant: rgb(255 255 255);
40
+ --md-sys-color-tertiary-fixed: rgb(109 105 141);
41
+ --md-sys-color-on-tertiary-fixed: rgb(255 255 255);
42
+ --md-sys-color-tertiary-fixed-dim: rgb(84 81 115);
43
+ --md-sys-color-on-tertiary-fixed-variant: rgb(255 255 255);
44
+ --md-sys-color-surface-dim: rgb(195 199 203);
45
+ --md-sys-color-surface-bright: rgb(246 250 254);
46
+ --md-sys-color-surface-container-lowest: rgb(255 255 255);
47
+ --md-sys-color-surface-container-low: rgb(240 244 248);
48
+ --md-sys-color-surface-container: rgb(228 233 236);
49
+ --md-sys-color-surface-container-high: rgb(217 221 225);
50
+ --md-sys-color-surface-container-highest: rgb(206 210 214);
51
+ }
@@ -0,0 +1,51 @@
1
+ .light {
2
+ --md-sys-color-primary: rgb(21 102 131);
3
+ --md-sys-color-surface-tint: rgb(21 102 131);
4
+ --md-sys-color-on-primary: rgb(255 255 255);
5
+ --md-sys-color-primary-container: rgb(191 232 255);
6
+ --md-sys-color-on-primary-container: rgb(0 77 101);
7
+ --md-sys-color-secondary: rgb(77 97 108);
8
+ --md-sys-color-on-secondary: rgb(255 255 255);
9
+ --md-sys-color-secondary-container: rgb(208 230 243);
10
+ --md-sys-color-on-secondary-container: rgb(54 73 84);
11
+ --md-sys-color-tertiary: rgb(94 90 125);
12
+ --md-sys-color-on-tertiary: rgb(255 255 255);
13
+ --md-sys-color-tertiary-container: rgb(228 223 255);
14
+ --md-sys-color-on-tertiary-container: rgb(70 67 100);
15
+ --md-sys-color-error: rgb(186 26 26);
16
+ --md-sys-color-on-error: rgb(255 255 255);
17
+ --md-sys-color-error-container: rgb(255 218 214);
18
+ --md-sys-color-on-error-container: rgb(147 0 10);
19
+ --md-sys-color-background: rgb(246 250 254);
20
+ --md-sys-color-on-background: rgb(23 28 31);
21
+ --md-sys-color-surface: rgb(246 250 254);
22
+ --md-sys-color-on-surface: rgb(23 28 31);
23
+ --md-sys-color-surface-variant: rgb(220 227 233);
24
+ --md-sys-color-on-surface-variant: rgb(64 72 76);
25
+ --md-sys-color-outline: rgb(112 120 125);
26
+ --md-sys-color-outline-variant: rgb(192 200 205);
27
+ --md-sys-color-shadow: rgb(0 0 0);
28
+ --md-sys-color-scrim: rgb(0 0 0);
29
+ --md-sys-color-inverse-surface: rgb(44 49 52);
30
+ --md-sys-color-inverse-on-surface: rgb(237 241 245);
31
+ --md-sys-color-inverse-primary: rgb(140 207 240);
32
+ --md-sys-color-primary-fixed: rgb(191 232 255);
33
+ --md-sys-color-on-primary-fixed: rgb(0 31 42);
34
+ --md-sys-color-primary-fixed-dim: rgb(140 207 240);
35
+ --md-sys-color-on-primary-fixed-variant: rgb(0 77 101);
36
+ --md-sys-color-secondary-fixed: rgb(208 230 243);
37
+ --md-sys-color-on-secondary-fixed: rgb(8 30 39);
38
+ --md-sys-color-secondary-fixed-dim: rgb(180 202 214);
39
+ --md-sys-color-on-secondary-fixed-variant: rgb(54 73 84);
40
+ --md-sys-color-tertiary-fixed: rgb(228 223 255);
41
+ --md-sys-color-on-tertiary-fixed: rgb(26 24 54);
42
+ --md-sys-color-tertiary-fixed-dim: rgb(199 194 234);
43
+ --md-sys-color-on-tertiary-fixed-variant: rgb(70 67 100);
44
+ --md-sys-color-surface-dim: rgb(214 218 222);
45
+ --md-sys-color-surface-bright: rgb(246 250 254);
46
+ --md-sys-color-surface-container-lowest: rgb(255 255 255);
47
+ --md-sys-color-surface-container-low: rgb(240 244 248);
48
+ --md-sys-color-surface-container: rgb(234 238 242);
49
+ --md-sys-color-surface-container-high: rgb(228 233 236);
50
+ --md-sys-color-surface-container-highest: rgb(223 227 231);
51
+ }
@@ -0,0 +1,82 @@
1
+ /*
2
+ * theme.css — non-colour design tokens only.
3
+ *
4
+ * MD colour tokens are owned by the auto-generated palette files:
5
+ * light.css / dark.css / light-hc.css / dark-hc.css
6
+ * The right palette is activated by applying one class to <html>:
7
+ * .light | .dark | .light-high-contrast | .dark-high-contrast
8
+ */
9
+
10
+ /* ── Shared defaults ──────────────────────────────────────────────────────── */
11
+ :root {
12
+ --transition-expressive-fast: 500ms cubic-bezier(0.55, 0.75, 0.15, 1.87);
13
+ --transition-expressive: 500ms cubic-bezier(0.55, 0.57, 0, 1.58);
14
+ --transition-expressive-slow: 500ms cubic-bezier(0.01, 1.25, 0.23, 1.01);
15
+ --transition-expressive-color: 0.2s ease-out;
16
+ --transition-expressive-fast-alt: cubic-bezier(0.01, 1.25, 0.23, 1.01);
17
+
18
+ /* Button gradient mix strength */
19
+ --btn-gradient-mix: 30%;
20
+
21
+ /*System Background*/
22
+ --sys-background: white;
23
+
24
+ /* Light-mode defaults */
25
+ --globalUIBorder: rgba(0, 0, 0, 0.05);
26
+ --globalUIBorderCard: rgba(0, 0, 0, 0.075);
27
+ --filterBrightness: brightness(0.9);
28
+ --customRipple: rgba(0, 0, 0, 0.08);
29
+
30
+ /* Accessibility — Show Borders */
31
+ --a11y-border-color: rgba(0, 0, 0, 0.85);
32
+ --a11y-border: 2px solid var(--a11y-border-color);
33
+
34
+ --transparencyValue: 50%;
35
+ --transparencyValue2: 25%;
36
+ }
37
+
38
+ /* ── Dark-mode overrides for non-colour tokens ────────────────────────────── */
39
+ .dark,
40
+ .dark-medium-contrast {
41
+ --globalUIBorder: rgba(255, 255, 255, 0.05);
42
+ --globalUIBorderCard: rgba(255, 255, 255, 0.075);
43
+ --customRipple: rgba(255, 255, 255, 0.1);
44
+ --filterBrightness: brightness(1.3);
45
+ --a11y-border-color: rgba(255, 255, 255, 0.9);
46
+
47
+ --transparencyValue: 75%;
48
+ --transparencyValue2: 50%;
49
+
50
+ /*System Background*/
51
+ --sys-background: rgb(0, 0, 0);
52
+ }
53
+
54
+ /* ── Light-mode overrides — beats the OS-dark media-query fallback below ───── */
55
+ .light,
56
+ .light-medium-contrast {
57
+ --globalUIBorder: rgba(0, 0, 0, 0.05);
58
+ --globalUIBorderCard: rgba(0, 0, 0, 0.075);
59
+ --filterBrightness: brightness(0.9);
60
+ --customRipple: rgba(0, 0, 0, 0.08);
61
+ --transparencyValue: 50%;
62
+ --transparencyValue2: 25%;
63
+ }
64
+
65
+ /* ── Reduce motion ──────────────────────────────────────────────────────────── */
66
+ [data-reduce-motion="true"] {
67
+ --transition-expressive-fast: 0ms;
68
+ --transition-expressive: 0ms;
69
+ --transition-expressive-slow: 0ms;
70
+ --transition-expressive-color: 0ms;
71
+ --transition-expressive-fast-alt: steps(1);
72
+ }
73
+ /* Catches hardcoded durations in component CSS (Nav, MioCard, GradientText…) */
74
+ [data-reduce-motion="true"] * {
75
+ transition-duration: 0ms !important;
76
+ animation-duration: 1ms !important; /* 1ms not 0: animationend still fires so DOM cleanup works */
77
+ }
78
+
79
+ /* ── Disable brightness effect ──────────────────────────────────────────────── */
80
+ [data-disable-brightness="true"] {
81
+ --filterBrightness: brightness(1);
82
+ }
@@ -0,0 +1,100 @@
1
+ "use client";
2
+
3
+ import type { CSSProperties, MouseEvent } from "react";
4
+ import { useState, useCallback } from "react";
5
+ import Image from "next/image";
6
+ import type { LightboxItem } from "./types";
7
+ import { getDefaultSlide } from "./types";
8
+ import styles from "./LightboxGallery.module.css";
9
+ import ShapeMorph from "@/components/tools/shape/ShapeMorph";
10
+ import {
11
+ useBreakpoints,
12
+ useMediaQuery,
13
+ } from "@/components/tools/mobileViewProvider";
14
+
15
+ export interface LightboxCardProps {
16
+ item: LightboxItem;
17
+ onClick?: (item: LightboxItem) => void;
18
+ className?: string;
19
+ }
20
+
21
+ /**
22
+ * A single card in the gallery. Renders the grid-cell wrapper (responsible
23
+ * for grid placement) plus the inner visible card surface (the FLIP target).
24
+ *
25
+ * Card resolution by JS uses the `data-id` (on the cell) and `data-card`
26
+ * (on the inner surface) attributes — both stable regardless of CSS-Modules
27
+ * class hashing.
28
+ */
29
+ export function LightboxCard({ item, onClick, className }: LightboxCardProps) {
30
+ const [isHovered, setIsHovered] = useState(false);
31
+ const { isMobile, isTablet } = useBreakpoints();
32
+ useMediaQuery("(max-width: 812px)");
33
+
34
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
35
+ const handleClick = (_e: MouseEvent<HTMLDivElement>) => {
36
+ onClick?.(item);
37
+ };
38
+
39
+ const handleMouseEnter = useCallback(() => setIsHovered(true), []);
40
+ const handleMouseLeave = useCallback(() => setIsHovered(false), []);
41
+
42
+ const thumb = getDefaultSlide(item);
43
+
44
+ const cardStyle = {
45
+ "--lb-card-ratio": item.ratio,
46
+ ...(isMobile
47
+ ? { background: "var(--md-sys-color-surface-container-low)" }
48
+ : {}),
49
+ } as CSSProperties;
50
+
51
+ return (
52
+ <div
53
+ className={`${styles.gridCell}${className ? ` ${className}` : ""}`}
54
+ data-id={item.id}
55
+ data-span={item.span}
56
+ data-fav={item.favorite ? "true" : "false"}
57
+ onClick={handleClick}
58
+ >
59
+ <div
60
+ className={styles.card}
61
+ data-card=""
62
+ data-orient={item.orient}
63
+ style={cardStyle}
64
+ onMouseEnter={handleMouseEnter}
65
+ onMouseLeave={handleMouseLeave}
66
+ >
67
+ {thumb?.src ? (
68
+ <Image
69
+ fill
70
+ className={styles.cardImg}
71
+ src={thumb.src}
72
+ alt={thumb.alt ?? thumb.title ?? item.title ?? ""}
73
+ draggable={false}
74
+ />
75
+ ) : null}
76
+ <div className={styles.cardSquare} aria-hidden>
77
+ <ShapeMorph
78
+ shape={"circle"}
79
+ color="var(--md-sys-color-primary-container)"
80
+ isHovered={isHovered}
81
+ style={{ width: "100%", height: "100%" }}
82
+ />
83
+ </div>
84
+ </div>
85
+ {item.favorite ? (
86
+ <div className={styles.cardFav} aria-hidden>
87
+ <svg
88
+ xmlns="http://www.w3.org/2000/svg"
89
+ height="24px"
90
+ viewBox="0 -960 960 960"
91
+ width="24px"
92
+ fill="var(--md-sys-color-on-tertiary-container)"
93
+ >
94
+ <path d="m480-146.93-44.15-39.69q-99.46-90.23-164.5-155.07-65.04-64.85-103.08-115.43-38.04-50.57-53.15-92.27Q100-591.08 100-634q0-85.15 57.42-142.58Q214.85-834 300-834q52.38 0 99 24.5t81 70.27q34.38-45.77 81-70.27 46.62-24.5 99-24.5 85.15 0 142.58 57.42Q860-719.15 860-634q0 42.92-15.12 84.61-15.11 41.7-53.15 92.27-38.04 50.58-102.89 115.43Q624-276.85 524.15-186.62L480-146.93Z" />
95
+ </svg>
96
+ </div>
97
+ ) : null}
98
+ </div>
99
+ );
100
+ }
@@ -0,0 +1,249 @@
1
+ /* ============================================================
2
+ LightboxGallery — styles
3
+ ============================================================
4
+ Theming & transitions are exposed as CSS variables on .grid.
5
+ Override any of them from a parent selector to customize:
6
+
7
+ .my-section {
8
+ --lb-easing: cubic-bezier(.4, 0, .2, 1);
9
+ --lb-duration-grid: 600ms;
10
+ --lb-card-radius: 16px;
11
+ --lb-card-square-bg: hotpink;
12
+ }
13
+ ============================================================ */
14
+
15
+ .grid {
16
+ /* --- Geometry --- */
17
+ --lb-cell: 160px;
18
+ --lb-gap: 10px;
19
+
20
+ /* --- Card surface --- */
21
+ --lb-card-bg: var(--md-sys-color-surface-container-lowest);
22
+ --lb-card-bg-hover: var(--md-sys-color-surface-container-lowest);
23
+ --lb-card-radius: 24px;
24
+ --lb-card-radius-hover: 48px;
25
+
26
+ /* --- Hover-reveal square --- */
27
+ --lb-card-square-bg: transparent;
28
+ --lb-card-square-radius: 50%;
29
+ --lb-card-square-size: 90cqmin;
30
+ --lb-card-square-scale-rest: 0.9;
31
+ --lb-card-square-padding: 0;
32
+ --lb-card-square-overflow: visible;
33
+
34
+ /* --- Favorite badge --- */
35
+ --lb-fav-bg: var(--md-sys-color-tertiary-container);
36
+ --lb-fav-color: var(--md-sys-color-on-tertiary-container);
37
+
38
+ /* --- Motion tokens --- */
39
+ --lb-easing: var(--transition-expressive);
40
+ --lb-duration-grid: 400ms; /* read by JS for FLIP */
41
+ --lb-duration-square-fade: var(--transition-expressive-color);
42
+ --lb-duration-cell-lift: 200ms;
43
+
44
+ /* --- Hover lift --- */
45
+ --lb-cell-lift: 0px;
46
+
47
+ /* Layout */
48
+ display: grid;
49
+ grid-template-columns: repeat(auto-fill, minmax(var(--lb-cell), 1fr));
50
+ grid-auto-flow: dense;
51
+ gap: var(--lb-gap);
52
+ width: 100%;
53
+ }
54
+
55
+ .grid[data-mode="bento"] {
56
+ grid-auto-rows: var(--lb-cell);
57
+ }
58
+
59
+ .grid[data-mode="square"],
60
+ .grid[data-mode="aspect"] {
61
+ grid-auto-rows: auto;
62
+ }
63
+
64
+ /* ----- Grid cell wrapper ----- */
65
+ .gridCell {
66
+ position: relative;
67
+ cursor: pointer;
68
+ display: flex;
69
+ align-items: center;
70
+ justify-content: center;
71
+ transition: transform var(--lb-duration-cell-lift) ease;
72
+ }
73
+
74
+ .gridCell:hover {
75
+ transform: translateY(var(--lb-cell-lift));
76
+ }
77
+
78
+ /* Bento spans */
79
+ .grid[data-mode="bento"] .gridCell[data-span="2x2"] {
80
+ grid-column: span 2;
81
+ grid-row: span 2;
82
+ }
83
+ .grid[data-mode="bento"] .gridCell[data-span="2x1"] {
84
+ grid-column: span 2;
85
+ grid-row: span 1;
86
+ }
87
+ .grid[data-mode="bento"] .gridCell[data-span="1x2"] {
88
+ grid-column: span 1;
89
+ grid-row: span 2;
90
+ }
91
+ .grid[data-mode="bento"] .gridCell[data-span="1x1"] {
92
+ grid-column: span 1;
93
+ grid-row: span 1;
94
+ }
95
+
96
+ /* Square — uniform square cells */
97
+ .grid[data-mode="square"] .gridCell {
98
+ grid-column: span 1;
99
+ grid-row: span 1;
100
+ aspect-ratio: 1;
101
+ }
102
+
103
+ /* Aspect — square cells, image contained inside */
104
+ .grid[data-mode="aspect"] .gridCell {
105
+ grid-column: span 1;
106
+ grid-row: span 1;
107
+ aspect-ratio: 1;
108
+ padding: 4px;
109
+ }
110
+
111
+ /* ── Accessibility: Show Borders ──────────────────────────────────────── */
112
+ :global([data-show-borders="true"]) .card {
113
+ /* overflow:hidden clips border rendering on rounded elements in Chrome;
114
+ inset box-shadow is not subject to the element's own overflow clipping */
115
+ box-shadow: inset 0 0 0 2px var(--a11y-border-color) !important;
116
+ }
117
+
118
+ /* ----- Card surface (FLIP target) ----- */
119
+ .card {
120
+ background: var(--lb-card-bg);
121
+ border-radius: var(--lb-card-radius);
122
+ border: 1px solid var(--globalUIBorderCard);
123
+ width: 100%;
124
+ height: 100%;
125
+ position: relative;
126
+ overflow: hidden;
127
+ container-type: size;
128
+ transform-origin: 0 0;
129
+ transition:
130
+ background var(--lb-easing),
131
+ border-radius var(--lb-easing);
132
+ }
133
+
134
+ .gridCell:hover .card {
135
+ background: var(--lb-card-bg-hover);
136
+ border-radius: var(--lb-card-radius-hover);
137
+ }
138
+
139
+ /* Aspect-mode shapes — read --lb-card-ratio set inline on the element */
140
+ .grid[data-mode="aspect"] .card[data-orient="landscape"] {
141
+ width: 100%;
142
+ height: auto;
143
+ aspect-ratio: var(--lb-card-ratio);
144
+ }
145
+ .grid[data-mode="aspect"] .card[data-orient="portrait"] {
146
+ width: auto;
147
+ height: 100%;
148
+ aspect-ratio: var(--lb-card-ratio);
149
+ }
150
+ .grid[data-mode="aspect"] .card[data-orient="square"] {
151
+ width: 100%;
152
+ height: 100%;
153
+ }
154
+
155
+ /* ----- Image (when src is provided) ----- */
156
+ .cardImg {
157
+ position: absolute;
158
+ inset: 0;
159
+ width: 100%;
160
+ height: 100%;
161
+ object-fit: cover;
162
+ pointer-events: none;
163
+ user-select: none;
164
+ }
165
+
166
+ /* ----- Hover-reveal centered square ----- */
167
+ .cardSquare {
168
+ position: absolute;
169
+ top: 50%;
170
+ left: 50%;
171
+ padding: var(--lb-card-square-padding);
172
+ border-radius: var(--lb-card-square-radius);
173
+ width: var(--lb-card-square-size);
174
+ height: var(--lb-card-square-size);
175
+ background: var(--lb-card-square-bg);
176
+ transform: translate(-50%, -50%) scale(var(--lb-card-square-scale-rest));
177
+ opacity: 0;
178
+ pointer-events: none;
179
+ display: flex;
180
+ align-items: center;
181
+ justify-content: center;
182
+ overflow: var(--lb-card-square-overflow, hidden);
183
+ transition:
184
+ opacity var(--lb-duration-square-fade),
185
+ transform var(--lb-easing);
186
+ }
187
+
188
+ .gridCell:hover .cardSquare {
189
+ opacity: 1;
190
+ transform: translate(-50%, -50%) scale(1);
191
+ }
192
+
193
+ /* ----- Favorite badge ----- */
194
+ .cardFav {
195
+ position: absolute;
196
+ top: 6px;
197
+ right: 6px;
198
+ padding: 6px;
199
+ scale: 0.8;
200
+ border-radius: 99px;
201
+ background: var(--lb-fav-bg);
202
+ backdrop-filter: blur(6px);
203
+ -webkit-backdrop-filter: blur(6px);
204
+ display: flex;
205
+ align-items: center;
206
+ justify-content: center;
207
+ color: var(--lb-fav-color);
208
+ pointer-events: none;
209
+ transition:
210
+ top var(--transition-expressive-slow),
211
+ right var(--transition-expressive-slow),
212
+ scale var(--transition-expressive-slow);
213
+ }
214
+ .gridCell:hover .cardFav {
215
+ top: 12px;
216
+ right: 12px;
217
+ scale: 1;
218
+ transition:
219
+ top var(--transition-expressive),
220
+ right var(--transition-expressive),
221
+ scale var(--transition-expressive);
222
+ }
223
+
224
+ /* ----- Mobile (≤812px) ----- */
225
+ @media (max-width: 812px) {
226
+ .grid {
227
+ --lb-cell: 108px;
228
+ --lb-gap: 6px;
229
+ --lb-card-radius: 12px;
230
+ --lb-card-radius-hover: 36px;
231
+ }
232
+
233
+ /* Disable hover-lift on touch where hover is essentially "tap" */
234
+ .gridCell:hover {
235
+ transform: none;
236
+ }
237
+ }
238
+
239
+ /* Respect reduced motion */
240
+ @media (prefers-reduced-motion: reduce) {
241
+ .grid {
242
+ --lb-duration-grid: 1ms;
243
+ --lb-duration-card-hover: 1ms;
244
+ --lb-duration-card-radius: 1ms;
245
+ --lb-duration-square-fade: 1ms;
246
+ --lb-duration-square-scale: 1ms;
247
+ --lb-duration-cell-lift: 1ms;
248
+ }
249
+ }
@@ -0,0 +1,72 @@
1
+ "use client";
2
+
3
+ import type { CSSProperties, ReactNode } from "react";
4
+ import type { LightboxFilters, LightboxItem } from "./types";
5
+ import {
6
+ useLightboxFilters,
7
+ type UseLightboxFiltersOptions,
8
+ } from "./useLightboxFilters";
9
+ import { LightboxGrid } from "./LightboxGrid";
10
+
11
+ export interface LightboxGalleryProps {
12
+ items: LightboxItem[];
13
+ onCardClick?: (item: LightboxItem) => void;
14
+ className?: string;
15
+ style?: CSSProperties;
16
+ filterOptions?: UseLightboxFiltersOptions;
17
+ /**
18
+ * Optional render-prop. When provided, you receive the filter state +
19
+ * actions + filteredItems so you can render your own filter UI alongside
20
+ * `<LightboxGrid />`. When omitted, the gallery just renders the grid.
21
+ *
22
+ * @example
23
+ * <LightboxGallery items={items}>
24
+ * {({ state, actions, filteredItems }) => (
25
+ * <>
26
+ * <MyToolbar
27
+ * onBento={() => actions.setMode("bento")}
28
+ * onSquare={() => actions.setMode("square")}
29
+ * onAspect={() => actions.setMode("aspect")}
30
+ * />
31
+ * <LightboxGrid
32
+ * items={filteredItems}
33
+ * mode={state.mode}
34
+ * zoom={state.zoom}
35
+ * />
36
+ * </>
37
+ * )}
38
+ * </LightboxGallery>
39
+ */
40
+ children?: (filters: LightboxFilters) => ReactNode;
41
+ }
42
+
43
+ /**
44
+ * Convenience top-level gallery component. For most cases prefer calling
45
+ * `useLightboxFilters` directly in your page and rendering `<LightboxGrid />`
46
+ * yourself — that keeps the filter actions in your hands.
47
+ */
48
+ export function LightboxGallery({
49
+ items,
50
+ onCardClick,
51
+ className,
52
+ style,
53
+ filterOptions,
54
+ children,
55
+ }: LightboxGalleryProps) {
56
+ const filters = useLightboxFilters(items, filterOptions);
57
+
58
+ if (children) {
59
+ return <>{children(filters)}</>;
60
+ }
61
+
62
+ return (
63
+ <LightboxGrid
64
+ items={filters.filteredItems}
65
+ mode={filters.state.mode}
66
+ zoom={filters.state.zoom}
67
+ onCardClick={onCardClick}
68
+ className={className}
69
+ style={style}
70
+ />
71
+ );
72
+ }