@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.
@@ -1,13 +1,13 @@
1
1
  import * as Popover from '@radix-ui/react-popover';
2
- import { ChevronDown, Plus, HelpCircle, X, Check } from 'lucide-react';
2
+ import { ChevronDown, Plus, HelpCircle, Home, RefreshCw, ArrowLeft, X, Check } from 'lucide-react';
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
5
5
  import { jsx, jsxs } from 'react/jsx-runtime';
6
6
  import Link from 'next/link';
7
- import * as React3 from 'react';
8
- import { Fragment } from 'react';
9
7
  import { Slot } from '@radix-ui/react-slot';
10
8
  import { cva } from 'class-variance-authority';
9
+ import * as React3 from 'react';
10
+ import { Fragment } from 'react';
11
11
  import '@radix-ui/react-label';
12
12
  import '@radix-ui/react-checkbox';
13
13
  import '@radix-ui/react-radio-group';
@@ -93,6 +93,153 @@ function SectionHeader({
93
93
  meta && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/70 font-mono text-[10px] tracking-widest uppercase", children: meta })
94
94
  ] });
95
95
  }
96
+ var buttonVariants = cva(
97
+ "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
98
+ {
99
+ variants: {
100
+ variant: {
101
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
102
+ destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white",
103
+ outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
104
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
105
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
106
+ link: "text-primary underline-offset-4 hover:underline",
107
+ // For CTAs placed ON a saturated brand band or a dark section
108
+ // (e.g. a terracotta hero / footer / a forced-dark block) where
109
+ // the surface is dark+light-text in either mode. A neutral white
110
+ // pill + a translucent-white ghost read on any such surface;
111
+ // hardcoded white is deliberate (cf. destructive's text-white).
112
+ onBrand: "bg-white text-neutral-900 shadow-sm hover:bg-white/90",
113
+ onBrandOutline: "border border-white/40 bg-transparent text-white hover:bg-white/10"
114
+ },
115
+ size: {
116
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
117
+ sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
118
+ lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
119
+ icon: "size-9"
120
+ }
121
+ },
122
+ defaultVariants: {
123
+ variant: "default",
124
+ size: "default"
125
+ }
126
+ }
127
+ );
128
+ function Button({
129
+ className,
130
+ variant,
131
+ size,
132
+ asChild = false,
133
+ ...props
134
+ }) {
135
+ const Comp = asChild ? Slot : "button";
136
+ return /* @__PURE__ */ jsx(
137
+ Comp,
138
+ {
139
+ "data-slot": "button",
140
+ className: cn(buttonVariants({ variant, size, className })),
141
+ ...props
142
+ }
143
+ );
144
+ }
145
+ var VARIANTS = {
146
+ "not-found": {
147
+ code: 404,
148
+ title: "no such route",
149
+ detail: "the page you're looking for doesn't exist, or has been moved.",
150
+ tone: "text-primary",
151
+ label: "not found",
152
+ actions: []
153
+ },
154
+ "server-error": {
155
+ code: 500,
156
+ title: "internal error",
157
+ detail: "something went wrong on our end.",
158
+ tone: "text-destructive",
159
+ label: "server error",
160
+ actions: [
161
+ "try refreshing the page",
162
+ "wait a few minutes, try again",
163
+ "return home and start over"
164
+ ]
165
+ }
166
+ };
167
+ function OcErrorPage({
168
+ variant = "not-found",
169
+ code,
170
+ title,
171
+ detail,
172
+ actions,
173
+ homeHref = "/",
174
+ children,
175
+ className = ""
176
+ }) {
177
+ const v = VARIANTS[variant];
178
+ const shownCode = code ?? v.code;
179
+ const shownActions = actions ?? [...v.actions];
180
+ const isServerError = variant === "server-error";
181
+ return /* @__PURE__ */ jsx(
182
+ "div",
183
+ {
184
+ className: `container flex min-h-[60vh] flex-col items-center justify-center ${className}`,
185
+ children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-xl", children: [
186
+ /* @__PURE__ */ jsxs("div", { className: `label-mono mb-4 ${v.tone}`, children: [
187
+ "\xA7 ",
188
+ shownCode,
189
+ " // ",
190
+ v.label
191
+ ] }),
192
+ /* @__PURE__ */ jsx(
193
+ "h1",
194
+ {
195
+ className: `font-display text-7xl font-bold tracking-tight tabular-nums sm:text-8xl ${v.tone}`,
196
+ children: shownCode
197
+ }
198
+ ),
199
+ /* @__PURE__ */ jsx("h2", { className: "font-display mt-2 text-2xl font-bold tracking-tight sm:text-3xl", children: title ?? v.title }),
200
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground mt-3 font-mono text-xs", children: [
201
+ "// ",
202
+ detail ?? v.detail
203
+ ] }),
204
+ shownActions.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-8 border", children: [
205
+ /* @__PURE__ */ jsx("div", { className: "border-b px-4 py-2 font-mono text-[11px] tracking-widest uppercase", children: "what can you do" }),
206
+ /* @__PURE__ */ jsx("ul", { className: "divide-y font-mono text-xs", children: shownActions.map((a, i) => (
207
+ // Index keys: items are nodes and the list is
208
+ // static per variant, so there is nothing
209
+ // better to key on and nothing reorders.
210
+ /* @__PURE__ */ jsxs("li", { className: "px-4 py-2", children: [
211
+ ">> ",
212
+ a
213
+ ] }, i)
214
+ )) })
215
+ ] }),
216
+ /* @__PURE__ */ jsxs("div", { className: "mt-8 flex flex-wrap gap-3", children: [
217
+ /* @__PURE__ */ jsx(Button, { asChild: true, className: "font-mono", children: /* @__PURE__ */ jsxs(Link, { href: homeHref, children: [
218
+ /* @__PURE__ */ jsx(Home, { className: "mr-2 h-3 w-3" }),
219
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] tracking-widest uppercase", children: "go home" })
220
+ ] }) }),
221
+ /* @__PURE__ */ jsxs(
222
+ Button,
223
+ {
224
+ variant: "outline",
225
+ onClick: () => {
226
+ if (typeof window === "undefined") return;
227
+ if (isServerError) window.location.reload();
228
+ else window.history.back();
229
+ },
230
+ className: "font-mono",
231
+ children: [
232
+ isServerError ? /* @__PURE__ */ jsx(RefreshCw, { className: "mr-2 h-3 w-3" }) : /* @__PURE__ */ jsx(ArrowLeft, { className: "mr-2 h-3 w-3" }),
233
+ /* @__PURE__ */ jsx("span", { className: "text-[11px] tracking-widest uppercase", children: isServerError ? "retry" : "go back" })
234
+ ]
235
+ }
236
+ )
237
+ ] }),
238
+ children && /* @__PURE__ */ jsx("div", { className: "mt-6", children })
239
+ ] })
240
+ }
241
+ );
242
+ }
96
243
  var TONE_CLASS2 = {
97
244
  info: "border-primary/30 bg-primary/5",
98
245
  warning: "border-warning/40 bg-warning/5",
@@ -361,55 +508,6 @@ function MarketingHeading({
361
508
  )
362
509
  ] });
