@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.
@@ -1,4 +1,4 @@
1
- import { forwardRef, createContext, createElement, useRef, useState, useEffect, useContext, Children, isValidElement, cloneElement, useCallback } from 'react';
1
+ import { forwardRef, createContext, createElement, useRef, useState, useEffect, useContext, Children, isValidElement, cloneElement, useCallback, Component } 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';
@@ -419,7 +419,13 @@ function StepGrid({ items, look = "cards", className }) {
419
419
  ] }) }, i)
420
420
  ) });
421
421
  }
422
- function ScrollFade({ fade = "var(--card)", className, innerClassName, children, ...props }) {
422
+ function ScrollFade({
423
+ fade = "var(--card)",
424
+ className,
425
+ innerClassName,
426
+ children,
427
+ ...props
428
+ }) {
423
429
  const ref = useRef(null);
424
430
  const [edges, setEdges] = useState({ left: false, right: false });
425
431
  const measure = useCallback(() => {
@@ -427,7 +433,9 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
427
433
  if (!el) return;
428
434
  const left = el.scrollLeft > 1;
429
435
  const right = el.scrollLeft + el.clientWidth < el.scrollWidth - 1;
430
- setEdges((e) => e.left === left && e.right === right ? e : { left, right });
436
+ setEdges(
437
+ (e) => e.left === left && e.right === right ? e : { left, right }
438
+ );
431
439
  }, []);
432
440
  useEffect(() => {
433
441
  const el = ref.current;
@@ -440,7 +448,19 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
440
448
  return () => ro.disconnect();
441
449
  }, [measure]);
442
450
  return /* @__PURE__ */ jsxs("div", { className: cn("relative min-w-0", className), ...props, children: [
443
- /* @__PURE__ */ jsx("div", { ref, onScroll: measure, className: cn("overflow-x-auto overscroll-x-contain", innerClassName), children }),
451
+ /* @__PURE__ */ jsx(
452
+ "div",
453
+ {
454
+ ref,
455
+ onScroll: measure,
456
+ tabIndex: edges.left || edges.right ? 0 : void 0,
457
+ className: cn(
458
+ "overflow-x-auto overscroll-x-contain rounded-[inherit] outline-none focus-visible:ring-2 focus-visible:ring-ring",
459
+ innerClassName
460
+ ),
461
+ children
462
+ }
463
+ ),
444
464
  /* @__PURE__ */ jsx(
445
465
  "span",
446
466
  {
@@ -449,7 +469,9 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
449
469
  "pointer-events-none absolute inset-y-0 left-0 w-8 transition-opacity duration-150",
450
470
  edges.left ? "opacity-100" : "opacity-0"
451
471
  ),
452
- style: { background: `linear-gradient(to right, ${fade}, transparent)` }
472
+ style: {
473
+ background: `linear-gradient(to right, ${fade}, transparent)`
474
+ }
453
475
  }
454
476
  ),
455
477
  /* @__PURE__ */ jsx(
@@ -1390,7 +1412,45 @@ function Monogram({
1390
1412
  }
1391
1413
  );
1392
1414
  }
1415
+ var ErrorBoundary = class extends Component {
1416
+ constructor() {
1417
+ super(...arguments);
1418
+ this.state = { failed: false, key: this.props.resetKey };
1419
+ this.reset = () => this.setState({ failed: false });
1420
+ }
1421
+ static getDerivedStateFromError() {
1422
+ return { failed: true };
1423
+ }
1424
+ static getDerivedStateFromProps(props, state) {
1425
+ return props.resetKey === state.key ? null : { failed: false, key: props.resetKey };
1426
+ }
1427
+ componentDidCatch(error, info) {
1428
+ this.props.onError?.(error, info);
1429
+ }
1430
+ render() {
1431
+ if (!this.state.failed) return this.props.children;
1432
+ if (this.props.fallback) return this.props.fallback(this.reset);
1433
+ return /* @__PURE__ */ jsx("div", { className: "oca-container py-16", children: /* @__PURE__ */ jsx(
1434
+ EmptyState,
1435
+ {
1436
+ title: "Something on this page broke.",
1437
+ action: /* @__PURE__ */ jsxs(Fragment, { children: [
1438
+ /* @__PURE__ */ jsx(Button, { onClick: this.reset, children: "Try again" }),
1439
+ /* @__PURE__ */ jsx(
1440
+ Button,
1441
+ {
1442
+ variant: "secondary",
1443
+ onClick: () => window.location.reload(),
1444
+ children: "Reload the page"
1445
+ }
1446
+ )
1447
+ ] }),
1448
+ children: "Nothing you saved is affected. If it keeps happening, tell us at hello@ochk.io."
1449
+ }
1450
+ ) });
1451
+ }
1452
+ };
1393
1453
 
1394
- export { Accent, ActivityList, BrowserFrame, CodeBlock, Container, CopyButton, DataTable, Display, DocHeader, DocLayout, EmptyLine, EmptyState, Eyebrow, FloatChip, Footnote, HashChip, KeyValueList, Lead, LoadingBlock, Monogram, Notice, PackageCard, PageHeader, PageHero, PhoneFrame, ProgressSteps, Prose, Reveal, Sats, SatsFigure, ScrollStory, Section, SectionIntro, SplitBar, StatCard, StatGrid, StepGrid, Ticker, TruthTable, UsdApprox, monogramGround, monogramLetter, satsText, sectionVariants, useCopy, useInView };
1454
+ export { Accent, ActivityList, BrowserFrame, CodeBlock, Container, CopyButton, DataTable, Display, DocHeader, DocLayout, EmptyLine, EmptyState, ErrorBoundary, Eyebrow, FloatChip, Footnote, HashChip, KeyValueList, Lead, LoadingBlock, Monogram, Notice, PackageCard, PageHeader, PageHero, PhoneFrame, ProgressSteps, Prose, Reveal, Sats, SatsFigure, ScrollStory, Section, SectionIntro, SplitBar, StatCard, StatGrid, StepGrid, Ticker, TruthTable, UsdApprox, monogramGround, monogramLetter, satsText, sectionVariants, useCopy, useInView };
1395
1455
  //# sourceMappingURL=components.mjs.map
1396
1456
  //# sourceMappingURL=components.mjs.map