@orangecheck/app-design 0.5.10 → 0.5.11

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/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Slot } from '@radix-ui/react-slot';
2
2
  import { cva } from 'class-variance-authority';
3
- import { forwardRef, createContext, useContext, useRef, useState, useCallback, useEffect, useId, isValidElement, cloneElement, createElement, Children, useMemo } from 'react';
3
+ import { forwardRef, createContext, useContext, useRef, useState, useCallback, useEffect, useId, isValidElement, cloneElement, createElement, Children, Component, useMemo } from 'react';
4
4
  import { clsx } from 'clsx';
5
5
  import { extendTailwindMerge } from 'tailwind-merge';
6
6
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
@@ -673,7 +673,13 @@ var DropdownMenuLabel = forwardRef(function DropdownMenuLabel2({ className, ...p
673
673
  var DropdownMenuSeparator = forwardRef(function DropdownMenuSeparator2({ className, ...props }, ref) {
674
674
  return /* @__PURE__ */ jsx(DropdownMenuPrimitive.Separator, { ref, className: cn("my-1.5 h-px bg-border", className), ...props });
675
675
  });
676
- function ScrollFade({ fade = "var(--card)", className, innerClassName, children, ...props }) {
676
+ function ScrollFade({
677
+ fade = "var(--card)",
678
+ className,
679
+ innerClassName,
680
+ children,
681
+ ...props
682
+ }) {
677
683
  const ref = useRef(null);
678
684
  const [edges, setEdges] = useState({ left: false, right: false });
679
685
  const measure = useCallback(() => {
@@ -681,7 +687,9 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
681
687
  if (!el) return;
682
688
  const left = el.scrollLeft > 1;
683
689
  const right = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
684
- setEdges((e) => e.left === left && e.right === right ? e : { left, right });
690
+ setEdges(
691
+ (e) => e.left === left && e.right === right ? e : { left, right }
692
+ );
685
693
  }, []);
686
694
  useEffect(() => {
687
695
  const el = ref.current;
@@ -694,7 +702,19 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
694
702
  return () => ro.disconnect();
695
703
  }, [measure]);
696
704
  return /* @__PURE__ */ jsxs("div", { className: cn("relative min-w-0", className), ...props, children: [
697
- /* @__PURE__ */ jsx("div", { ref, onScroll: measure, className: cn("overflow-x-auto overscroll-x-contain", innerClassName), children }),
705
+ /* @__PURE__ */ jsx(
706
+ "div",
707
+ {
708
+ ref,
709
+ onScroll: measure,
710
+ tabIndex: edges.left || edges.right ? 0 : void 0,
711
+ className: cn(
712
+ "overflow-x-auto overscroll-x-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",
713
+ innerClassName
714
+ ),
715
+ children
716
+ }
717
+ ),
698
718
  /* @__PURE__ */ jsx(
699
719
  "span",
700
720
  {
@@ -703,7 +723,9 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
703
723
  "pointer-events-none absolute inset-y-0 left-0 w-8 transition-opacity duration-150",
704
724
  edges.left ? "opacity-100" : "opacity-0"
705
725
  ),
706
- style: { background: `linear-gradient(to right, ${fade}, transparent)` }
726
+ style: {
727
+ background: `linear-gradient(to right, ${fade}, transparent)`
728
+ }
707
729
  }
708
730
  ),
709
731
  /* @__PURE__ */ jsx(
@@ -958,7 +980,8 @@ function HalftoneCanvas({
958
980
  raf = busy && visible && !document.hidden ? requestAnimationFrame(frame) : 0;
959
981
  }
960
982
  const kick = () => {
961
- if (!raf && visible && !document.hidden) raf = requestAnimationFrame(frame);
983
+ if (!raf && visible && !document.hidden)
984
+ raf = requestAnimationFrame(frame);
962
985
  };
963
986
  layout();
964
987
  setLive(true);
@@ -1000,22 +1023,41 @@ function HalftoneCanvas({
1000
1023
  el.removeEventListener("pointerleave", leave);
1001
1024
  };
1002
1025
  }, [tone, density, lens, intro, breathe, ink]);
1003
- return /* @__PURE__ */ jsxs("div", { ref: wrap, className: cn("relative aspect-square w-full", className), style, "data-live": live || void 0, children: [
1004
- fallbackSrc ? (
1005
- // eslint-disable-next-line @next/next/no-img-element -- the still screen, until the live one draws
1006
- /* @__PURE__ */ jsx(
1007
- "img",
1008
- {
1009
- src: fallbackSrc,
1010
- alt: "",
1011
- "aria-hidden": true,
1012
- className: cn("absolute inset-0 size-full select-none transition-opacity duration-300", live && "opacity-0"),
1013
- draggable: false
1014
- }
1015
- )
1016
- ) : null,
1017
- /* @__PURE__ */ jsx("canvas", { ref: canvas, role: "img", "aria-label": alt, className: "absolute inset-0 size-full" })
1018
- ] });
1026
+ return /* @__PURE__ */ jsxs(
1027
+ "div",
1028
+ {
1029
+ ref: wrap,
1030
+ className: cn("relative aspect-square w-full", className),
1031
+ style,
1032
+ "data-live": live || void 0,
1033
+ children: [
1034
+ fallbackSrc ? (
1035
+ // eslint-disable-next-line @next/next/no-img-element -- the still screen, until the live one draws
1036
+ /* @__PURE__ */ jsx(
1037
+ "img",
1038
+ {
1039
+ src: fallbackSrc,
1040
+ alt: "",
1041
+ "aria-hidden": true,
1042
+ className: cn(
1043
+ "absolute inset-0 size-full select-none transition-opacity duration-300",
1044
+ live && "opacity-0"
1045
+ ),
1046
+ draggable: false
1047
+ }
1048
+ )
1049
+ ) : null,
1050
+ /* @__PURE__ */ jsx(
1051
+ "canvas",
1052
+ {
1053
+ ref: canvas,
1054
+ ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true },
1055
+ className: "absolute inset-0 size-full"
1056
+ }
1057
+ )
1058
+ ]
1059
+ }
1060
+ );
1019
1061
  }
1020
1062
  var SPHERE_GRADIENT = "radial-gradient(86% 86% at 36% 32%, #fff7f0 0%, #ffdec8 14%, #ffa069 34%, #ff7030 56%, #f65210 78%, #de4006 100%)";
1021
1063
  var SPHERE_DEPTH = "inset -14px -22px 44px rgb(150 40 0 / 0.16), 0 36px 70px -34px rgb(234 88 11 / 0.45)";
@@ -2363,7 +2405,49 @@ function Monogram({
2363
2405
  }
2364
2406
  );
2365
2407
  }
2366
- function NavLink({ item, className, onNavigate }) {
2408
+ var ErrorBoundary = class extends Component {
2409
+ constructor() {
2410
+ super(...arguments);
2411
+ this.state = { failed: false, key: this.props.resetKey };
2412
+ this.reset = () => this.setState({ failed: false });
2413
+ }
2414
+ static getDerivedStateFromError() {
2415
+ return { failed: true };
2416
+ }
2417
+ static getDerivedStateFromProps(props, state) {
2418
+ return props.resetKey === state.key ? null : { failed: false, key: props.resetKey };
2419
+ }
2420
+ componentDidCatch(error, info) {
2421
+ this.props.onError?.(error, info);
2422
+ }
2423
+ render() {
2424
+ if (!this.state.failed) return this.props.children;
2425
+ if (this.props.fallback) return this.props.fallback(this.reset);
2426
+ return /* @__PURE__ */ jsx("div", { className: "oca-container py-16", children: /* @__PURE__ */ jsx(
2427
+ EmptyState,
2428
+ {
2429
+ title: "Something on this page broke.",
2430
+ action: /* @__PURE__ */ jsxs(Fragment, { children: [
2431
+ /* @__PURE__ */ jsx(Button, { onClick: this.reset, children: "Try again" }),
2432
+ /* @__PURE__ */ jsx(
2433
+ Button,
2434
+ {
2435
+ variant: "secondary",
2436
+ onClick: () => window.location.reload(),
2437
+ children: "Reload the page"
2438
+ }
2439
+ )
2440
+ ] }),
2441
+ children: "Nothing you saved is affected. If it keeps happening, tell us at hello@ochk.io."
2442
+ }
2443
+ ) });
2444
+ }
2445
+ };
2446
+ function NavLink({
2447
+ item,
2448
+ className,
2449
+ onNavigate
2450
+ }) {
2367
2451
  const cls = cn(
2368
2452
  "rounded-full px-3 py-2 text-[0.9375rem] transition-colors",
2369
2453
  item.active ? "text-foreground" : "text-muted-foreground hover:text-foreground",
@@ -2372,7 +2456,16 @@ function NavLink({ item, className, onNavigate }) {
2372
2456
  if (item.external) {
2373
2457
  return /* @__PURE__ */ jsx("a", { href: item.href, className: cls, rel: "noreferrer", onClick: onNavigate, children: item.label });
2374
2458
  }
2375
- return /* @__PURE__ */ jsx(Link2, { href: item.href, className: cls, "aria-current": item.active ? "page" : void 0, onClick: onNavigate, children: item.label });
2459
+ return /* @__PURE__ */ jsx(
2460
+ Link2,
2461
+ {
2462
+ href: item.href,
2463
+ className: cls,
2464
+ "aria-current": item.active ? "page" : void 0,
2465
+ onClick: onNavigate,
2466
+ children: item.label
2467
+ }
2468
+ );
2376
2469
  }
2377
2470
  function SiteHeader({
2378
2471
  home = "/",
@@ -2390,7 +2483,10 @@ function SiteHeader({
2390
2483
  className
2391
2484
  ),
2392
2485
  children: /* @__PURE__ */ jsxs("div", { className: "oca-container flex h-16 items-center justify-between gap-4 md:h-[4.5rem]", children: [
2393
- /* @__PURE__ */ jsx(Link2, { href: home, className: "-ml-1 rounded-lg p-1", "aria-label": "Home", children: brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }) }),
2486
+ /* @__PURE__ */ jsxs(Link2, { href: home, className: "-ml-1 rounded-lg p-1", children: [
2487
+ brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }),
2488
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
2489
+ ] }),
2394
2490
  nav.length > 0 ? /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-1 md:flex", children: nav.map((n) => /* @__PURE__ */ jsx(NavLink, { item: n }, n.href)) }) : null,
2395
2491
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2396
2492
  actions,
@@ -2439,27 +2535,46 @@ function SiteFooter({
2439
2535
  return /* @__PURE__ */ jsxs(
2440
2536
  "div",
2441
2537
  {
2442
- className: cn("flex min-w-0 flex-col gap-1", spans && "col-span-2 md:col-span-1"),
2538
+ className: cn(
2539
+ "flex min-w-0 flex-col gap-1",
2540
+ spans && "col-span-2 md:col-span-1"
2541
+ ),
2443
2542
  children: [
2444
2543
  /* @__PURE__ */ jsx("p", { className: "mb-2 text-[0.875rem] font-medium", children: col.heading }),
2445
- /* @__PURE__ */ jsx("div", { className: cn("flex flex-col gap-1", spans && "grid grid-cols-2 gap-x-6 md:flex md:flex-col"), children: col.links.map((l) => /* @__PURE__ */ jsx(
2446
- NavLink,
2544
+ /* @__PURE__ */ jsx(
2545
+ "div",
2447
2546
  {
2448
- item: l,
2449
- className: "-mx-3 py-2.5 text-[0.9375rem] md:py-1.5"
2450
- },
2451
- l.href
2452
- )) })
2547
+ className: cn(
2548
+ "flex flex-col gap-1",
2549
+ spans && "grid grid-cols-2 gap-x-6 md:flex md:flex-col"
2550
+ ),
2551
+ children: col.links.map((l) => /* @__PURE__ */ jsx(
2552
+ NavLink,
2553
+ {
2554
+ item: l,
2555
+ className: "-mx-3 py-2.5 text-[0.9375rem] md:py-1.5"
2556
+ },
2557
+ l.href
2558
+ ))
2559
+ }
2560
+ )
2453
2561
  ]
2454
2562
  },
2455
2563
  col.heading
2456
2564
  );
2457
2565
  })
2458
2566
  ] }),
2459
- signature ? /* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "oca-container select-none overflow-hidden pb-8 md:pb-12", children: /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-[0.18em] text-[clamp(3rem,11.5vw,10rem)] leading-[0.78] tracking-[-0.065em] [font-family:var(--oc-font-display)]", children: [
2460
- /* @__PURE__ */ jsx("span", { className: "mb-[0.06em] inline-block w-[1.1em] shrink-0", children: /* @__PURE__ */ jsx(Mark, { className: "block h-auto w-full" }) }),
2461
- /* @__PURE__ */ jsx("span", { children: "orangecheck" })
2462
- ] }) }) : null,
2567
+ signature ? /* @__PURE__ */ jsx(
2568
+ "div",
2569
+ {
2570
+ "aria-hidden": true,
2571
+ className: "oca-container select-none overflow-hidden pb-8 md:pb-12",
2572
+ children: /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-[0.18em] text-[clamp(3rem,11.5vw,10rem)] leading-[0.78] tracking-[-0.065em] [font-family:var(--oc-font-display)]", children: [
2573
+ /* @__PURE__ */ jsx("span", { className: "mb-[0.06em] inline-block w-[1.1em] shrink-0", children: /* @__PURE__ */ jsx(Mark, { className: "block h-auto w-full" }) }),
2574
+ /* @__PURE__ */ jsx("span", { children: "orangecheck" })
2575
+ ] })
2576
+ }
2577
+ ) : null,
2463
2578
  meta ? /* @__PURE__ */ jsx("div", { className: "oca-container", children: /* @__PURE__ */ jsx("div", { className: "border-t border-border py-6 text-[0.875rem] text-muted-foreground", children: meta }) }) : null
