@orangecheck/ui 0.8.2 → 0.10.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.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +101 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +102 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
type EcosystemSlug = 'home' | 'docs' | 'fleet' | 'me' | 'vault' | 'attest' | 'lock' | 'vote' | 'stamp' | 'agent' | 'pledge';
|
|
4
|
+
type EcosystemSlug = 'home' | 'docs' | 'fleet' | 'me' | 'vault' | 'attest' | 'lock' | 'vote' | 'stamp' | 'agent' | 'pledge' | 'analytics';
|
|
5
5
|
interface EcosystemSwitcherProps {
|
|
6
6
|
current: EcosystemSlug;
|
|
7
7
|
className?: string;
|
|
8
|
+
showOwnerEntries?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare function EcosystemSwitcher({ current, className, }: EcosystemSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function EcosystemSwitcher({ current, className, showOwnerEntries, }: EcosystemSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
10
11
|
|
|
11
|
-
type FamilyCategory = 'hub' | 'product' | 'protocol';
|
|
12
|
+
type FamilyCategory = 'hub' | 'product' | 'protocol' | 'owner';
|
|
12
13
|
interface FamilyProperty {
|
|
13
14
|
slug: EcosystemSlug;
|
|
14
15
|
origin: string;
|
|
@@ -31,8 +32,9 @@ interface OcLogoDropdownProps {
|
|
|
31
32
|
className?: string;
|
|
32
33
|
triggerClassName?: string;
|
|
33
34
|
popoverClassName?: string;
|
|
35
|
+
showOwnerEntries?: boolean;
|
|
34
36
|
}
|
|
35
|
-
declare function OcLogoDropdown({ current, homeHref, siteState, children, className, triggerClassName, popoverClassName, }: OcLogoDropdownProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function OcLogoDropdown({ current, homeHref, siteState, children, className, triggerClassName, popoverClassName, showOwnerEntries, }: OcLogoDropdownProps): react_jsx_runtime.JSX.Element;
|
|
36
38
|
|
|
37
39
|
interface OcAccountMenuItem {
|
|
38
40
|
href: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
type EcosystemSlug = 'home' | 'docs' | 'fleet' | 'me' | 'vault' | 'attest' | 'lock' | 'vote' | 'stamp' | 'agent' | 'pledge';
|
|
4
|
+
type EcosystemSlug = 'home' | 'docs' | 'fleet' | 'me' | 'vault' | 'attest' | 'lock' | 'vote' | 'stamp' | 'agent' | 'pledge' | 'analytics';
|
|
5
5
|
interface EcosystemSwitcherProps {
|
|
6
6
|
current: EcosystemSlug;
|
|
7
7
|
className?: string;
|
|
8
|
+
showOwnerEntries?: boolean;
|
|
8
9
|
}
|
|
9
|
-
declare function EcosystemSwitcher({ current, className, }: EcosystemSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
declare function EcosystemSwitcher({ current, className, showOwnerEntries, }: EcosystemSwitcherProps): react_jsx_runtime.JSX.Element;
|
|
10
11
|
|
|
11
|
-
type FamilyCategory = 'hub' | 'product' | 'protocol';
|
|
12
|
+
type FamilyCategory = 'hub' | 'product' | 'protocol' | 'owner';
|
|
12
13
|
interface FamilyProperty {
|
|
13
14
|
slug: EcosystemSlug;
|
|
14
15
|
origin: string;
|
|
@@ -31,8 +32,9 @@ interface OcLogoDropdownProps {
|
|
|
31
32
|
className?: string;
|
|
32
33
|
triggerClassName?: string;
|
|
33
34
|
popoverClassName?: string;
|
|
35
|
+
showOwnerEntries?: boolean;
|
|
34
36
|
}
|
|
35
|
-
declare function OcLogoDropdown({ current, homeHref, siteState, children, className, triggerClassName, popoverClassName, }: OcLogoDropdownProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function OcLogoDropdown({ current, homeHref, siteState, children, className, triggerClassName, popoverClassName, showOwnerEntries, }: OcLogoDropdownProps): react_jsx_runtime.JSX.Element;
|
|
36
38
|
|
|
37
39
|
interface OcAccountMenuItem {
|
|
38
40
|
href: string;
|
package/dist/index.js
CHANGED
|
@@ -91,9 +91,19 @@ var ENTRIES = [
|
|
|
91
91
|
docsHref: "https://docs.ochk.io/pledge"
|
|
92
92
|
}
|
|
93
93
|
];
|
|
94
|
+
var OWNER_ENTRIES = [
|
|
95
|
+
{
|
|
96
|
+
slug: "analytics",
|
|
97
|
+
href: "https://analytics.ochk.io",
|
|
98
|
+
label: "oc\xB7analytics",
|
|
99
|
+
sub: "owner cockpit",
|
|
100
|
+
docsHref: "https://analytics.ochk.io"
|
|
101
|
+
}
|
|
102
|
+
];
|
|
94
103
|
function EcosystemSwitcher({
|
|
95
104
|
current,
|
|
96
|
-
className
|
|
105
|
+
className,
|
|
106
|
+
showOwnerEntries = false
|
|
97
107
|
}) {
|
|
98
108
|
const [open, setOpen] = react.useState(false);
|
|
99
109
|
const containerRef = react.useRef(null);
|
|
@@ -143,7 +153,7 @@ function EcosystemSwitcher({
|
|
|
143
153
|
className: "bg-background absolute right-0 top-full z-[60] mt-2 w-72 border shadow-lg",
|
|
144
154
|
children: [
|
|
145
155
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-primary border-b px-4 py-2", children: "\xA7 the family" }),
|
|
146
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "py-1", children: ENTRIES.map((e) => {
|
|
156
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "py-1", children: [...ENTRIES, ...showOwnerEntries ? OWNER_ENTRIES : []].map((e) => {
|
|
147
157
|
const isActive2 = e.slug === current;
|
|
148
158
|
return /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
149
159
|
Link5__default.default,
|
|
@@ -281,6 +291,15 @@ var FAMILY_PROPERTIES = [
|
|
|
281
291
|
sub: "swear \u2014 bonded commitment",
|
|
282
292
|
docsHref: "https://docs.ochk.io/pledge",
|
|
283
293
|
category: "protocol"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
slug: "analytics",
|
|
297
|
+
origin: "https://analytics.ochk.io",
|
|
298
|
+
hostname: "analytics.ochk.io",
|
|
299
|
+
label: "oc\xB7analytics",
|
|
300
|
+
sub: "owner cockpit",
|
|
301
|
+
docsHref: "https://analytics.ochk.io",
|
|
302
|
+
category: "owner"
|
|
284
303
|
}
|
|
285
304
|
];
|
|
286
305
|
var SITE_STATE_LABEL = {
|
|
@@ -293,18 +312,20 @@ function findFamilyProperty(slug) {
|
|
|
293
312
|
var SECTIONS = [
|
|
294
313
|
{ category: "hub", label: "hub" },
|
|
295
314
|
{ category: "product", label: "products" },
|
|
296
|
-
{ category: "protocol", label: "protocols" }
|
|
315
|
+
{ category: "protocol", label: "protocols" },
|
|
316
|
+
{ category: "owner", label: "owner" }
|
|
297
317
|
];
|
|
298
318
|
function CategoryChip({ category }) {
|
|
299
319
|
if (category === "hub") return null;
|
|
300
|
-
const
|
|
320
|
+
const label = category === "product" ? "product" : category === "protocol" ? "protocol" : "owner";
|
|
321
|
+
const tone = category === "product" ? "border-primary/25 bg-primary/10 text-primary" : category === "protocol" ? "border-muted-foreground/20 bg-muted/40 text-muted-foreground/85" : "border-warning/30 bg-warning/10 text-warning";
|
|
301
322
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
302
323
|
"span",
|
|
303
324
|
{
|
|
304
|
-
"aria-label":
|
|
305
|
-
className: "ml-1 hidden rounded-sm border px-1.5 py-[1px] font-mono text-[9px] font-medium tracking-widest uppercase sm:inline-block " +
|
|
325
|
+
"aria-label": category === "product" ? "commercial product" : category === "protocol" ? "protocol reference" : "owner-only surface",
|
|
326
|
+
className: "ml-1 hidden rounded-sm border px-1.5 py-[1px] font-mono text-[9px] font-medium tracking-widest uppercase sm:inline-block " + tone,
|
|
306
327
|
"data-oc-category": category,
|
|
307
|
-
children:
|
|
328
|
+
children: label
|
|
308
329
|
}
|
|
309
330
|
);
|
|
310
331
|
}
|
|
@@ -322,13 +343,14 @@ function SiteStateBadge({ state }) {
|
|
|
322
343
|
}
|
|
323
344
|
function MenuCategoryChip({ category }) {
|
|
324
345
|
if (category === "hub") return null;
|
|
325
|
-
const
|
|
346
|
+
const label = category === "product" ? "pro" : category === "protocol" ? "spec" : "own";
|
|
347
|
+
const tone = category === "product" ? "bg-primary/10 text-primary" : category === "protocol" ? "bg-muted/60 text-muted-foreground/80" : "bg-warning/15 text-warning";
|
|
326
348
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
327
349
|
"span",
|
|
328
350
|
{
|
|
329
351
|
"aria-hidden": true,
|
|
330
|
-
className: "inline-block shrink-0 rounded-sm px-1 py-[1px] font-mono text-[9px] font-medium tracking-widest uppercase " +
|
|
331
|
-
children:
|
|
352
|
+
className: "inline-block shrink-0 rounded-sm px-1 py-[1px] font-mono text-[9px] font-medium tracking-widest uppercase " + tone,
|
|
353
|
+
children: label
|
|
332
354
|
}
|
|
333
355
|
);
|
|
334
356
|
}
|
|
@@ -339,7 +361,8 @@ function OcLogoDropdown({
|
|
|
339
361
|
children,
|
|
340
362
|
className,
|
|
341
363
|
triggerClassName,
|
|
342
|
-
popoverClassName
|
|
364
|
+
popoverClassName,
|
|
365
|
+
showOwnerEntries = false
|
|
343
366
|
}) {
|
|
344
367
|
const [open, setOpen] = react.useState(false);
|
|
345
368
|
const containerRef = react.useRef(null);
|
|
@@ -439,6 +462,7 @@ function OcLogoDropdown({
|
|
|
439
462
|
children: [
|
|
440
463
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "label-mono text-primary border-b px-4 py-2", children: "\xA7 the orangecheck family" }),
|
|
441
464
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-[min(28rem,70vh)] overflow-y-auto py-1", role: "none", children: SECTIONS.map(({ category, label }) => {
|
|
465
|
+
if (category === "owner" && !showOwnerEntries) return null;
|
|
442
466
|
const sectionEntries = FAMILY_PROPERTIES.filter(
|
|
443
467
|
(e) => e.category === category
|
|
444
468
|
);
|
|
@@ -508,6 +532,71 @@ function shortenDid(s) {
|
|
|
508
532
|
if (s.length <= 14) return s;
|
|
509
533
|
return `${s.slice(0, 7)}\u2026${s.slice(-5)}`;
|
|
510
534
|
}
|
|
535
|
+
async function writeClipboard(text) {
|
|
536
|
+
try {
|
|
537
|
+
if (navigator.clipboard?.writeText) {
|
|
538
|
+
await navigator.clipboard.writeText(text);
|
|
539
|
+
return true;
|
|
540
|
+
}
|
|
541
|
+
} catch {
|
|
542
|
+
}
|
|
543
|
+
try {
|
|
544
|
+
const ta = document.createElement("textarea");
|
|
545
|
+
ta.value = text;
|
|
546
|
+
ta.setAttribute("readonly", "");
|
|
547
|
+
ta.style.position = "fixed";
|
|
548
|
+
ta.style.top = "-1000px";
|
|
549
|
+
ta.style.opacity = "0";
|
|
550
|
+
document.body.appendChild(ta);
|
|
551
|
+
ta.select();
|
|
552
|
+
const ok = document.execCommand("copy");
|
|
553
|
+
document.body.removeChild(ta);
|
|
554
|
+
return ok;
|
|
555
|
+
} catch {
|
|
556
|
+
return false;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
function CopyableDid({ did }) {
|
|
560
|
+
const [copied, setCopied] = react.useState(false);
|
|
561
|
+
const timerRef = react.useRef(null);
|
|
562
|
+
react.useEffect(
|
|
563
|
+
() => () => {
|
|
564
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
565
|
+
},
|
|
566
|
+
[]
|
|
567
|
+
);
|
|
568
|
+
const onCopy = async () => {
|
|
569
|
+
const ok = await writeClipboard(did);
|
|
570
|
+
if (!ok) return;
|
|
571
|
+
setCopied(true);
|
|
572
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
573
|
+
timerRef.current = setTimeout(() => setCopied(false), 1600);
|
|
574
|
+
};
|
|
575
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
576
|
+
"button",
|
|
577
|
+
{
|
|
578
|
+
type: "button",
|
|
579
|
+
onClick: onCopy,
|
|
580
|
+
"aria-label": copied ? "OrangeCheck identity copied to clipboard" : `Copy OrangeCheck identity ${did} to clipboard`,
|
|
581
|
+
title: "Copy identity",
|
|
582
|
+
"data-oc-account-menu-copy-did": "",
|
|
583
|
+
"data-copied": copied ? "" : void 0,
|
|
584
|
+
className: "group/did hover:bg-accent focus-visible:ring-ring/60 -mx-1.5 mt-px flex w-[calc(100%+0.75rem)] items-start gap-1.5 rounded px-1.5 py-1 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none",
|
|
585
|
+
children: [
|
|
586
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground/90 min-w-0 flex-1 font-mono text-[11px] leading-tight break-all", children: did }),
|
|
587
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
588
|
+
"span",
|
|
589
|
+
{
|
|
590
|
+
className: "mt-px shrink-0 transition-colors " + (copied ? "text-primary" : "text-muted-foreground/50 group-hover/did:text-foreground/80"),
|
|
591
|
+
"aria-hidden": true,
|
|
592
|
+
children: copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Copy, { className: "size-3.5" })
|
|
593
|
+
}
|
|
594
|
+
),
|
|
595
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", "aria-live": "polite", children: copied ? "Copied to clipboard" : "" })
|
|
596
|
+
]
|
|
597
|
+
}
|
|
598
|
+
);
|
|
599
|
+
}
|
|
511
600
|
function OcAccountMenu(props) {
|
|
512
601
|
const session = authClient.useOcSession();
|
|
513
602
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -651,7 +740,7 @@ function OcAccountMenuView({
|
|
|
651
740
|
"\xA7 signed in \xB7 ",
|
|
652
741
|
hostname
|
|
653
742
|
] }),
|
|
654
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
743
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyableDid, { did: account.didOc }),
|
|
655
744
|
displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
|
|
656
745
|
] }),
|
|
657
746
|
primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|