@orangecheck/design 0.29.1 → 0.30.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.
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,93 @@ 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) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "px-4 py-2", children: [
3273
+ ">> ",
3274
+ a
3275
+ ] }, a)) })
3276
+ ] }),
3277
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-8 flex flex-wrap gap-3", children: [
3278
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { asChild: true, className: "font-mono", children: /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: homeHref, children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] tracking-widest uppercase", children: "go home" }) }) }),
3279
+ /* @__PURE__ */ jsxRuntime.jsx(
3280
+ Button,
3281
+ {
3282
+ variant: "outline",
3283
+ onClick: () => {
3284
+ if (typeof window === "undefined") return;
3285
+ if (isServerError) window.location.reload();
3286
+ else window.history.back();
3287
+ },
3288
+ className: "font-mono",
3289
+ children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] tracking-widest uppercase", children: isServerError ? "retry" : "go back" })
3290
+ }
3291
+ )
3292
+ ] }),
3293
+ children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6", children })
3294
+ ] })
3295
+ }
3296
+ );
3297
+ }
3211
3298
  var TONE_CLASS2 = {
3212
3299
  info: "border-primary/30 bg-primary/5",
3213
3300
  warning: "border-warning/40 bg-warning/5",
@@ -3249,7 +3336,7 @@ function CtaLink({
3249
3336
  if (external) {
3250
3337
  return /* @__PURE__ */ jsxRuntime.jsx("a", { href, target: "_blank", rel: "noreferrer", className: cls, children: text });
3251
3338
  }
3252
- return /* @__PURE__ */ jsxRuntime.jsx(Link6__default.default, { href, className: cls, children: text });
3339
+ return /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href, className: cls, children: text });
3253
3340
  }