363
510
  }
364
- var buttonVariants = cva(
365
- "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
366
- {
367
- variants: {
368
- variant: {
369
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
370
- destructive: "bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white",
371
- outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
372
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
373
- ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
374
- link: "text-primary underline-offset-4 hover:underline",
375
- // For CTAs placed ON a saturated brand band or a dark section
376
- // (e.g. a terracotta hero / footer / a forced-dark block) where
377
- // the surface is dark+light-text in either mode. A neutral white
378
- // pill + a translucent-white ghost read on any such surface;
379
- // hardcoded white is deliberate (cf. destructive's text-white).
380
- onBrand: "bg-white text-neutral-900 shadow-sm hover:bg-white/90",
381
- onBrandOutline: "border border-white/40 bg-transparent text-white hover:bg-white/10"
382
- },
383
- size: {
384
- default: "h-9 px-4 py-2 has-[>svg]:px-3",
385
- sm: "h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",
386
- lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
387
- icon: "size-9"
388
- }
389
- },
390
- defaultVariants: {
391
- variant: "default",
392
- size: "default"
393
- }
394
- }
395
- );
396
- function Button({
397
- className,
398
- variant,
399
- size,
400
- asChild = false,
401
- ...props
402
- }) {
403
- const Comp = asChild ? Slot : "button";
404
- return /* @__PURE__ */ jsx(
405
- Comp,
406
- {
407
- "data-slot": "button",
408
- className: cn(buttonVariants({ variant, size, className })),
409
- ...props
410
- }
411
- );
412
- }
413
511
  cva(
414
512
  "focus-visible:border-ring focus-visible:ring-ring/50 inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-md border px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] [&>svg]:pointer-events-none [&>svg]:size-3",
415
513
  {
@@ -896,6 +994,6 @@ function VerifiedChip({ icon, iconTone = "peach", label, className }) {
896
994
  );
897
995
  }
898
996
 
899
- export { AccentList, AccentNote, BrandBand, Callout, CheckList, ComparisonTable, DataRow, DefinitionList, EmailCapture, EmptyState, Faq, FeatureCard, HelpHint, MarketingHeading, NumberedStep, Panel, Section, SectionHeader, StatCard, StatGrid, StatTile, StepList, TwoToneHeading, VerifiedChip };
997
+ export { AccentList, AccentNote, BrandBand, Callout, CheckList, ComparisonTable, DataRow, DefinitionList, EmailCapture, EmptyState, Faq, FeatureCard, HelpHint, MarketingHeading, NumberedStep, OcErrorPage, Panel, Section, SectionHeader, StatCard, StatGrid, StatTile, StepList, TwoToneHeading, VerifiedChip };
900
998
  //# sourceMappingURL=composites.mjs.map
901
999
  //# sourceMappingURL=composites.mjs.map