@orangecheck/app-design 0.5.10 → 0.5.12

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';
@@ -694,7 +694,19 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
694
694
  return () => ro.disconnect();
695
695
  }, [measure]);
696
696
  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 }),
697
+ /* @__PURE__ */ jsx(
698
+ "div",
699
+ {
700
+ ref,
701
+ onScroll: measure,
702
+ tabIndex: edges.left || edges.right ? 0 : void 0,
703
+ className: cn(
704
+ "overflow-x-auto overscroll-x-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",
705
+ innerClassName
706
+ ),
707
+ children
708
+ }
709
+ ),
698
710
  /* @__PURE__ */ jsx(
699
711
  "span",
700
712
  {
@@ -1014,7 +1026,14 @@ function HalftoneCanvas({
1014
1026
  }
1015
1027
  )
1016
1028
  ) : null,
1017
- /* @__PURE__ */ jsx("canvas", { ref: canvas, role: "img", "aria-label": alt, className: "absolute inset-0 size-full" })
1029
+ /* @__PURE__ */ jsx(
1030
+ "canvas",
1031
+ {
1032
+ ref: canvas,
1033
+ ...alt ? { role: "img", "aria-label": alt } : { "aria-hidden": true },
1034
+ className: "absolute inset-0 size-full"
1035
+ }
1036
+ )
1018
1037
  ] });
1019
1038
  }
1020
1039
  var SPHERE_GRADIENT = "radial-gradient(86% 86% at 36% 32%, #fff7f0 0%, #ffdec8 14%, #ffa069 34%, #ff7030 56%, #f65210 78%, #de4006 100%)";
@@ -2363,6 +2382,37 @@ function Monogram({
2363
2382
  }
2364
2383
  );
2365
2384
  }
2385
+ var ErrorBoundary = class extends Component {
2386
+ constructor() {
2387
+ super(...arguments);
2388
+ this.state = { failed: false, key: this.props.resetKey };
2389
+ this.reset = () => this.setState({ failed: false });
2390
+ }
2391
+ static getDerivedStateFromError() {
2392
+ return { failed: true };
2393
+ }
2394
+ static getDerivedStateFromProps(props, state) {
2395
+ return props.resetKey === state.key ? null : { failed: false, key: props.resetKey };
2396
+ }
2397
+ componentDidCatch(error, info) {
2398
+ this.props.onError?.(error, info);
2399
+ }
2400
+ render() {
2401
+ if (!this.state.failed) return this.props.children;
2402
+ if (this.props.fallback) return this.props.fallback(this.reset);
2403
+ return /* @__PURE__ */ jsx("div", { className: "oca-container py-16", children: /* @__PURE__ */ jsx(
2404
+ EmptyState,
2405
+ {
2406
+ title: "Something on this page broke.",
2407
+ action: /* @__PURE__ */ jsxs(Fragment, { children: [
2408
+ /* @__PURE__ */ jsx(Button, { onClick: this.reset, children: "Try again" }),
2409
+ /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => window.location.reload(), children: "Reload the page" })
2410
+ ] }),
2411
+ children: "Nothing you saved is affected. If it keeps happening, tell us at hello@ochk.io."
2412
+ }
2413
+ ) });
2414
+ }
2415
+ };
2366
2416
  function NavLink({ item, className, onNavigate }) {
2367
2417
  const cls = cn(
2368
2418
  "rounded-full px-3 py-2 text-[0.9375rem] transition-colors",
@@ -2389,35 +2439,50 @@ function SiteHeader({
2389
2439
  "sticky top-0 z-40 w-full border-b border-transparent bg-background/85 backdrop-blur-md supports-[backdrop-filter]:bg-background/70",
2390
2440
  className
2391
2441
  ),
2392
- 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 }) }),
2394
- 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
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
2396
- actions,
2397
- nav.length > 0 ? /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
2398
- /* @__PURE__ */ jsx(
2399
- SheetTrigger,
2400
- {
2401
- className: "inline-flex size-10 items-center justify-center rounded-full text-foreground hover:bg-accent md:hidden",
2402
- "aria-label": "Open menu",
2403
- children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
2404
- }
2405
- ),
2406
- /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "pt-16", children: [
2407
- /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Menu" }),
2408
- /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: nav.map((n) => /* @__PURE__ */ jsx(
2409
- NavLink,
2410
- {
2411
- item: n,
2412
- className: "rounded-xl px-3 py-3 text-[1.0625rem]",
2413
- onNavigate: () => setOpen(false)
2414
- },
2415
- n.href
2416
- )) })
2442
+ children: /* @__PURE__ */ jsxs(
2443
+ "div",
2444
+ {
2445
+ className: cn(
2446
+ "oca-container flex h-16 items-center justify-between gap-4 md:h-[4.5rem]",
2447
+ // Three columns, the outer two each at least their content: the
2448
+ // navigation stays centred whatever the actions hold, so it does
2449
+ // not shift when they change (signed out to signed in).
2450
+ nav.length > 0 && "md:grid md:grid-cols-[minmax(max-content,1fr)_auto_minmax(max-content,1fr)]"
2451
+ ),
2452
+ children: [
2453
+ /* @__PURE__ */ jsxs(Link2, { href: home, className: "-ml-1 justify-self-start rounded-lg p-1", children: [
2454
+ brand ?? /* @__PURE__ */ jsx(Lockup, { size: 28 }),
2455
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " home" })
2456
+ ] }),
2457
+ 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,
2458
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 justify-self-end", children: [
2459
+ actions,
2460
+ nav.length > 0 ? /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
2461
+ /* @__PURE__ */ jsx(
2462
+ SheetTrigger,
2463
+ {
2464
+ className: "inline-flex size-10 items-center justify-center rounded-full text-foreground hover:bg-accent md:hidden",
2465
+ "aria-label": "Open menu",
2466
+ children: /* @__PURE__ */ jsx(Menu, { className: "size-5" })
2467
+ }
2468
+ ),
2469
+ /* @__PURE__ */ jsxs(SheetContent, { side: "right", className: "pt-16", children: [
2470
+ /* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Menu" }),
2471
+ /* @__PURE__ */ jsx("nav", { "aria-label": "Main", className: "flex flex-col", children: nav.map((n) => /* @__PURE__ */ jsx(
2472
+ NavLink,
2473
+ {
2474
+ item: n,
2475
+ className: "rounded-xl px-3 py-3 text-[1.0625rem]",
2476
+ onNavigate: () => setOpen(false)
2477
+ },
2478
+ n.href
2479
+ )) })
2480
+ ] })
2481
+ ] }) : null
2417
2482
  ] })
2418
- ] }) : null
2419
- ] })
2420
- ] })
2483
+ ]
2484
+ }
2485
+ )
2421
2486
  }
2422
2487
  );
2423
2488
  }
@@ -2662,6 +2727,6 @@ function ThemeToggle({ className }) {
2662
2727
  );
2663
2728
  }
2664
2729
 
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 };
2730
+ 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
2731
  //# sourceMappingURL=index.mjs.map
2667
2732
  //# sourceMappingURL=index.mjs.map