@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,188 @@
1
+ "use client";
2
+ import { AnimatePresence, motion, MotionConfig } from "framer-motion";
3
+ import { useRef, useState, useEffect, useCallback, useMemo } from "react";
4
+ import { createPortal } from "react-dom";
5
+ import { useBodyScrollLock } from "@/components/tools/useBodyScrollLock";
6
+ import Button from "../../button/button";
7
+ import Icon from "@/components/tools/icon/icon";
8
+ import { useReduceMotion } from "@/components/tools/ReduceMotionContext";
9
+
10
+ interface alertProps {
11
+ submit: { label: string; systemName?: string };
12
+ cancel: { label: string; systemName?: string };
13
+ onSubmit: () => void;
14
+ onCancel: () => void;
15
+ isPresented: boolean;
16
+ padding?: number;
17
+ title?: string;
18
+ children?: React.ReactNode;
19
+ style?: React.CSSProperties;
20
+ }
21
+
22
+ // Static style objects extracted outside the component so they are allocated
23
+ // once rather than on every render.
24
+ const overlayStyle: React.CSSProperties = {
25
+ position: "fixed",
26
+ top: 0,
27
+ left: 0,
28
+ width: "100%",
29
+ height: "100%",
30
+ backgroundColor: "rgba(0, 0, 0, 0.4)",
31
+ backdropFilter: "blur(12px)",
32
+ WebkitBackdropFilter: "blur(12px)",
33
+ display: "flex",
34
+ alignItems: "center",
35
+ justifyContent: "center",
36
+ zIndex: 100000,
37
+ };
38
+
39
+ const dialogStyle: React.CSSProperties = {
40
+ display: "flex",
41
+ flexDirection: "column",
42
+ alignItems: "center",
43
+ justifyContent: "space-between",
44
+ gap: 12,
45
+ padding: "8px",
46
+ width: "min-content",
47
+ height: "auto",
48
+ minWidth: 360,
49
+ minHeight: 200,
50
+ maxWidth: "100dvw",
51
+ maxHeight: "90dvh",
52
+ margin: "5dvh 0",
53
+ overflowX: "hidden",
54
+ scrollBehavior: "smooth",
55
+ overflowY: "auto",
56
+ border: "1px solid var(--globalUIBorderCard)",
57
+ borderRadius: 36,
58
+ zIndex: 100002,
59
+ backgroundColor: "var(--md-sys-color-surface-container-low)",
60
+ };
61
+
62
+ const titleStyle: React.CSSProperties = {
63
+ width: "100%",
64
+ padding: "12px 20px",
65
+ fontWeight: 500,
66
+ color: "var(--md-sys-color-on-surface)",
67
+ };
68
+
69
+ const actionsStyle: React.CSSProperties = {
70
+ display: "flex",
71
+ width: "100%",
72
+ alignItems: "center",
73
+ padding: 4,
74
+ justifyContent: "space-between",
75
+ };
76
+
77
+ function Alert({
78
+ submit = { label: "confirm", systemName: "send" },
79
+ cancel = { label: "cancel" },
80
+ onSubmit,
81
+ onCancel,
82
+ padding,
83
+ style,
84
+ isPresented,
85
+ title = "Alert Title",
86
+ children,
87
+ }: alertProps) {
88
+ const rm = useReduceMotion();
89
+ useBodyScrollLock(isPresented);
90
+ const [mounted, setMounted] = useState(false);
91
+ useEffect(() => setMounted(true), []);
92
+
93
+ const scrollRef = useRef<HTMLDivElement>(null);
94
+ const [canScrollDown, setCanScrollDown] = useState(false);
95
+
96
+ const checkScroll = useCallback(() => {
97
+ const el = scrollRef.current;
98
+ if (!el) return;
99
+ setCanScrollDown(el.scrollHeight - el.scrollTop - el.clientHeight > 1);
100
+ }, []);
101
+
102
+ useEffect(() => {
103
+ const el = scrollRef.current;
104
+ if (!el || !isPresented) return;
105
+ checkScroll();
106
+ el.addEventListener("scroll", checkScroll, { passive: true });
107
+ return () => el.removeEventListener("scroll", checkScroll);
108
+ }, [checkScroll, isPresented]);
109
+
110
+ const handleScrollDown = useCallback(() => {
111
+ const el = scrollRef.current;
112
+ if (!el) return;
113
+ el.scrollTo({ top: el.scrollHeight, behavior: "smooth" });
114
+ }, []);
115
+
116
+ const scrollButtonStyle = useMemo<React.CSSProperties>(
117
+ () => ({
118
+ position: "sticky",
119
+ bottom: 1,
120
+ alignSelf: "center",
121
+ opacity: canScrollDown ? 1 : 0,
122
+ pointerEvents: canScrollDown ? "auto" : "none",
123
+ transition: "opacity var(--transition-expressive-color)",
124
+ zIndex: 1,
125
+ margin: "-24px",
126
+ }),
127
+ [canScrollDown],
128
+ );
129
+ // but is memoised to avoid a new object reference on unrelated re-renders.
130
+ const contentStyle = useMemo<React.CSSProperties>(
131
+ () => ({
132
+ display: "flex",
133
+ alignItems: "flex-start",
134
+ justifyContent: "flex-start",
135
+ width: "100%",
136
+ height: "fit-content",
137
+ padding: padding ? `${padding}px` : "6px 20px",
138
+ }),
139
+ [padding],
140
+ );
141
+
142
+ if (!mounted) return null;
143
+ return createPortal(
144
+ <MotionConfig reducedMotion={rm ? "always" : "never"}>
145
+ <AnimatePresence>
146
+ {isPresented && (
147
+ // A single animated overlay handles both the backdrop fade and the
148
+ // centred dialog — the redundant fixed backdrop div has been removed.
149
+ <motion.div
150
+ initial={{ opacity: 0 }}
151
+ animate={{ opacity: 1 }}
152
+ exit={{ opacity: 0 }}
153
+ style={overlayStyle}
154
+ >
155
+ <motion.div
156
+ ref={scrollRef}
157
+ initial={{ opacity: 0, scale: 1.1 }}
158
+ animate={{ opacity: 1, scale: 1 }}
159
+ exit={{ opacity: 0 }}
160
+ transition={{ duration: 0.3, ease: [0.55, 0.57, 0, 1.58] }}
161
+ style={{ ...dialogStyle, ...style }}
162
+ className="elevated a11y-modal-surface"
163
+ >
164
+ {title && <h4 style={titleStyle}>{title}</h4>}
165
+ <div style={contentStyle}>{children}</div>
166
+ <div style={scrollButtonStyle}>
167
+ <Button primary-bold onClick={handleScrollDown} elevated>
168
+ <Icon systemName="keyboard_arrow_down" />
169
+ </Button>
170
+ </div>
171
+ <div style={actionsStyle}>
172
+ <Button text onClick={onCancel}>
173
+ <Icon systemName={cancel.systemName} label={cancel.label} />
174
+ </Button>
175
+ <Button primary onClick={onSubmit}>
176
+ <Icon systemName={submit.systemName} label={submit.label} />
177
+ </Button>
178
+ </div>
179
+ </motion.div>
180
+ </motion.div>
181
+ )}
182
+ </AnimatePresence>
183
+ </MotionConfig>,
184
+ document.body,
185
+ );
186
+ }
187
+
188
+ export default Alert;
@@ -0,0 +1,88 @@
1
+ .mioBody {
2
+ position: relative;
3
+ display: flex;
4
+ flex-direction: column;
5
+ min-height: 102px;
6
+ padding: 0;
7
+ border-radius: 24px;
8
+ border: 1px solid var(--globalUIBorderCard);
9
+ background-color: var(--md-sys-color-surface-container-lowest);
10
+ transition:
11
+ background-color var(--transition-expressive-color),
12
+ border-radius var(--transition-expressive-fast);
13
+ min-width: 102px;
14
+ overflow: hidden;
15
+ &:hover {
16
+ border-radius: 48px;
17
+ cursor: pointer;
18
+ background-color: var(--md-sys-color-secondary-container);
19
+ }
20
+ &:active {
21
+ border-radius: 24px;
22
+ }
23
+ }
24
+
25
+ /* MD3 state layer — composited replacement for `filter: brightness`.
26
+ Animating opacity stays on the GPU instead of repainting the image + SVG.
27
+ Uses on-surface at spec opacities; swap to a brighten color if your old
28
+ --filterBrightness was lightening rather than dimming. */
29
+ .mioBody::after {
30
+ content: "";
31
+ position: absolute;
32
+ inset: 0;
33
+ z-index: 3;
34
+ border-radius: inherit;
35
+ background-color: var(--md-sys-color-on-surface);
36
+ opacity: 0;
37
+ pointer-events: none;
38
+ transition: opacity var(--transition-expressive-color);
39
+ }
40
+ .mioBody:hover::after {
41
+ opacity: 0.08;
42
+ }
43
+ .mioBody:active::after {
44
+ opacity: 0.12;
45
+ }
46
+
47
+ /* ── Accessibility: Show Borders ──────────────────────────────────────────── */
48
+ :global([data-show-borders="true"]) .mioBody {
49
+ border: var(--a11y-border);
50
+ }
51
+
52
+ .mioBody :global(.ripple) {
53
+ background-color: var(--globalUIBorderCard) !important;
54
+ opacity: 1;
55
+ animation: ripple-animation 1200ms linear;
56
+ }
57
+ @keyframes ripple-animation {
58
+ to {
59
+ transform: scale(4);
60
+ opacity: 0;
61
+ }
62
+ }
63
+
64
+ .mioContentWrapper {
65
+ position: relative;
66
+ display: flex;
67
+ flex-direction: row;
68
+ align-items: center;
69
+ justify-content: space-between;
70
+ width: auto;
71
+ height: 100%;
72
+ }
73
+
74
+ .mioIconWrapper path {
75
+ transition: fill var(--transition-expressive-color);
76
+ }
77
+
78
+ @media screen and (max-width: 812px) {
79
+ .mioBody {
80
+ border-radius: 36px;
81
+ &:hover {
82
+ border-radius: 60px;
83
+ }
84
+ &:active {
85
+ border-radius: 36px;
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,266 @@
1
+ "use client";
2
+ import React, { useState, useRef, useCallback, useMemo } from "react";
3
+ import Ripple, { RippleHandle } from "@/components/tools/ripple/ripple";
4
+ import Icon from "@/components/tools/icon/icon";
5
+ import styles from "./MioCard.module.css";
6
+ import { useNavRail } from "./nav/NavContext";
7
+ import Image from "next/image";
8
+ import dynamic from "next/dynamic";
9
+ import type { ShapeType } from "../../tools/shape/ShapePaths";
10
+ import { useBreakpoints } from "@/components/tools/mobileViewProvider";
11
+ const ShapeMorph = dynamic(() => import("../../tools/shape/ShapeMorph"), {
12
+ ssr: false,
13
+ });
14
+
15
+ type MioCardProps = {
16
+ title: string;
17
+ withImage?:
18
+ | {
19
+ src: string;
20
+ alt: string;
21
+ }
22
+ | undefined;
23
+ onClick?: () => void;
24
+ navigate?: "next" | "previous";
25
+ withIcon?: {
26
+ systemName: string;
27
+ shape: ShapeType;
28
+ toShape?: ShapeType;
29
+ };
30
+ type?: "primary" | "secondary" | "tertiary";
31
+ style?: React.CSSProperties;
32
+ children?: React.ReactNode;
33
+ };
34
+
35
+ // Static style objects extracted outside the component — never reallocated.
36
+ const outerWrapperStyle: React.CSSProperties = {
37
+ display: "flex",
38
+ flexDirection: "row",
39
+ flexWrap: "nowrap",
40
+ gap: "16px",
41
+ padding: "20px 24px",
42
+ flex: 1,
43
+ };
44
+ const innerWrapperStyle: React.CSSProperties = {
45
+ display: "flex",
46
+ flexDirection: "column",
47
+ justifyContent: "space-between",
48
+ gap: "16px",
49
+ width: "100%",
50
+ height: "100%",
51
+ position: "relative",
52
+ };
53
+
54
+ const headerGroupStyle: React.CSSProperties = {
55
+ display: "flex",
56
+ flexDirection: "column",
57
+ gap: "0px",
58
+ };
59
+
60
+ const upNextStyle: React.CSSProperties = {
61
+ display: "flex",
62
+ alignItems: "center",
63
+ gap: "4px",
64
+ fontWeight: 600,
65
+ };
66
+
67
+ const previousStyle: React.CSSProperties = { fontWeight: 600 };
68
+
69
+ const iconWrapperStyle: React.CSSProperties = {
70
+ position: "relative",
71
+ height: "100%",
72
+ display: "flex",
73
+ justifyContent: "flex-start",
74
+ alignItems: "center",
75
+ };
76
+
77
+ function MioCard({
78
+ title,
79
+ withImage,
80
+ withIcon,
81
+ type,
82
+ onClick,
83
+ navigate,
84
+ children,
85
+ style,
86
+ }: MioCardProps) {
87
+ const rippleRef = useRef<RippleHandle>(null);
88
+ const [isHoveringContainer, setIsHoveringContainer] = useState(false);
89
+ const { isMobile, isTablet } = useBreakpoints();
90
+
91
+ // Triggers the ripple effect at the pointer position, then calls the consumer's onClick handler.
92
+ const handleMioClick = useCallback(
93
+ (e: React.MouseEvent<HTMLDivElement>) => {
94
+ rippleRef.current?.triggerRipple(e);
95
+ onClick?.();
96
+ },
97
+ [onClick],
98
+ );
99
+
100
+ // Track hover state so ShapeMorph and the icon can switch colors on hover.
101
+ const handleMouseEnter = useCallback(() => setIsHoveringContainer(true), []);
102
+ const handleMouseLeave = useCallback(() => setIsHoveringContainer(false), []);
103
+
104
+ // Body/title text color. Typed cards lock to on-{type}-container at all times
105
+ // (the card bg is the matching {type}-container, so the text reads correctly
106
+ // hover or not). Default cards keep the original hover/idle behavior.
107
+ const contentColor = useMemo(
108
+ () =>
109
+ type
110
+ ? `var(--md-sys-color-on-${type}-container)`
111
+ : isHoveringContainer
112
+ ? "var(--md-sys-color-on-primary-container)"
113
+ : "var(--md-sys-color-on-surface-container)",
114
+ [type, isHoveringContainer],
115
+ );
116
+
117
+ // The "Up next" / "Previous" label. Typed cards match the body text color.
118
+ // Default cards sit as a muted outline at rest and pick up a 50% tint of
119
+ // on-secondary-container on hover (matching the secondary-container bg the
120
+ // card fades to).
121
+ const navigateLabelStyle = useMemo<React.CSSProperties>(
122
+ () => ({
123
+ color: type
124
+ ? `var(--md-sys-color-on-${type}-container)`
125
+ : isHoveringContainer
126
+ ? "color-mix(in srgb, var(--md-sys-color-on-primary-container) 50%, transparent)"
127
+ : "var(--md-sys-color-outline)",
128
+ position: "relative",
129
+ height: navigate ? "24px" : "0px",
130
+ }),
131
+ [type, isHoveringContainer, navigate],
132
+ );
133
+
134
+ const titleStyle = useMemo<React.CSSProperties>(
135
+ () => ({ color: contentColor }),
136
+ [contentColor],
137
+ );
138
+
139
+ const textStyle = useMemo<React.CSSProperties>(
140
+ () => ({
141
+ color: `var(--md-sys-color-on-surface)`,
142
+ }),
143
+ [],
144
+ );
145
+
146
+ // Renders the full-width image pinned to the bottom of the card when withImage is provided.
147
+ const imageElement = useMemo(() => {
148
+ if (!withImage) return null;
149
+ return (
150
+ <div
151
+ style={{
152
+ position: "relative",
153
+ width: "100%",
154
+ height: 280,
155
+ borderRadius: isMobile ? "0 0 36px 36px" : "0 0 24px 24px",
156
+ overflow: "hidden",
157
+ flexShrink: 0,
158
+ }}
159
+ >
160
+ <Image
161
+ src={withImage.src}
162
+ alt={withImage.alt}
163
+ loading="eager"
164
+ fill
165
+ style={{ objectFit: "cover" }}
166
+ />
167
+ </div>
168
+ );
169
+ }, [withImage, isMobile]);
170
+ // Positions the icon over the ShapeMorph bubble and switches its color on hover.
171
+ const iconStyle = useMemo<React.CSSProperties>(
172
+ () => ({
173
+ position: "absolute",
174
+ transform: "translate(132.5%, 0)",
175
+ fontVariationSettings: "'wght' 400",
176
+ transformOrigin: "center",
177
+ zIndex: 2,
178
+ pointerEvents: "none",
179
+ scale: 1,
180
+ color: isHoveringContainer
181
+ ? type
182
+ ? `var(--md-sys-color-on-${type})`
183
+ : "var(--md-sys-color-on-primary)"
184
+ : "var(--md-sys-color-on-surface-container)",
185
+ }),
186
+ [isHoveringContainer, type],
187
+ );
188
+
189
+ // Returns the fill color for the ShapeMorph bubble: primary/type on hover, surface on idle.
190
+ const shapeColorValue = useMemo(
191
+ () =>
192
+ isHoveringContainer
193
+ ? type
194
+ ? `var(--md-sys-color-${type})`
195
+ : "var(--md-sys-color-primary)"
196
+ : type || isMobile
197
+ ? "var(--md-sys-color-surface-container-lowest)"
198
+ : "var(--md-sys-color-surface-container-low)",
199
+ [isHoveringContainer, type, isMobile],
200
+ );
201
+
202
+ // Outer wrapper owns hover/click and keeps a CONSTANT border-radius, so its
203
+ // hit area never moves. The inner body animates its radius purely for looks.
204
+ // (Listening on the body directly caused an enter/leave flicker loop: its
205
+ // growing radius clipped the corner out from under the cursor.)
206
+ return (
207
+ <div
208
+ className={styles.mioWrapper}
209
+ style={style}
210
+ onClick={handleMioClick}
211
+ onMouseEnter={handleMouseEnter}
212
+ onMouseLeave={handleMouseLeave}
213
+ >
214
+ <div
215
+ className={styles.mioBody}
216
+ style={{
217
+ backgroundColor: type
218
+ ? `var(--md-sys-color-${type}-container)`
219
+ : isMobile && !type
220
+ ? "var(--md-sys-color-surface-container-low)"
221
+ : undefined,
222
+ }}
223
+ >
224
+ {imageElement}
225
+ <div style={outerWrapperStyle}>
226
+ <div style={innerWrapperStyle}>
227
+ <div style={headerGroupStyle}>
228
+ <span style={navigateLabelStyle}>
229
+ {navigate === "next" ? (
230
+ <span style={upNextStyle}>
231
+ <p>Up next</p>
232
+ <Icon systemName="arrow_right_alt" />
233
+ </span>
234
+ ) : navigate === "previous" ? (
235
+ <span style={previousStyle}>
236
+ <Icon systemName="arrow_left_alt" label="Previous" />
237
+ </span>
238
+ ) : null}
239
+ </span>
240
+ <h3 style={titleStyle}>{title}</h3>
241
+ </div>
242
+ {children && (
243
+ <div className={styles.mioContentWrapper} style={textStyle}>
244
+ {children}
245
+ </div>
246
+ )}
247
+ </div>
248
+ {withIcon && (
249
+ <div className={styles.mioIconWrapper} style={iconWrapperStyle}>
250
+ <Icon iconStyle={iconStyle} systemName={withIcon.systemName} />
251
+ <ShapeMorph
252
+ shape={withIcon.shape}
253
+ isHovered={isHoveringContainer}
254
+ color={shapeColorValue}
255
+ size={62}
256
+ />
257
+ </div>
258
+ )}
259
+ </div>
260
+ <Ripple ref={rippleRef} />
261
+ </div>
262
+ </div>
263
+ );
264
+ }
265
+
266
+ export default React.memo(MioCard);
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+
3
+ type WrapProps = {
4
+ children: React.ReactNode;
5
+ min?: string;
6
+ gap?: string;
7
+ style?: React.CSSProperties;
8
+ };
9
+
10
+ export function Wrap({
11
+ children,
12
+ min = "314px",
13
+ gap = "12px",
14
+ style,
15
+ }: WrapProps) {
16
+ return (
17
+ <div
18
+ style={{
19
+ display: "flex",
20
+ flexDirection: "row",
21
+ flexWrap: "wrap",
22
+ alignItems: "stretch",
23
+ gap,
24
+ width: "100%",
25
+ ...style,
26
+ }}
27
+ >
28
+ {React.Children.map(children, (child) => {
29
+ if (!React.isValidElement(child)) return child;
30
+ const el = child as React.ReactElement<{ style?: React.CSSProperties }>;
31
+ return React.cloneElement(el, {
32
+ style: {
33
+ ...(el.props.style ?? {}),
34
+ flex: `1 1 ${min}`,
35
+ alignSelf: "stretch",
36
+ },
37
+ });
38
+ })}
39
+ </div>
40
+ );
41
+ }