@orangecheck/app-design 1.7.0 → 1.8.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.
@@ -4,7 +4,7 @@ import { extendTailwindMerge } from 'tailwind-merge';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { cva } from 'class-variance-authority';
6
6
  import * as TabsPrimitive from '@radix-ui/react-tabs';
7
- import { X, ChevronDown, Check, Search, Copy, Lock, Info, ArrowUpRight, ArrowRight, ChevronRight, CornerDownLeft, Download, FileText, Upload, ArrowLeft, Maximize2, CircleDashed, CircleMinus, CircleSlash, Clock, CircleX, CircleCheck } from 'lucide-react';
7
+ import { X, ChevronDown, Check, Search, Copy, Lock, Info, ArrowUpRight, ArrowRight, ChevronRight, UserRound, CornerDownLeft, Download, FileText, Upload, ArrowLeft, Maximize2, CircleDashed, CircleMinus, CircleSlash, Clock, CircleX, CircleCheck } from 'lucide-react';
8
8
  import { Slot } from '@radix-ui/react-slot';
9
9
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
10
10
  import 'next-themes';
@@ -535,7 +535,7 @@ var JS_TAG = /<\/?(?=[A-Za-z])/y;
535
535
  var JS_TAG_NAME = /[A-Za-z][\w$.:-]*/y;
