@nexub/patterns 9.4.0 → 9.6.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.
@@ -5,7 +5,7 @@ import {
5
5
  groupByDay,
6
6
  usePageMessages,
7
7
  useTemplateLocale
8
- } from "./chunk-7QCJC2DV.js";
8
+ } from "./chunk-S63ZWOZB.js";
9
9
 
10
10
  // src/components/ActivityPage/ActivityPage.tsx
11
11
  import * as React from "react";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-WRP73TXG.js";
5
5
  import {
6
6
  usePageMessages
7
- } from "./chunk-7QCJC2DV.js";
7
+ } from "./chunk-S63ZWOZB.js";
8
8
 
9
9
  // src/components/ChatPage/ChatPage.tsx
10
10
  import * as React from "react";
@@ -4,12 +4,12 @@ import {
4
4
  } from "./chunk-INKX2GYA.js";
5
5
  import {
6
6
  TransactionRow
7
- } from "./chunk-MPYNCRDP.js";
7
+ } from "./chunk-AUJER5GR.js";
8
8
  import {
9
9
  PageFrame,
10
10
  usePageMessages,
11
11
  useTemplateLocale
12
- } from "./chunk-7QCJC2DV.js";
12
+ } from "./chunk-S63ZWOZB.js";
13
13
 
14
14
  // src/components/DashboardPage/DashboardPage.tsx
15
15
  import * as React from "react";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  PageFrame,
4
4
  usePageMessages
5
- } from "./chunk-7QCJC2DV.js";
5
+ } from "./chunk-S63ZWOZB.js";
6
6
 
7
7
  // src/components/SettingsPage/SettingsPage.tsx
8
8
  import * as React from "react";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  PageFrame,
4
4
  usePageMessages
5
- } from "./chunk-7QCJC2DV.js";
5
+ } from "./chunk-S63ZWOZB.js";
6
6
 
7
7
  // src/components/PaywallPage/PaywallPage.tsx
8
8
  import * as React from "react";
@@ -7,7 +7,7 @@ import {
7
7
  formatMoney,
8
8
  usePageMessages,
9
9
  useTemplateLocale
10
- } from "./chunk-7QCJC2DV.js";
10
+ } from "./chunk-S63ZWOZB.js";
11
11
 
12
12
  // src/components/CheckoutPage/CheckoutPage.tsx
13
13
  import * as React from "react";
@@ -6,7 +6,7 @@ import {
6
6
  PageFrame,
7
7
  usePageMessages,
8
8
  useTemplateLocale
9
- } from "./chunk-7QCJC2DV.js";
9
+ } from "./chunk-S63ZWOZB.js";
10
10
 
11
11
  // src/components/TransactionDetailPage/TransactionDetailPage.tsx
12
12
  import * as React from "react";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-HMJRSNJD.js";
5
5
  import {
6
6
  usePageMessages
7
- } from "./chunk-7QCJC2DV.js";
7
+ } from "./chunk-S63ZWOZB.js";
8
8
 
9
9
  // src/components/SignInPage/SignInPage.tsx
10
10
  import * as React from "react";
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/components/PageFrame/PageFrame.tsx
4
4
  import * as React from "react";
5
- import { Badge, cn, useLocale, useNexubMessages } from "@nexub/react";
5
+ import { Badge, Button, EmptyStatePreset, cn, useLocale, useNexubMessages } from "@nexub/react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  var defaultPageTemplateMessages = {
8
8
  activity: "Activity",
@@ -77,8 +77,34 @@ function StatusBadge({ status, m, dot }) {
77
77
  status === "failed" ? m.failed : m.pending
78
78
  ] });
79
79
  }
80
+ function DefaultFallback({ reset }) {
81
+ const m = useNexubMessages();
82
+ return /* @__PURE__ */ jsx(
83
+ EmptyStatePreset,
84
+ {
85
+ kind: "serverError",
86
+ actions: /* @__PURE__ */ jsx(Button, { variant: "tonal", onClick: reset, children: m.retry })
87
+ }
88
+ );
89
+ }
90
+ var ContentBoundary = class extends React.Component {
91
+ state = { failed: false, error: void 0 };
92
+ static getDerivedStateFromError(error) {
93
+ return { failed: true, error };
94
+ }
95
+ componentDidCatch(error, info) {
96
+ this.props.onError?.(error, info);
97
+ }
98
+ reset = () => this.setState({ failed: false, error: void 0 });
99
+ render() {
100
+ if (!this.state.failed) return this.props.children;
101
+ const { errorFallback } = this.props;
102
+ if (typeof errorFallback === "function") return errorFallback({ error: this.state.error, reset: this.reset });
103
+ return errorFallback ?? /* @__PURE__ */ jsx(DefaultFallback, { reset: this.reset });
104
+ }
105
+ };
80
106
  var widths = { sm: "max-w-[480px]", md: "max-w-3xl", lg: "max-w-6xl" };
