@orangecheck/design 0.29.1 → 0.30.1

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.js CHANGED
@@ -20,7 +20,7 @@ var SelectPrimitive = require('@radix-ui/react-select');
20
20
  var sonner = require('sonner');
21
21
  var TabsPrimitive = require('@radix-ui/react-tabs');
22
22
  var QRCode = require('qrcode');
23
- var Link6 = require('next/link');
23
+ var Link7 = require('next/link');
24
24
  var router = require('next/router');
25
25
  var authClient = require('@orangecheck/auth-client');
26
26
 
@@ -56,7 +56,7 @@ var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrim
56
56
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
57
57
  var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
58
58
  var QRCode__default = /*#__PURE__*/_interopDefault(QRCode);
59
- var Link6__default = /*#__PURE__*/_interopDefault(Link6);
59
+ var Link7__default = /*#__PURE__*/_interopDefault(Link7);
60
60
 
61
61
  var __defProp = Object.defineProperty;
62
62
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -3208,6 +3208,104 @@ function SectionHeader({
3208
3208
  meta && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/70 font-mono text-[10px] tracking-widest uppercase", children: meta })
3209
3209
  ] });
3210
3210
  }
3211
+ var VARIANTS = {
3212
+ "not-found": {
3213
+ code: 404,
3214
+ title: "no such route",
3215
+ detail: "the page you're looking for doesn't exist, or has been moved.",
3216
+ tone: "text-primary",
3217
+ label: "not found",
3218
+ actions: []
3219
+ },
3220
+ "server-error": {
3221
+ code: 500,
3222
+ title: "internal error",
3223
+ detail: "something went wrong on our end.",
3224
+ tone: "text-destructive",
3225
+ label: "server error",
3226
+ actions: [
3227
+ "try refreshing the page",
3228
+ "wait a few minutes, try again",
3229
+ "return home and start over"
3230
+ ]
3231
+ }
3232
+ };
3233
+ function OcErrorPage({
3234
+ variant = "not-found",
3235
+ code,
3236
+ title,
3237
+ detail,
3238
+ actions,
3239
+ homeHref = "/",
3240
+ children,
3241
+ className = ""
3242
+ }) {
3243
+ const v = VARIANTS[variant];
3244
+ const shownCode = code ?? v.code;
3245
+ const shownActions = actions ?? [...v.actions];
3246
+ const isServerError = variant === "server-error";
3247
+ return /* @__PURE__ */ jsxRuntime.jsx(
3248
+ "div",
3249
+ {
3250
+ className: `container flex min-h-[60vh] flex-col items-center justify-center ${className}`,
3251
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full max-w-xl", children: [
3252
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `label-mono mb-4 ${v.tone}`, children: [
3253
+ "\xA7 ",
3254
+ shownCode,
3255
+ " // ",
3256
+ v.label
3257
+ ] }),
3258
+ /* @__PURE__ */ jsxRuntime.jsx(
3259
+ "h1",
3260
+ {
3261
+ className: `font-display text-7xl font-bold tracking-tight tabular-nums sm:text-8xl ${v.tone}`,
3262
+ children: shownCode
3263
+ }
3264
+ ),
3265
+ /* @__PURE__ */ jsxRuntime.jsx("h2", { className: "font-display mt-2 text-2xl font-bold tracking-tight sm:text-3xl", children: title ?? v.title }),
3266
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-muted-foreground mt-3 font-mono text-xs", children: [
3267
+ "// ",
3268
+ detail ?? v.detail
3269
+ ] }),
3270
+ shownActions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 border", children: [
3271
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b px-4 py-2 font-mono text-[11px] tracking-widest uppercase", children: "what can you do" }),
3272
+ /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "divide-y font-mono text-xs", children: shownActions.map((a, i) => (
3273
+ // Index keys: items are nodes and the list is
3274
+ // static per variant, so there is nothing
3275
+ // better to key on and nothing reorders.
3276
+ /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "px-4 py-2", children: [
3277
+ ">> ",
3278
+ a
3279
+ ] }, i)
3280
+ )) })
3281
+ ] }),
3282
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 flex flex-wrap gap-3", children: [
3283
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { asChild: true, className: "font-mono", children: /* @__PURE__ */ jsxRuntime.jsxs(Link7__default.default, { href: homeHref, children: [
3284
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Home, { className: "mr-2 h-3 w-3" }),
3285
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] tracking-widest uppercase", children: "go home" })
3286
+ ] }) }),
3287
+ /* @__PURE__ */ jsxRuntime.jsxs(
3288
+ Button,
3289
+ {
3290
+ variant: "outline",
3291
+ onClick: () => {
3292
+ if (typeof window === "undefined") return;
3293
+ if (isServerError) window.location.reload();
3294
+ else window.history.back();
3295
+ },
3296
+ className: "font-mono",
3297
+ children: [
3298
+ isServerError ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "mr-2 h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { className: "mr-2 h-3 w-3" }),
3299
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] tracking-widest uppercase", children: isServerError ? "retry" : "go back" })
3300
+ ]
3301
+ }
3302
+ )
3303
+ ] }),
3304
+ children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6", children })
3305
+ ] })
3306
+ }
3307
+ );
3308
+ }
3211
3309
  var TONE_CLASS2 = {
3212
3310
  info: "border-primary/30 bg-primary/5",
3213
3311
  warning: "border-warning/40 bg-warning/5",
@@ -3249,7 +3347,7 @@ function CtaLink({
3249
3347
  if (external) {
3250
3348
  return /* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noreferrer", className: cls, children: text });
3251
3349
  }
3252
- return /* @__PURE__ */ jsxRuntime.jsx(Link6__default.default, { href, className: cls, children: text });
3350
+ return /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href, className: cls, children: text });
3253
3351
  }
3254
3352
  var TONE_CLASS3 = {
3255
3353
  default: "",
@@ -3933,7 +4031,7 @@ function EcosystemSwitcher({
3933
4031
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "py-1", children: [...ENTRIES, ...showOwnerEntries ? OWNER_ENTRIES : []].map((e) => {
3934
4032
  const isActive2 = e.slug === current;
3935
4033
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
3936
- Link6__default.default,
4034
+ Link7__default.default,
3937
4035
  {
3938
4036
  href: e.href,
3939
4037
  onClick: () => setOpen(false),
@@ -3954,7 +4052,7 @@ function EcosystemSwitcher({
3954
4052
  ) }, e.slug);
3955
4053
  }) }),
3956
4054
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t px-4 py-2 font-mono text-[10px] tracking-widest uppercase", children: /* @__PURE__ */ jsxRuntime.jsx(
3957
- Link6__default.default,
4055
+ Link7__default.default,
3958
4056
  {
3959
4057
  href: "https://docs.ochk.io",
3960
4058
  onClick: () => setOpen(false),
@@ -4301,7 +4399,7 @@ function OcLogoDropdown({
4301
4399
  }
4302
4400
  ),
4303
4401
  /* @__PURE__ */ jsxRuntime.jsxs(
4304
- Link6__default.default,
4402
+ Link7__default.default,
4305
4403
  {
4306
4404
  href: homeHref,
4307
4405
  "aria-label": "go to " + homeHref + " (this site's home)",
@@ -4351,7 +4449,7 @@ function OcLogoDropdown({
4351
4449
  const isActive2 = e.slug === current;
4352
4450
  const href = isActive2 ? homeHref : e.origin;
4353
4451
  return /* @__PURE__ */ jsxRuntime.jsx("li", { role: "none", children: /* @__PURE__ */ jsxRuntime.jsxs(
4354
- Link6__default.default,
4452
+ Link7__default.default,
4355
4453
  {
4356
4454
  href,
4357
4455
  role: "menuitem",
@@ -4383,7 +4481,7 @@ function OcLogoDropdown({
4383
4481
  ] }, category);
4384
4482
  }) }),
4385
4483
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t px-4 py-2 font-mono text-[10px] tracking-widest uppercase", children: /* @__PURE__ */ jsxRuntime.jsx(
4386
- Link6__default.default,
4484
+ Link7__default.default,
4387
4485
  {
4388
4486
  href: "https://docs.ochk.io",
4389
4487
  onClick: () => setOpen(false),
@@ -4713,7 +4811,7 @@ function MobileMenu({
4713
4811
  },
4714
4812
  l.href
4715
4813
  ) : /* @__PURE__ */ jsxRuntime.jsxs(
4716
- Link6__default.default,
4814
+ Link7__default.default,
4717
4815
  {
4718
4816
  href: l.href,
4719
4817
  role: "menuitem",
@@ -4948,7 +5046,7 @@ function OcAccountMenuView({
4948
5046
  },
4949
5047
  item.href
4950
5048
  ) : /* @__PURE__ */ jsxRuntime.jsx(
4951
- Link6__default.default,
5049
+ Link7__default.default,
4952
5050
  {
4953
5051
  href: item.href,
4954
5052
  onClick,
@@ -5169,7 +5267,7 @@ function PopoverSection({
5169
5267
  },
5170
5268
  item.href
5171
5269
  ) : /* @__PURE__ */ jsxRuntime.jsxs(
5172
- Link6__default.default,
5270
+ Link7__default.default,
5173
5271
  {
5174
5272
  href: item.href,
5175
5273
  onClick: onItemClick,
@@ -5272,7 +5370,7 @@ function OcPrimaryNav({
5272
5370
  },
5273
5371
  link.href
5274
5372
  ) : /* @__PURE__ */ jsxRuntime.jsx(
5275
- Link6__default.default,
5373
+ Link7__default.default,
5276
5374
  {
5277
5375
  href: link.href,
5278
5376
  "aria-current": active ? "page" : void 0,
@@ -5347,7 +5445,7 @@ function OcDashboardShell({
5347
5445
  }
5348
5446
  ),
5349
5447
  /* @__PURE__ */ jsxRuntime.jsx(
5350
- Link6__default.default,
5448
+ Link7__default.default,
5351
5449
  {
5352
5450
  href: rootHref,
5353
5451
  className: "text-primary font-mono text-[11px] tracking-widest uppercase",
@@ -5419,7 +5517,7 @@ function Sidebar({
5419
5517
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b px-4 py-3", children: [
5420
5518
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
5421
5519
  /* @__PURE__ */ jsxRuntime.jsx(
5422
- Link6__default.default,
5520
+ Link7__default.default,
5423
5521
  {
5424
5522
  href: rootHref,
5425
5523
  onClick: onClose,
@@ -5479,7 +5577,7 @@ function Sidebar({
5479
5577
  children: content
5480
5578
  }
5481
5579
  ) : /* @__PURE__ */ jsxRuntime.jsx(
5482
- Link6__default.default,
5580
+ Link7__default.default,
5483
5581
  {
5484
5582
  href: tool.href,
5485
5583
  onClick: onClose,
@@ -5541,7 +5639,7 @@ function OcDashboardHub({ tools, className }) {
5541
5639
  className: cls,
5542
5640
  children: content
5543
5641
  }
5544
- ) : /* @__PURE__ */ jsxRuntime.jsx(Link6__default.default, { href: tool.href, className: cls, children: content }) }, tool.id);
5642
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: tool.href, className: cls, children: content }) }, tool.id);
5545
5643
  })
5546
5644
  }
5547
5645
  );
@@ -5643,7 +5741,7 @@ function FooterLinkItem({ link }) {
5643
5741
  " \u2197"
5644
5742
  ] });
5645
5743
  }
5646
- return /* @__PURE__ */ jsxRuntime.jsxs(Link6__default.default, { href: link.href, className: LINK_CLS, children: [
5744
+ return /* @__PURE__ */ jsxRuntime.jsxs(Link7__default.default, { href: link.href, className: LINK_CLS, children: [
5647
5745
  "> ",
5648
5746
  link.label
5649
5747
  ] });
@@ -5796,6 +5894,7 @@ exports.OcAppearanceMenu = OcAppearanceMenu;
5796
5894
  exports.OcAurora = OcAurora;
5797
5895
  exports.OcDashboardHub = OcDashboardHub;
5798
5896
  exports.OcDashboardShell = OcDashboardShell;
5897
+ exports.OcErrorPage = OcErrorPage;
5799
5898
  exports.OcFamilyFooter = OcFamilyFooter;
5800
5899
  exports.OcLogoDropdown = OcLogoDropdown;
5801
5900
  exports.OcPrimaryNav = OcPrimaryNav;