@orangecheck/app-design 0.3.2 → 0.4.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.
@@ -1096,7 +1096,206 @@ function SatsFigure({
1096
1096
  hint ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] text-muted-foreground", children: hint }) : null
1097
1097
  ] });
1098
1098
  }
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
+ function PhoneFrame({ className, style, children }) {
1225
+ return /* @__PURE__ */ jsx(
1226
+ "div",
1227
+ {
1228
+ className: cn(
1229
+ "relative w-[17.5rem] shrink-0 rounded-[2.9rem] bg-[#0b0b0c] p-[0.6rem]",
1230
+ "shadow-[0_50px_100px_-40px_rgb(10_10_10/0.55),0_0_0_1px_rgb(255_255_255/0.06)_inset]",
1231
+ className
1232
+ ),
1233
+ style,
1234
+ children: /* @__PURE__ */ jsxs("div", { className: "relative aspect-[9/19.2] overflow-hidden rounded-[2.35rem] bg-background", children: [
1235
+ /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "absolute left-1/2 top-2.5 z-10 h-[1.35rem] w-[5.6rem] -translate-x-1/2 rounded-full bg-[#0b0b0c]" }),
1236
+ children
1237
+ ] })
1238
+ }
1239
+ );
1240
+ }
1241
+ function BrowserFrame({
1242
+ url = "ochk.app",
1243
+ className,
1244
+ style,
1245
+ children
1246
+ }) {
1247
+ return /* @__PURE__ */ jsxs(
1248
+ "div",
1249
+ {
1250
+ className: cn(
1251
+ "overflow-hidden rounded-[1.1rem] border border-border bg-card",
1252
+ "shadow-[0_40px_90px_-40px_rgb(10_10_10/0.45)]",
1253
+ className
1254
+ ),
1255
+ style,
1256
+ children: [
1257
+ /* @__PURE__ */ jsxs("div", { className: "flex h-10 items-center gap-3 border-b border-border px-4", children: [
1258
+ /* @__PURE__ */ jsxs("div", { "aria-hidden": true, className: "flex gap-1.5", children: [
1259
+ /* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-[#ff5f57]" }),
1260
+ /* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-[#febc2e]" }),
1261
+ /* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-[#28c840]" })
1262
+ ] }),
1263
+ /* @__PURE__ */ jsx("div", { className: "mx-auto flex h-6 min-w-0 max-w-[60%] flex-1 items-center justify-center rounded-md bg-muted px-3 text-[0.75rem] text-muted-foreground", children: /* @__PURE__ */ jsx("span", { className: "truncate", children: url }) }),
1264
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "w-[2.6rem]" })
1265
+ ] }),
1266
+ /* @__PURE__ */ jsx("div", { className: "relative", children })
1267
+ ]
1268
+ }
1269
+ );
1270
+ }
1271
+ function FloatChip({
1272
+ icon,
1273
+ title,
1274
+ detail,
1275
+ delay = 0,
1276
+ className,
1277
+ style
1278
+ }) {
1279
+ return /* @__PURE__ */ jsxs(
1280
+ "div",
1281
+ {
1282
+ className: cn(
1283
+ "oca-animate-drift flex items-center gap-3 rounded-2xl border border-border bg-card/90 py-2.5 pl-2.5 pr-4 backdrop-blur-md",
1284
+ "shadow-[0_24px_50px_-24px_rgb(10_10_10/0.35)]",
1285
+ className
1286
+ ),
1287
+ style: { animationDelay: `${-delay}s`, ...style },
1288
+ children: [
1289
+ icon ? /* @__PURE__ */ jsx("span", { className: "flex size-9 shrink-0 items-center justify-center rounded-xl bg-muted text-foreground [&_svg]:size-4", children: icon }) : null,
1290
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col", children: [
1291
+ /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] font-medium leading-tight", children: title }),
1292
+ detail ? /* @__PURE__ */ jsx("span", { className: "text-[0.8125rem] leading-tight text-muted-foreground", children: detail }) : null
1293
+ ] })
1294
+ ]
1295
+ }
1296
+ );
1297
+ }
1099
1298
 
1100
- export { Accent, ActivityList, CodeBlock, Container, CopyButton, DataTable, Display, DocHeader, DocLayout, EmptyLine, EmptyState, Eyebrow, Footnote, HashChip, KeyValueList, Lead, LoadingBlock, Notice, PackageCard, PageHeader, PageHero, ProgressSteps, Prose, Sats, SatsFigure, Section, SectionIntro, SplitBar, StatCard, StatGrid, StepGrid, TruthTable, UsdApprox, satsText, sectionVariants, useCopy };
1299
+ export { Accent, ActivityList, BrowserFrame, CodeBlock, Container, CopyButton, DataTable, Display, DocHeader, DocLayout, EmptyLine, EmptyState, Eyebrow, FloatChip, Footnote, HashChip, KeyValueList, Lead, LoadingBlock, Notice, PackageCard, PageHeader, PageHero, PhoneFrame, ProgressSteps, Prose, Reveal, Sats, SatsFigure, ScrollStory, Section, SectionIntro, SplitBar, StatCard, StatGrid, StepGrid, Ticker, TruthTable, UsdApprox, satsText, sectionVariants, useCopy, useInView };
1101
1300
  //# sourceMappingURL=components.mjs.map
1102
1301
  //# sourceMappingURL=components.mjs.map