81
- var PageFrame = React.forwardRef(function PageFrame2({ as: Tag = "main", title, description, actions, eyebrow, width = "md", className, children, ...props }, ref) {
107
+ var PageFrame = React.forwardRef(function PageFrame2({ as: Tag = "main", title, description, actions, eyebrow, width = "md", className, children, errorFallback, onError, ...props }, ref) {
82
108
  const headingId = React.useId();
83
109
  return /* @__PURE__ */ jsxs(
84
110
  Tag,
@@ -96,7 +122,7 @@ var PageFrame = React.forwardRef(function PageFrame2({ as: Tag = "main", title,
96
122
  ] }),
97
123
  description && /* @__PURE__ */ jsx("p", { className: "text-body-md text-[var(--color-on-surface-muted)]", children: description })
98
124
  ] }),
99
- children
125
+ /* @__PURE__ */ jsx(ContentBoundary, { errorFallback, onError, children })
100
126
  ]
101
127
  }
102
128
  );
@@ -3,8 +3,8 @@ import "../../chunk-CWFZA7ZQ.js";
3
3
  import {
4
4
  ActivityPage,
5
5
  TransactionRow
6
- } from "../../chunk-MPYNCRDP.js";
7
- import "../../chunk-7QCJC2DV.js";
6
+ } from "../../chunk-AUJER5GR.js";
7
+ import "../../chunk-S63ZWOZB.js";
8
8
  export {
9
9
  ActivityPage,
10
10
  TransactionRow
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import {
3
3
  ChatPage
4
- } from "../../chunk-64PSI75E.js";
4
+ } from "../../chunk-IHUELKTD.js";
5
5
  import "../../chunk-WRP73TXG.js";
6
- import "../../chunk-7QCJC2DV.js";
6
+ import "../../chunk-S63ZWOZB.js";
7
7
  export {
8
8
  ChatPage
9
9
  };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import {
3
3
  CheckoutPage
4
- } from "../../chunk-Y5HDYYW5.js";
4
+ } from "../../chunk-LX6YY2KQ.js";
5
5
  import "../../chunk-WPNT5JOU.js";
6
- import "../../chunk-7QCJC2DV.js";
6
+ import "../../chunk-S63ZWOZB.js";
7
7
  export {
8
8
  CheckoutPage
9
9
  };
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import {
3
3
  DashboardPage
4
- } from "../../chunk-Y52QKHGE.js";
4
+ } from "../../chunk-JN5U727F.js";
5
5
  import "../../chunk-INKX2GYA.js";
6
- import "../../chunk-MPYNCRDP.js";
7
- import "../../chunk-7QCJC2DV.js";
6
+ import "../../chunk-AUJER5GR.js";
7
+ import "../../chunk-S63ZWOZB.js";
8
8
  export {
9
9
  DashboardPage
10
10
  };
@@ -5,7 +5,7 @@ import {
5
5
  defaultPageTemplateMessages,
6
6
  groupByDay,
7
7
  usePageMessages
8
- } from "../../chunk-7QCJC2DV.js";
8
+ } from "../../chunk-S63ZWOZB.js";
9
9
  export {
10
10
  PageFrame,
11
11
  defaultPageTemplateMessages,
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import {
3
3
  PaywallPage
4
- } from "../../chunk-LLBFQJ3B.js";
5
- import "../../chunk-7QCJC2DV.js";
4
+ } from "../../chunk-K2FAHLBJ.js";
5
+ import "../../chunk-S63ZWOZB.js";
6
6
  export {
7
7
  PaywallPage
8
8
  };
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import {
3
3
  SettingsPage
4
- } from "../../chunk-W3ADLRKA.js";
5
- import "../../chunk-7QCJC2DV.js";
4
+ } from "../../chunk-JXST66ON.js";
5
+ import "../../chunk-S63ZWOZB.js";
6
6
  export {
7
7
  SettingsPage
8
8
  };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import {
3
3
  SignInPage
4
- } from "../../chunk-7PQPVRYW.js";
4
+ } from "../../chunk-RXT3LZQL.js";
5
5
  import "../../chunk-HMJRSNJD.js";
6
- import "../../chunk-7QCJC2DV.js";
6
+ import "../../chunk-S63ZWOZB.js";
7
7
  export {
8
8
  SignInPage
9
9
  };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import {
3
3
  TransactionDetailPage
4
- } from "../../chunk-SMV7OA63.js";
4
+ } from "../../chunk-PGGREX6G.js";
5
5
  import "../../chunk-WPNT5JOU.js";
6
- import "../../chunk-7QCJC2DV.js";
6
+ import "../../chunk-S63ZWOZB.js";
7
7
  export {
8
8
  TransactionDetailPage
9
9
  };
package/dist/index.d.ts CHANGED
@@ -511,7 +511,16 @@ declare function groupByDay(transactions: Transaction[], locale: string): {
511
511
  title: string;
512
512
  data: Transaction[];
513
513
  }[];