536
536
  var JS_PUNCT = /=>|\.\.\.|[{}()[\];,.<>=+\-*/%!?:&|^~#]/y;
537
537
  var JSX_BEFORE = /* @__PURE__ */ new Set(["(", ",", "=", "?", ":", "{", "[", ";", ">", "&&", "||", "=>", "return"]);
538
- function scanJs(src, emit, jsx39) {
538
+ function scanJs(src, emit, jsx40) {
539
539
  let i = 0;
540
540
  let prev = "";
541
541
  let tagDepth = 0;
@@ -561,7 +561,7 @@ function scanJs(src, emit, jsx39) {
561
561
  sig('"');
562
562
  continue;
563
563
  }
564
- if (jsx39 && tagDepth === 0 && (m = at(JS_TAG, src, i)) && (prev === "" || JSX_BEFORE.has(prev))) {
564
+ if (jsx40 && tagDepth === 0 && (m = at(JS_TAG, src, i)) && (prev === "" || JSX_BEFORE.has(prev))) {
565
565
  const name = at(JS_TAG_NAME, src, i + m.length);
566
566
  if (name) {
567
567
  emit(m);
@@ -573,7 +573,7 @@ function scanJs(src, emit, jsx39) {
573
573
  continue;
574
574
  }
575
575
  }
576
- if (jsx39 && tagDepth > 0 && braceInTag === 0) {
576
+ if (jsx40 && tagDepth > 0 && braceInTag === 0) {
577
577
  if (src.startsWith("/>", i) || src[i] === ">") {
578
578
  const close = src[i] === ">" ? ">" : "/>";
579
579
  emit(close);
@@ -593,7 +593,7 @@ function scanJs(src, emit, jsx39) {
593
593
  continue;
594
594
  }
595
595
  if (src[i] === "{") braceInTag = 1;
596
- } else if (jsx39 && tagDepth > 0 && braceInTag > 0) {
596
+ } else if (jsx40 && tagDepth > 0 && braceInTag > 0) {
597
597
  if (src[i] === "{") braceInTag++;
598
598
  else if (src[i] === "}") braceInTag--;
599
599
  }
@@ -1478,6 +1478,7 @@ function Notice({
1478
1478
  title,
1479
1479
  children,
1480
1480
  action,
1481
+ icon,
1481
1482
  role,
1482
1483
  className
1483
1484
  }) {
@@ -1494,7 +1495,17 @@ function Notice({
1494
1495
  ),
1495
1496
  children: [
1496
1497
  /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 gap-3", children: [
1497
- kind !== "neutral" ? /* @__PURE__ */ jsx(
1498
+ icon ? /* @__PURE__ */ jsx(
1499
+ "span",
1500
+ {
1501
+ "aria-hidden": true,
1502
+ className: cn(
1503
+ "mt-0.5 shrink-0 [&_svg]:size-[1.125rem]",
1504
+ kind === "brand" ? "text-oca-accent-ink" : kind === "danger" ? "text-destructive" : "text-muted-foreground"
1505
+ ),
1506
+ children: icon
1507
+ }
1508
+ ) : kind !== "neutral" ? /* @__PURE__ */ jsx(
1498
1509
  "span",
1499
1510
  {
1500
1511
  "aria-hidden": true,
@@ -2770,7 +2781,8 @@ forwardRef(function DropdownMenuItem2({ className, destructive, ...props }, ref)
2770
2781
  {
2771
2782
  ref,
2772
2783
  className: cn(
2773
- "flex h-10 cursor-default select-none items-center gap-2.5 rounded-xl px-3 text-[0.9375rem] outline-none",
2784
+ // A thumb's 44px on a phone.
2785
+ "flex h-10 cursor-default select-none items-center gap-2.5 rounded-xl px-3 text-[0.9375rem] outline-none max-md:h-11",
2774
2786
  "data-[highlighted]:bg-accent data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:text-muted-foreground",
2775
2787
  destructive && "text-destructive [&_svg]:text-destructive",
2776
2788
  className
@@ -4429,6 +4441,66 @@ function ListCard({
4429
4441
  }) {
4430
4442
  return /* @__PURE__ */ jsx(Tag, { className: cn("divide-y divide-border overflow-clip rounded-[1.25rem] border border-border bg-card", className), ...props });
4431
4443
  }
4444
+ var ROW_LOOK = {
4445
+ // In a ListCard: full width, the card's hairlines between rows.
4446
+ card: { box: "px-5", hover: "hover:bg-accent/60", current: "bg-accent" },
4447
+ // In a pane's list (threads, contacts): rounded, lifted when current.
4448
+ pane: { box: "rounded-xl px-3", hover: "hover:bg-accent", current: "bg-card shadow-sm ring-1 ring-border" }
4449
+ };
4450
+ function ListRow({
4451
+ title,
4452
+ meta,
4453
+ description,
4454
+ leading,
4455
+ trailing,
4456
+ actions,
4457
+ revealActions = "always",
4458
+ href,
4459
+ onSelect,
4460
+ current = false,
4461
+ unread = false,
4462
+ variant = "card",
4463
+ as: Tag = "li",
4464
+ className
4465
+ }) {
4466
+ const tight = useDensity() === "compact";
4467
+ const look = ROW_LOOK[variant];
4468
+ const interactive = href !== void 0 || onSelect !== void 0;
4469
+ const cls = cn(
4470
+ "flex min-h-11 w-full min-w-0 items-center gap-3 text-left outline-none transition-colors",
4471
+ "focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",
4472
+ look.box,
4473
+ variant === "pane" ? "py-2" : tight ? "py-3" : "py-4",
4474
+ interactive && !current && look.hover,
4475
+ current && look.current,
4476
+ actions && "pr-14"
4477
+ );
4478
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
4479
+ leading ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0", children: leading }) : null,
4480
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
4481
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-baseline justify-between gap-3", children: [
4482
+ /* @__PURE__ */ jsx("span", { className: cn("truncate text-[0.9375rem] text-foreground", unread ? "font-semibold" : "font-medium"), children: title }),
4483
+ meta ? /* @__PURE__ */ jsx("span", { className: "oca-tabular shrink-0 text-[0.8125rem] text-muted-foreground", children: meta }) : null
4484
+ ] }),
4485
+ description ? /* @__PURE__ */ jsx("span", { className: cn("truncate text-[0.875rem]", unread ? "text-foreground" : "text-muted-foreground"), children: description }) : null
4486
+ ] }),
4487
+ trailing ? /* @__PURE__ */ jsx("span", { className: "flex shrink-0 items-center gap-2", children: trailing }) : null
4488
+ ] });
4489
+ const aria = current ? { "aria-current": "true" } : {};
4490
+ return /* @__PURE__ */ jsxs(Tag, { className: cn("group/row relative", className), children: [
4491
+ href !== void 0 ? href.startsWith("/") ? /* @__PURE__ */ jsx(Link, { href, className: cls, ...aria, children: body }) : /* @__PURE__ */ jsx("a", { href, className: cls, ...aria, children: body }) : onSelect ? /* @__PURE__ */ jsx("button", { type: "button", onClick: onSelect, className: cls, ...aria, children: body }) : /* @__PURE__ */ jsx("div", { className: cls, children: body }),
4492
+ actions ? /* @__PURE__ */ jsx(
4493
+ "div",
4494
+ {
4495
+ className: cn(
4496
+ "absolute right-2 top-1/2 flex -translate-y-1/2 items-center",
4497
+ revealActions === "hover" && "transition-opacity md:opacity-0 md:focus-within:opacity-100 md:group-hover/row:opacity-100 md:has-[[data-state=open]]:opacity-100"
4498
+ ),
4499
+ children: actions
4500
+ }
4501
+ ) : null
4502
+ ] });
4503
+ }
4432
4504
  var ChoiceSize = createContext("md");
4433
4505
  var COLUMNS = { 1: "", 2: "sm:grid-cols-2", 3: "sm:grid-cols-2 lg:grid-cols-3" };
4434
4506
  function ChoiceGroup({
@@ -4495,6 +4567,54 @@ function ChoiceCard({
4495
4567
  }
4496
4568
  );
4497
4569
  }
4570
+ var SIZES2 = {
4571
+ "2xs": "size-7 text-[0.6875rem] [&_svg]:size-3.5",
4572
+ xs: "size-8 text-[0.75rem] [&_svg]:size-4",
4573
+ sm: "size-9 text-[0.8125rem] [&_svg]:size-4",
4574
+ md: "size-11 text-[0.9375rem] [&_svg]:size-5",
4575
+ lg: "size-14 text-[1.1875rem] [&_svg]:size-6"
4576
+ };
4577
+ function personInitials(name) {
4578
+ return name.trim().split(/\s+/).slice(0, 2).map((w) => w.match(/[\p{L}\p{N}]/u)?.[0] ?? "").join("").toLocaleUpperCase();
4579
+ }
4580
+ function avatarHue(seed) {
4581
+ let h = 2166136261;
4582
+ for (let i = 0; i < seed.length; i++) {
4583
+ h ^= seed.charCodeAt(i);
4584
+ h = Math.imul(h, 16777619);
4585
+ }
4586
+ return (h >>> 0) % 360;
4587
+ }
4588
+ function Avatar({
4589
+ seed,
4590
+ name,
4591
+ src,
4592
+ size = "sm",
4593
+ className
4594
+ }) {
4595
+ const [failed, setFailed] = useState(null);
4596
+ const box = cn("inline-flex shrink-0 select-none items-center justify-center overflow-hidden rounded-full", SIZES2[size], className);
4597
+ if (src && failed !== src) {
4598
+ return (
4599
+ // eslint-disable-next-line @next/next/no-img-element
4600
+ /* @__PURE__ */ jsx("img", { src, alt: "", "aria-hidden": true, className: cn(box, "object-cover"), onError: () => setFailed(src) })
4601
+ );
4602
+ }
4603
+ const initials = name ? personInitials(name) : "";
4604
+ return /* @__PURE__ */ jsx(
4605
+ "span",
4606
+ {
4607
+ "aria-hidden": true,
4608
+ className: cn(box, "font-medium leading-none"),
4609
+ style: {
4610
+ "--oca-avatar-h": avatarHue(seed),
4611
+ backgroundColor: "hsl(var(--oca-avatar-h) 60% var(--oca-avatar-bg-l))",
4612
+ color: "hsl(var(--oca-avatar-h) 45% var(--oca-avatar-fg-l))"
4613
+ },
4614
+ children: initials || /* @__PURE__ */ jsx(UserRound, {})
4615
+ }
4616
+ );
4617
+ }
4498
4618
  function useMacKeys() {
4499
4619
  const [mac, setMac] = useState(true);
4500
4620
  useEffect(() => {
@@ -5338,6 +5458,6 @@ function ToolGrid({
5338
5458
  );
5339
5459
  }
5340
5460
 
5341
- export { Accent, ActivityList, AnchorStatus, ApiTable, AppCard, AppGrid, ArtifactView, BlockCountdown, BlockHeight, Breadcrumbs, BrowserFrame, Callout, CardGrid, ChartFrame, ChoiceCard, ChoiceGroup, Closing, CodeBlock, CodeTabs, CommandDialog, ComparisonTable, Container, CopyButton, CountdownRing, DataTable, Diagram, Display, DocHeader, DocLayout, DocsHeading, DocsPager, DropZone, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FactBlock, FactRows, Faq, FilterChips, FloatChip, Footnote, FormSection, HashChip, HudCard, InstallTabs, KeyValueList, Lead, LegalDocument, LinkCard, ListCard, LoadingBlock, LockedPreview, MdxTable, Meter, Monogram, Notice, OnThisPage, PackageCard, PageHeader, PageHero, Panel, PhoneFrame, PlanCard, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, Reveal, Sats, SatsFigure, ScrollStory, SearchButton, SearchDialog, Section, SectionHeading, SectionIntro, SectionTitle, SignMessage, SourceNote, Sparkline, SpecCard, SplitBar, StatCard, StatGrid, StateBadge, Step, StepGrid, Steps, TextLink, Ticker, ToolGrid, TruthTable, UsdApprox, VerifyBox, VerifyReport, chartColor, createStateBadge, languageName, monogramGround, monogramLetter, satsText, sectionVariants, useActiveHeading, useCopy, useHeadings, useInView };
5461
+ export { Accent, ActivityList, AnchorStatus, ApiTable, AppCard, AppGrid, ArtifactView, Avatar, BlockCountdown, BlockHeight, Breadcrumbs, BrowserFrame, Callout, CardGrid, ChartFrame, ChoiceCard, ChoiceGroup, Closing, CodeBlock, CodeTabs, CommandDialog, ComparisonTable, Container, CopyButton, CountdownRing, DataTable, Diagram, Display, DocHeader, DocLayout, DocsHeading, DocsPager, DropZone, EmptyLine, EmptyState, EndpointList, ErrorBoundary, ErrorPage, Eyebrow, FactBlock, FactRows, Faq, FilterChips, FloatChip, Footnote, FormSection, HashChip, HudCard, InstallTabs, KeyValueList, Lead, LegalDocument, LinkCard, ListCard, ListRow, LoadingBlock, LockedPreview, MdxTable, Meter, Monogram, Notice, OnThisPage, PackageCard, PageHeader, PageHero, Panel, PhoneFrame, PlanCard, ProgressSteps, ProofStrip, Prose, ProtocolGrid, ProtocolHero, ProtocolNav, Reveal, Sats, SatsFigure, ScrollStory, SearchButton, SearchDialog, Section, SectionHeading, SectionIntro, SectionTitle, SignMessage, SourceNote, Sparkline, SpecCard, SplitBar, StatCard, StatGrid, StateBadge, Step, StepGrid, Steps, TextLink, Ticker, ToolGrid, TruthTable, UsdApprox, VerifyBox, VerifyReport, chartColor, createStateBadge, languageName, monogramGround, monogramLetter, satsText, sectionVariants, useActiveHeading, useCopy, useHeadings, useInView };
5342
5462
  //# sourceMappingURL=components.mjs.map
5343
5463
  //# sourceMappingURL=components.mjs.map