@orangecheck/app-design 0.4.0 → 0.4.1
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.
- package/dist/components.d.mts +2 -1
- package/dist/components.d.ts +2 -1
- package/dist/components.js +139 -146
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +140 -147
- package/dist/components.mjs.map +1 -1
- package/dist/index.js +139 -146
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +139 -146
- package/dist/index.mjs.map +1 -1
- package/dist/styles/motion.css +21 -0
- package/package.json +1 -1
package/dist/components.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { forwardRef, createContext, createElement,
|
|
1
|
+
import { forwardRef, createContext, createElement, useRef, useState, useEffect, useContext, Children, isValidElement, cloneElement, useCallback } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { extendTailwindMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -61,6 +61,131 @@ function Prose({ className, ...props }) {
|
|
|
61
61
|
}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
+
function prefersStill() {
|
|
65
|
+
return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
66
|
+
}
|
|
67
|
+
function useInView(rootMargin = "0px 0px -12% 0px") {
|
|
68
|
+
const ref = useRef(null);
|
|
69
|
+
const [seen, setSeen] = useState(false);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const el = ref.current;
|
|
72
|
+
if (!el || seen) return;
|
|
73
|
+
if (typeof IntersectionObserver === "undefined") {
|
|
74
|
+
setSeen(true);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const io = new IntersectionObserver(
|
|
78
|
+
([e]) => {
|
|
79
|
+
if (e?.isIntersecting) {
|
|
80
|
+
setSeen(true);
|
|
81
|
+
io.disconnect();
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{ rootMargin }
|
|
85
|
+
);
|
|
86
|
+
io.observe(el);
|
|
87
|
+
return () => io.disconnect();
|
|
88
|
+
}, [rootMargin, seen]);
|
|
89
|
+
return [ref, seen];
|
|
90
|
+
}
|
|
91
|
+
function Reveal({
|
|
92
|
+
as = "div",
|
|
93
|
+
delay = 0,
|
|
94
|
+
className,
|
|
95
|
+
style,
|
|
96
|
+
children
|
|
97
|
+
}) {
|
|
98
|
+
const ref = useRef(null);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const el = ref.current;
|
|
101
|
+
if (!el || prefersStill() || typeof IntersectionObserver === "undefined") return;
|
|
102
|
+
if (el.getBoundingClientRect().top < window.innerHeight * 0.92) return;
|
|
103
|
+
el.dataset.reveal = "pending";
|
|
104
|
+
const io = new IntersectionObserver(
|
|
105
|
+
([e]) => {
|
|
106
|
+
if (e?.isIntersecting) {
|
|
107
|
+
el.dataset.reveal = "shown";
|
|
108
|
+
io.disconnect();
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{ rootMargin: "0px 0px -10% 0px" }
|
|
112
|
+
);
|
|
113
|
+
io.observe(el);
|
|
114
|
+
return () => io.disconnect();
|
|
115
|
+
}, []);
|
|
116
|
+
return createElement(
|
|
117
|
+
as,
|
|
118
|
+
{ ref, className, style: { ...style, "--reveal-delay": `${delay}ms` } },
|
|
119
|
+
children
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function ScrollStory({
|
|
123
|
+
length = 2,
|
|
124
|
+
className,
|
|
125
|
+
innerClassName,
|
|
126
|
+
children
|
|
127
|
+
}) {
|
|
128
|
+
const ref = useRef(null);
|
|
129
|
+
const [pinned, setPinned] = useState(false);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
const el = ref.current;
|
|
132
|
+
if (!el || prefersStill()) return;
|
|
133
|
+
setPinned(true);
|
|
134
|
+
let raf = 0;
|
|
135
|
+
const update = () => {
|
|
136
|
+
raf = 0;
|
|
137
|
+
const r = el.getBoundingClientRect();
|
|
138
|
+
const travel = r.height - window.innerHeight;
|
|
139
|
+
const p = travel > 0 ? Math.min(1, Math.max(0, -r.top / travel)) : 0;
|
|
140
|
+
el.style.setProperty("--p", p.toFixed(4));
|
|
141
|
+
};
|
|
142
|
+
const on = () => {
|
|
143
|
+
if (!raf) raf = requestAnimationFrame(update);
|
|
144
|
+
};
|
|
145
|
+
update();
|
|
146
|
+
window.addEventListener("scroll", on, { passive: true });
|
|
147
|
+
window.addEventListener("resize", on);
|
|
148
|
+
return () => {
|
|
149
|
+
cancelAnimationFrame(raf);
|
|
150
|
+
window.removeEventListener("scroll", on);
|
|
151
|
+
window.removeEventListener("resize", on);
|
|
152
|
+
};
|
|
153
|
+
}, []);
|
|
154
|
+
return /* @__PURE__ */ jsx("div", { ref, className: cn("relative", className), style: pinned ? { height: `${length * 100}svh` } : void 0, children: /* @__PURE__ */ jsx("div", { className: cn(pinned && "sticky top-0 flex min-h-svh items-center", innerClassName), children }) });
|
|
155
|
+
}
|
|
156
|
+
function Ticker({
|
|
157
|
+
value,
|
|
158
|
+
duration = 1200,
|
|
159
|
+
format = (n) => Math.round(n).toLocaleString("en-US"),
|
|
160
|
+
className
|
|
161
|
+
}) {
|
|
162
|
+
const [ref, seen] = useInView();
|
|
163
|
+
const [shown, setShown] = useState(value);
|
|
164
|
+
const animate = useRef(null);
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
const el = ref.current;
|
|
167
|
+
if (!el || animate.current !== null) return;
|
|
168
|
+
animate.current = !prefersStill() && el.getBoundingClientRect().top > window.innerHeight * 0.9;
|
|
169
|
+
if (animate.current) setShown(0);
|
|
170
|
+
}, [ref]);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (!seen) return;
|
|
173
|
+
if (!animate.current) {
|
|
174
|
+
setShown(value);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
let raf = 0;
|
|
178
|
+
const t0 = performance.now();
|
|
179
|
+
const step = (now) => {
|
|
180
|
+
const k = Math.min(1, (now - t0) / duration);
|
|
181
|
+
setShown(value * (1 - Math.pow(1 - k, 3)));
|
|
182
|
+
if (k < 1) raf = requestAnimationFrame(step);
|
|
183
|
+
};
|
|
184
|
+
raf = requestAnimationFrame(step);
|
|
185
|
+
return () => cancelAnimationFrame(raf);
|
|
186
|
+
}, [seen, value, duration]);
|
|
187
|
+
return /* @__PURE__ */ jsx("span", { ref, className: cn("oca-tabular", className), children: format(shown) });
|
|
188
|
+
}
|
|
64
189
|
var sectionVariants = cva("relative w-full overflow-x-clip", {
|
|
65
190
|
variants: {
|
|
66
191
|
tone: {
|
|
@@ -89,19 +214,12 @@ function Container({ className, ...props }) {
|
|
|
89
214
|
function SectionIntro({
|
|
90
215
|
className,
|
|
91
216
|
align = "start",
|
|
92
|
-
|
|
217
|
+
reveal = true,
|
|
218
|
+
children,
|
|
219
|
+
style
|
|
93
220
|
}) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
className: cn(
|
|
98
|
-
"flex flex-col gap-4 md:gap-5",
|
|
99
|
-
align === "center" && "mx-auto items-center text-center",
|
|
100
|
-
className
|
|
101
|
-
),
|
|
102
|
-
...props
|
|
103
|
-
}
|
|
104
|
-
);
|
|
221
|
+
const cls = cn("flex flex-col gap-4 md:gap-5", align === "center" && "mx-auto items-center text-center", className);
|
|
222
|
+
return reveal ? /* @__PURE__ */ jsx(Reveal, { className: cls, style, children }) : /* @__PURE__ */ jsx("div", { className: cls, style, children });
|
|
105
223
|
}
|
|
106
224
|
function PageHero({
|
|
107
225
|
eyebrow,
|
|
@@ -120,14 +238,14 @@ function PageHero({
|
|
|
120
238
|
}
|
|
121
239
|
return /* @__PURE__ */ jsx(Section, { space: "none", className: cn("pb-14 pt-12 md:pb-20 md:pt-20", className), children: /* @__PURE__ */ jsxs("div", { className: cn("grid grid-cols-1 gap-10", art && "items-center md:grid-cols-12"), children: [
|
|
122
240
|
/* @__PURE__ */ jsxs("div", { className: cn("flex flex-col items-start gap-6", art ? "md:col-span-7" : "max-w-[52rem]"), children: [
|
|
123
|
-
eyebrow ? /* @__PURE__ */ jsx("p", { className: "oca-eyebrow", children: eyebrow }) : null,
|
|
124
|
-
/* @__PURE__ */ jsx("h1", { className: size === "xl" ? "oca-display-1" : "oca-display-2", children: title }),
|
|
125
|
-
lead ? /* @__PURE__ */ jsx("p", { className: "oca-lead max-w-[38rem]", children: lead }) : null,
|
|
126
|
-
meta ? /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: meta }) : null,
|
|
127
|
-
actions ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-3", children: actions }) : null,
|
|
128
|
-
children
|
|
241
|
+
eyebrow ? /* @__PURE__ */ jsx("p", { className: "oca-eyebrow oca-enter", children: eyebrow }) : null,
|
|
242
|
+
/* @__PURE__ */ jsx("h1", { className: cn(size === "xl" ? "oca-display-1" : "oca-display-2", "oca-enter [--enter-delay:70ms]"), children: title }),
|
|
243
|
+
lead ? /* @__PURE__ */ jsx("p", { className: "oca-lead oca-enter max-w-[38rem] [--enter-delay:150ms]", children: lead }) : null,
|
|
244
|
+
meta ? /* @__PURE__ */ jsx("p", { className: "oca-enter text-[0.875rem] text-muted-foreground [--enter-delay:190ms]", children: meta }) : null,
|
|
245
|
+
actions ? /* @__PURE__ */ jsx("div", { className: "oca-enter flex flex-wrap gap-3 [--enter-delay:230ms]", children: actions }) : null,
|
|
246
|
+
children ? /* @__PURE__ */ jsx("div", { className: "oca-enter w-full [--enter-delay:270ms]", children }) : null
|
|
129
247
|
] }),
|
|
130
|
-
art ? /* @__PURE__ */ jsx("div", { className: "md:col-span-5", children: art }) : null
|
|
248
|
+
art ? /* @__PURE__ */ jsx("div", { className: "oca-enter md:col-span-5 [--enter-delay:120ms]", children: art }) : null
|
|
131
249
|
] }) });
|
|
132
250
|
}
|
|
133
251
|
function DocHeader({
|
|
@@ -140,8 +258,8 @@ function DocHeader({
|
|
|
140
258
|
className
|
|
141
259
|
}) {
|
|
142
260
|
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-5", className), children: [
|
|
143
|
-
eyebrow ? /* @__PURE__ */ jsx("p", { className: "oca-eyebrow", children: eyebrow }) : null,
|
|
144
|
-
/* @__PURE__ */ jsx("h1", { className: "oca-display-2", children: title }),
|
|
261
|
+
eyebrow ? /* @__PURE__ */ jsx("p", { className: "oca-eyebrow oca-enter", children: eyebrow }) : null,
|
|
262
|
+
/* @__PURE__ */ jsx("h1", { className: "oca-display-2 oca-enter [--enter-delay:70ms]", children: title }),
|
|
145
263
|
lead ? /* @__PURE__ */ jsx("p", { className: "oca-lead", children: lead }) : null,
|
|
146
264
|
meta ? /* @__PURE__ */ jsx("p", { className: "text-[0.875rem] text-muted-foreground", children: meta }) : null,
|
|
147
265
|
actions ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-wrap gap-3", children: actions }) : null,
|
|
@@ -1096,131 +1214,6 @@ function SatsFigure({
|
|
|
1096
1214
|
hint ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] text-muted-foreground", children: hint }) : null
|
|
1097
1215
|
] });
|
|
1098
1216
|
}
|
|
1099
|
-
function prefersStill() {
|
|
1100
|
-
return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1101
|
-
}
|
|
1102
|
-
function useInView(rootMargin = "0px 0px -12% 0px") {
|
|
1103
|
-
const ref = useRef(null);
|
|
1104
|
-
const [seen, setSeen] = useState(false);
|
|
1105
|
-
useEffect(() => {
|
|
1106
|
-
const el = ref.current;
|
|
1107
|
-
if (!el || seen) return;
|
|
1108
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
1109
|
-
setSeen(true);
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
const io = new IntersectionObserver(
|
|
1113
|
-
([e]) => {
|
|
1114
|
-
if (e?.isIntersecting) {
|
|
1115
|
-
setSeen(true);
|
|
1116
|
-
io.disconnect();
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
{ rootMargin }
|
|
1120
|
-
);
|
|
1121
|
-
io.observe(el);
|
|
1122
|
-
return () => io.disconnect();
|
|
1123
|
-
}, [rootMargin, seen]);
|
|
1124
|
-
return [ref, seen];
|
|
1125
|
-
}
|
|
1126
|
-
function Reveal({
|
|
1127
|
-
as = "div",
|
|
1128
|
-
delay = 0,
|
|
1129
|
-
className,
|
|
1130
|
-
style,
|
|
1131
|
-
children
|
|
1132
|
-
}) {
|
|
1133
|
-
const ref = useRef(null);
|
|
1134
|
-
useEffect(() => {
|
|
1135
|
-
const el = ref.current;
|
|
1136
|
-
if (!el || prefersStill() || typeof IntersectionObserver === "undefined") return;
|
|
1137
|
-
if (el.getBoundingClientRect().top < window.innerHeight * 0.92) return;
|
|
1138
|
-
el.dataset.reveal = "pending";
|
|
1139
|
-
const io = new IntersectionObserver(
|
|
1140
|
-
([e]) => {
|
|
1141
|
-
if (e?.isIntersecting) {
|
|
1142
|
-
el.dataset.reveal = "shown";
|
|
1143
|
-
io.disconnect();
|
|
1144
|
-
}
|
|
1145
|
-
},
|
|
1146
|
-
{ rootMargin: "0px 0px -10% 0px" }
|
|
1147
|
-
);
|
|
1148
|
-
io.observe(el);
|
|
1149
|
-
return () => io.disconnect();
|
|
1150
|
-
}, []);
|
|
1151
|
-
return createElement(
|
|
1152
|
-
as,
|
|
1153
|
-
{ ref, className, style: { ...style, "--reveal-delay": `${delay}ms` } },
|
|
1154
|
-
children
|
|
1155
|
-
);
|
|
1156
|
-
}
|
|
1157
|
-
function ScrollStory({
|
|
1158
|
-
length = 2,
|
|
1159
|
-
className,
|
|
1160
|
-
innerClassName,
|
|
1161
|
-
children
|
|
1162
|
-
}) {
|
|
1163
|
-
const ref = useRef(null);
|
|
1164
|
-
const [pinned, setPinned] = useState(false);
|
|
1165
|
-
useEffect(() => {
|
|
1166
|
-
const el = ref.current;
|
|
1167
|
-
if (!el || prefersStill()) return;
|
|
1168
|
-
setPinned(true);
|
|
1169
|
-
let raf = 0;
|
|
1170
|
-
const update = () => {
|
|
1171
|
-
raf = 0;
|
|
1172
|
-
const r = el.getBoundingClientRect();
|
|
1173
|
-
const travel = r.height - window.innerHeight;
|
|
1174
|
-
const p = travel > 0 ? Math.min(1, Math.max(0, -r.top / travel)) : 0;
|
|
1175
|
-
el.style.setProperty("--p", p.toFixed(4));
|
|
1176
|
-
};
|
|
1177
|
-
const on = () => {
|
|
1178
|
-
if (!raf) raf = requestAnimationFrame(update);
|
|
1179
|
-
};
|
|
1180
|
-
update();
|
|
1181
|
-
window.addEventListener("scroll", on, { passive: true });
|
|
1182
|
-
window.addEventListener("resize", on);
|
|
1183
|
-
return () => {
|
|
1184
|
-
cancelAnimationFrame(raf);
|
|
1185
|
-
window.removeEventListener("scroll", on);
|
|
1186
|
-
window.removeEventListener("resize", on);
|
|
1187
|
-
};
|
|
1188
|
-
}, []);
|
|
1189
|
-
return /* @__PURE__ */ jsx("div", { ref, className: cn("relative", className), style: pinned ? { height: `${length * 100}svh` } : void 0, children: /* @__PURE__ */ jsx("div", { className: cn(pinned && "sticky top-0 flex min-h-svh items-center", innerClassName), children }) });
|
|
1190
|
-
}
|
|
1191
|
-
function Ticker({
|
|
1192
|
-
value,
|
|
1193
|
-
duration = 1200,
|
|
1194
|
-
format = (n) => Math.round(n).toLocaleString("en-US"),
|
|
1195
|
-
className
|
|
1196
|
-
}) {
|
|
1197
|
-
const [ref, seen] = useInView();
|
|
1198
|
-
const [shown, setShown] = useState(value);
|
|
1199
|
-
const animate = useRef(null);
|
|
1200
|
-
useEffect(() => {
|
|
1201
|
-
const el = ref.current;
|
|
1202
|
-
if (!el || animate.current !== null) return;
|
|
1203
|
-
animate.current = !prefersStill() && el.getBoundingClientRect().top > window.innerHeight * 0.9;
|
|
1204
|
-
if (animate.current) setShown(0);
|
|
1205
|
-
}, [ref]);
|
|
1206
|
-
useEffect(() => {
|
|
1207
|
-
if (!seen) return;
|
|
1208
|
-
if (!animate.current) {
|
|
1209
|
-
setShown(value);
|
|
1210
|
-
return;
|
|
1211
|
-
}
|
|
1212
|
-
let raf = 0;
|
|
1213
|
-
const t0 = performance.now();
|
|
1214
|
-
const step = (now) => {
|
|
1215
|
-
const k = Math.min(1, (now - t0) / duration);
|
|
1216
|
-
setShown(value * (1 - Math.pow(1 - k, 3)));
|
|
1217
|
-
if (k < 1) raf = requestAnimationFrame(step);
|
|
1218
|
-
};
|
|
1219
|
-
raf = requestAnimationFrame(step);
|
|
1220
|
-
return () => cancelAnimationFrame(raf);
|
|
1221
|
-
}, [seen, value, duration]);
|
|
1222
|
-
return /* @__PURE__ */ jsx("span", { ref, className: cn("oca-tabular", className), children: format(shown) });
|
|
1223
|
-
}
|
|
1224
1217
|
function PhoneFrame({ className, style, children }) {
|
|
1225
1218
|
return /* @__PURE__ */ jsx(
|
|
1226
1219
|
"div",
|