514
- interface PageFrameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
514
+ interface ContentBoundaryProps {
515
+ /** Shown in place of content that threw while rendering. Default: the "Something went wrong" state with Retry. */
516
+ errorFallback?: React.ReactNode | ((state: {
517
+ error: unknown;
518
+ reset: () => void;
519
+ }) => React.ReactNode);
520
+ /** Called with the error, for reporting (Sentry, Datadog). */
521
+ onError?: (error: unknown, info: React.ErrorInfo) => void;
522
+ }
523
+ interface PageFrameProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'onError'>, ContentBoundaryProps {
515
524
  /** Landmark element. Use `div` inside an app shell that already renders `<main>`. @default 'main' */
516
525
  as?: 'main' | 'div' | 'section';
517
526
  title?: React.ReactNode;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import {
3
3
  TransactionDetailPage
4
- } from "./chunk-SMV7OA63.js";
4
+ } from "./chunk-PGGREX6G.js";
5
5
  import {
6
6
  UserCard
7
7
  } from "./chunk-7NYGYETG.js";
@@ -9,39 +9,39 @@ import "./chunk-EQQOVRRM.js";
9
9
  import "./chunk-RFCPEZGF.js";
10
10
  import {
11
11
  PaywallPage
12
- } from "./chunk-LLBFQJ3B.js";
12
+ } from "./chunk-K2FAHLBJ.js";
13
+ import {
14
+ PlanCard
15
+ } from "./chunk-I5OGZW3U.js";
13
16
  import {
14
17
  SettingsLayout,
15
18
  SettingsRow
16
19
  } from "./chunk-KJ4QGNXD.js";
17
- import {
18
- PlanCard
19
- } from "./chunk-I5OGZW3U.js";
20
20
  import {
21
21
  SettingsPage
22
- } from "./chunk-W3ADLRKA.js";
22
+ } from "./chunk-JXST66ON.js";
23
23
  import {
24
24
  SettingsSection
25
25
  } from "./chunk-U3FT7XAU.js";
26
26
  import {
27
27
  SignInPage
28
- } from "./chunk-7PQPVRYW.js";
28
+ } from "./chunk-RXT3LZQL.js";
29
29
  import {
30
30
  CheckoutPage
31
- } from "./chunk-Y5HDYYW5.js";
31
+ } from "./chunk-LX6YY2KQ.js";
32
32
  import {
33
33
  DashboardPage
34
- } from "./chunk-Y52QKHGE.js";
34
+ } from "./chunk-JN5U727F.js";
35
35
  import {
36
36
  StatCard
37
37
  } from "./chunk-INKX2GYA.js";
38
+ import {
39
+ FilterBar
40
+ } from "./chunk-SNONOBAE.js";
38
41
  import {
39
42
  ErrorSummary,
40
43
  useFormErrors
41
44
  } from "./chunk-RWPFCNMJ.js";
42
- import {
43
- FilterBar
44
- } from "./chunk-SNONOBAE.js";
45
45
  import {
46
46
  InfoList
47
47
  } from "./chunk-WPNT5JOU.js";
@@ -64,7 +64,7 @@ import "./chunk-CWFZA7ZQ.js";
64
64
  import {
65
65
  ActivityPage,
66
66
  TransactionRow
67
- } from "./chunk-MPYNCRDP.js";
67
+ } from "./chunk-AUJER5GR.js";
68
68
  import "./chunk-VYMTTYPR.js";
69
69
  import {
70
70
  AppLauncher
@@ -78,7 +78,7 @@ import {
78
78
  } from "./chunk-WZTDCJYP.js";
79
79
  import {
80
80
  ChatPage
81
- } from "./chunk-64PSI75E.js";
81
+ } from "./chunk-IHUELKTD.js";
82
82
  import {
83
83
  Conversation
84
84
  } from "./chunk-WRP73TXG.js";
@@ -87,7 +87,7 @@ import {
87
87
  defaultPageTemplateMessages,
88
88
  groupByDay,
89
89
  usePageMessages
90
- } from "./chunk-7QCJC2DV.js";
90
+ } from "./chunk-S63ZWOZB.js";
91
91
  export {
92
92
  ActivityFeed,
93
93
  ActivityPage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexub/patterns",
3
- "version": "9.4.0",
3
+ "version": "9.6.0",
4
4
  "description": "Composite UI patterns for Nexub Design System — pre-built, production-ready layouts and widgets built on @nexub/react.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,9 +39,9 @@
39
39
  "peerDependencies": {
40
40
  "react": ">=19 <20",
41
41
  "react-dom": ">=19 <20",
42
- "@nexub/icons": "^9.4.0",
43
- "@nexub/react": "^9.4.0",
44
- "@nexub/tokens": "^9.4.0"
42
+ "@nexub/icons": "^9.6.0",
43
+ "@nexub/react": "^9.6.0",
44
+ "@nexub/tokens": "^9.6.0"
45
45
  },
46
46
  "peerDependenciesMeta": {
47
47
  "@nexub/icons": {
@@ -65,9 +65,9 @@
65
65
  "typescript": "~6.0.3",
66
66
  "vite": "^8.3.5",
67
67
  "vitest": "^5.0.5",
68
- "@nexub/icons": "9.4.0",
69
- "@nexub/react": "9.4.0",
70
- "@nexub/tokens": "9.4.0"
68
+ "@nexub/icons": "9.6.0",
69
+ "@nexub/react": "9.6.0",
70
+ "@nexub/tokens": "9.6.0"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "tsup && tailwindcss -i src/styles.css -o dist/styles.css --minify",