2464
2579
  ] });
2465
2580
  }
@@ -2662,6 +2777,6 @@ function ThemeToggle({ className }) {
2662
2777
  );
2663
2778
  }
2664
2779
 
2665
- export { APP_ATTRIBUTE, APP_ID, Accent, AccountMenu, ActivityList, AppIcon, AppShell, Badge, BrowserFrame, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, CardTitle, Checkbox, CodeBlock, Container, CopyButton, Crowd, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, Eyebrow, Field, FloatChip, Footnote, HalftoneCanvas, HalftoneSphere, HashChip, Input, IsoCheck, Kbd, KeyValueList, Label, Lead, LoadingBlock, Lockup, MARK_FACES, Mark, Monogram, Notice, PackageCard, PageHeader, PageHero, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, Prose, RadioGroup, RadioGroupItem, Reveal, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, Section, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SiteFooter, SiteHeader, Skeleton, Spinner, SplitBar, StatCard, StatGrid, StatusDot, StatusPill, StepGrid, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, Ticker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, appColors, appFonts, badgeVariants, buttonVariants, cardVariants, cn, monogramGround, monogramLetter, portraitTone, satsText, sectionVariants, useCopy, useInView, useShellPlace, useTimedOut };
2780
+ export { APP_ATTRIBUTE, APP_ID, Accent, AccountMenu, ActivityList, AppIcon, AppShell, Badge, BrowserFrame, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardNumeral, CardTitle, Checkbox, CodeBlock, Container, CopyButton, Crowd, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Display, DocHeader, DocLayout, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, EmptyLine, EmptyState, ErrorBoundary, Eyebrow, Field, FloatChip, Footnote, HalftoneCanvas, HalftoneSphere, HashChip, Input, IsoCheck, Kbd, KeyValueList, Label, Lead, LoadingBlock, Lockup, MARK_FACES, Mark, Monogram, Notice, PackageCard, PageHeader, PageHero, PhoneFrame, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressSteps, Prose, RadioGroup, RadioGroupItem, Reveal, SPHERE_GRADIENT, Sats, SatsFigure, ScrollFade, ScrollStory, Section, SectionIntro, Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetTitle, SheetTrigger, ShellContext, SiteFooter, SiteHeader, Skeleton, Spinner, SplitBar, StatCard, StatGrid, StatusDot, StatusPill, StepGrid, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, Ticker, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, TruthTable, UsdApprox, appColors, appFonts, badgeVariants, buttonVariants, cardVariants, cn, monogramGround, monogramLetter, portraitTone, satsText, sectionVariants, useCopy, useInView, useShellPlace, useTimedOut };
2666
2781
  //# sourceMappingURL=index.mjs.map
2667
2782
  //# sourceMappingURL=index.mjs.map