3254
3341
  var TONE_CLASS3 = {
3255
3342
  default: "",
@@ -3933,7 +4020,7 @@ function EcosystemSwitcher({
3933
4020
  /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "py-1", children: [...ENTRIES, ...showOwnerEntries ? OWNER_ENTRIES : []].map((e) => {
3934
4021
  const isActive2 = e.slug === current;
3935
4022
  return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
3936
- Link6__default.default,
4023
+ Link7__default.default,
3937
4024
  {
3938
4025
  href: e.href,
3939
4026
  onClick: () => setOpen(false),
@@ -3954,7 +4041,7 @@ function EcosystemSwitcher({
3954
4041
  ) }, e.slug);
3955
4042
  }) }),
3956
4043
  /* @__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,
4044
+ Link7__default.default,
3958
4045
  {
3959
4046
  href: "https://docs.ochk.io",
3960
4047
  onClick: () => setOpen(false),
@@ -4301,7 +4388,7 @@ function OcLogoDropdown({
4301
4388
  }
4302
4389
  ),
4303
4390
  /* @__PURE__ */ jsxRuntime.jsxs(
4304
- Link6__default.default,
4391
+ Link7__default.default,
4305
4392
  {
4306
4393
  href: homeHref,
4307
4394
  "aria-label": "go to " + homeHref + " (this site's home)",
@@ -4351,7 +4438,7 @@ function OcLogoDropdown({
4351
4438
  const isActive2 = e.slug === current;
4352
4439
  const href = isActive2 ? homeHref : e.origin;
4353
4440
  return /* @__PURE__ */ jsxRuntime.jsx("li", { role: "none", children: /* @__PURE__ */ jsxRuntime.jsxs(
4354
- Link6__default.default,
4441
+ Link7__default.default,
4355
4442
  {
4356
4443
  href,
4357
4444
  role: "menuitem",
@@ -4383,7 +4470,7 @@ function OcLogoDropdown({
4383
4470
  ] }, category);
4384
4471
  }) }),
4385
4472
  /* @__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,
4473
+ Link7__default.default,
4387
4474
  {
4388
4475
  href: "https://docs.ochk.io",
4389
4476
  onClick: () => setOpen(false),
@@ -4713,7 +4800,7 @@ function MobileMenu({
4713
4800
  },
4714
4801
  l.href
4715
4802
  ) : /* @__PURE__ */ jsxRuntime.jsxs(
4716
- Link6__default.default,
4803
+ Link7__default.default,
4717
4804
  {
4718
4805
  href: l.href,
4719
4806
  role: "menuitem",
@@ -4948,7 +5035,7 @@ function OcAccountMenuView({
4948
5035
  },
4949
5036
  item.href
4950
5037
  ) : /* @__PURE__ */ jsxRuntime.jsx(
4951
- Link6__default.default,
5038
+ Link7__default.default,
4952
5039
  {
4953
5040
  href: item.href,
4954
5041
  onClick,
@@ -5169,7 +5256,7 @@ function PopoverSection({
5169
5256
  },
5170
5257
  item.href
5171
5258
  ) : /* @__PURE__ */ jsxRuntime.jsxs(
5172
- Link6__default.default,
5259
+ Link7__default.default,
5173
5260
  {
5174
5261
  href: item.href,
5175
5262
  onClick: onItemClick,
@@ -5272,7 +5359,7 @@ function OcPrimaryNav({
5272
5359
  },
5273
5360
  link.href
5274
5361
  ) : /* @__PURE__ */ jsxRuntime.jsx(
5275
- Link6__default.default,
5362
+ Link7__default.default,
5276
5363
  {
5277
5364
  href: link.href,
5278
5365
  "aria-current": active ? "page" : void 0,
@@ -5347,7 +5434,7 @@ function OcDashboardShell({
5347
5434
  }
5348
5435
  ),
5349
5436
  /* @__PURE__ */ jsxRuntime.jsx(
5350
- Link6__default.default,
5437
+ Link7__default.default,
5351
5438
  {
5352
5439
  href: rootHref,
5353
5440
  className: "text-primary font-mono text-[11px] tracking-widest uppercase",
@@ -5419,7 +5506,7 @@ function Sidebar({
5419
5506
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b px-4 py-3", children: [
5420
5507
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
5421
5508
  /* @__PURE__ */ jsxRuntime.jsx(
5422
- Link6__default.default,
5509
+ Link7__default.default,
5423
5510
  {
5424
5511
  href: rootHref,
5425
5512
  onClick: onClose,
@@ -5479,7 +5566,7 @@ function Sidebar({
5479
5566
  children: content
5480
5567
  }
5481
5568
  ) : /* @__PURE__ */ jsxRuntime.jsx(
5482
- Link6__default.default,
5569
+ Link7__default.default,
5483
5570
  {
5484
5571
  href: tool.href,
5485
5572
  onClick: onClose,
@@ -5541,7 +5628,7 @@ function OcDashboardHub({ tools, className }) {
5541
5628
  className: cls,
5542
5629
  children: content
5543
5630
  }
5544
- ) : /* @__PURE__ */ jsxRuntime.jsx(Link6__default.default, { href: tool.href, className: cls, children: content }) }, tool.id);
5631
+ ) : /* @__PURE__ */ jsxRuntime.jsx(Link7__default.default, { href: tool.href, className: cls, children: content }) }, tool.id);
5545
5632
  })
5546
5633
  }
5547
5634
  );
@@ -5643,7 +5730,7 @@ function FooterLinkItem({ link }) {
5643
5730
  " \u2197"
5644
5731
  ] });
5645
5732
  }
5646
- return /* @__PURE__ */ jsxRuntime.jsxs(Link6__default.default, { href: link.href, className: LINK_CLS, children: [
5733
+ return /* @__PURE__ */ jsxRuntime.jsxs(Link7__default.default, { href: link.href, className: LINK_CLS, children: [
5647
5734
  "> ",
5648
5735
  link.label
5649
5736
  ] });
@@ -5796,6 +5883,7 @@ exports.OcAppearanceMenu = OcAppearanceMenu;
5796
5883
  exports.OcAurora = OcAurora;
5797
5884
  exports.OcDashboardHub = OcDashboardHub;
5798
5885
  exports.OcDashboardShell = OcDashboardShell;
5886
+ exports.OcErrorPage = OcErrorPage;
5799
5887
  exports.OcFamilyFooter = OcFamilyFooter;
5800
5888
  exports.OcLogoDropdown = OcLogoDropdown;
5801
5889
  exports.OcPrimaryNav = OcPrimaryNav;