@orangecheck/design 0.8.0 → 0.9.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.mjs CHANGED
@@ -1434,6 +1434,141 @@ function PopoverContent({
1434
1434
  function PopoverAnchor({ ...props }) {
1435
1435
  return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
1436
1436
  }
1437
+ var TOOLTIP_SURFACE_CLASS = "bg-popover text-popover-foreground border-border rounded-md border p-2.5 shadow-md";
1438
+ var TOOLTIP_MOTION_CLASS = "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-1 data-[side=top]:slide-in-from-bottom-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 origin-(--radix-popover-content-transform-origin) duration-150 ease-out";
1439
+ function compose(theirs, ours) {
1440
+ return (e) => {
1441
+ theirs?.(e);
1442
+ ours(e);
1443
+ };
1444
+ }
1445
+ var lastInputWasKeyboard = false;
1446
+ var modalityInstalled = false;
1447
+ function installModalityTracking() {
1448
+ if (modalityInstalled || typeof window === "undefined") return;
1449
+ modalityInstalled = true;
1450
+ window.addEventListener("keydown", () => lastInputWasKeyboard = true, true);
1451
+ window.addEventListener("pointerdown", () => lastInputWasKeyboard = false, true);
1452
+ }
1453
+ function Tooltip({
1454
+ content,
1455
+ children,
1456
+ side = "bottom",
1457
+ align = "start",
1458
+ sideOffset = 8,
1459
+ collisionPadding = 12,
1460
+ openDelay = 300,
1461
+ closeDelay = 90,
1462
+ disabled = false,
1463
+ portal = true,
1464
+ zIndexClassName = "z-50",
1465
+ contentClassName
1466
+ }) {
1467
+ const [hovering, setHovering] = React2.useState(false);
1468
+ const [focusing, setFocusing] = React2.useState(false);
1469
+ const [isFinePointer, setIsFinePointer] = React2.useState(false);
1470
+ const openTimer = React2.useRef(null);
1471
+ const closeTimer = React2.useRef(null);
1472
+ React2.useEffect(() => {
1473
+ installModalityTracking();
1474
+ const mq = window.matchMedia("(hover: hover) and (pointer: fine)");
1475
+ const apply = () => setIsFinePointer(mq.matches);
1476
+ apply();
1477
+ mq.addEventListener("change", apply);
1478
+ return () => mq.removeEventListener("change", apply);
1479
+ }, []);
1480
+ const clearTimers = React2.useCallback(() => {
1481
+ if (openTimer.current) clearTimeout(openTimer.current);
1482
+ if (closeTimer.current) clearTimeout(closeTimer.current);
1483
+ }, []);
1484
+ React2.useEffect(() => clearTimers, [clearTimers]);
1485
+ React2.useEffect(() => {
1486
+ if (disabled) {
1487
+ clearTimers();
1488
+ setHovering(false);
1489
+ }
1490
+ }, [disabled, clearTimers]);
1491
+ const handlePointerEnter = () => {
1492
+ if (!isFinePointer) return;
1493
+ if (closeTimer.current) clearTimeout(closeTimer.current);
1494
+ openTimer.current = setTimeout(() => setHovering(true), openDelay);
1495
+ };
1496
+ const handlePointerLeave = () => {
1497
+ if (openTimer.current) clearTimeout(openTimer.current);
1498
+ closeTimer.current = setTimeout(() => setHovering(false), closeDelay);
1499
+ };
1500
+ const handlePointerDown = () => {
1501
+ clearTimers();
1502
+ setHovering(false);
1503
+ setFocusing(false);
1504
+ };
1505
+ const handleFocus = () => {
1506
+ if (lastInputWasKeyboard) {
1507
+ clearTimers();
1508
+ setFocusing(true);
1509
+ }
1510
+ };
1511
+ const handleBlur = () => {
1512
+ clearTimers();
1513
+ setFocusing(false);
1514
+ };
1515
+ const handleKeyDown = (e) => {
1516
+ if (e.key === "Escape") {
1517
+ clearTimers();
1518
+ setHovering(false);
1519
+ setFocusing(false);
1520
+ }
1521
+ };
1522
+ const effectiveOpen = !disabled && (isFinePointer && hovering || focusing);
1523
+ const extra = {};
1524
+ const childProps = children.props;
1525
+ extra.onPointerEnter = compose(childProps.onPointerEnter, handlePointerEnter);
1526
+ extra.onPointerLeave = compose(childProps.onPointerLeave, handlePointerLeave);
1527
+ extra.onPointerDown = compose(childProps.onPointerDown, handlePointerDown);
1528
+ extra.onFocus = compose(childProps.onFocus, handleFocus);
1529
+ extra.onBlur = compose(childProps.onBlur, handleBlur);
1530
+ extra.onKeyDown = compose(childProps.onKeyDown, handleKeyDown);
1531
+ const trigger = React2.cloneElement(children, extra);
1532
+ const contentEl = /* @__PURE__ */ jsx(
1533
+ PopoverPrimitive.Content,
1534
+ {
1535
+ side,
1536
+ align,
1537
+ sideOffset,
1538
+ collisionPadding,
1539
+ "aria-hidden": true,
1540
+ onOpenAutoFocus: (e) => e.preventDefault(),
1541
+ onCloseAutoFocus: (e) => e.preventDefault(),
1542
+ onFocusOutside: (e) => e.preventDefault(),
1543
+ className: cn(
1544
+ TOOLTIP_SURFACE_CLASS,
1545
+ TOOLTIP_MOTION_CLASS,
1546
+ "pointer-events-none",
1547
+ zIndexClassName,
1548
+ contentClassName
1549
+ ),
1550
+ children: content
1551
+ }
1552
+ );
1553
+ return /* @__PURE__ */ jsxs(
1554
+ PopoverPrimitive.Root,
1555
+ {
1556
+ open: effectiveOpen,
1557
+ onOpenChange: (o) => {
1558
+ if (!o) {
1559
+ clearTimers();
1560
+ setHovering(false);
1561
+ setFocusing(false);
1562
+ }
1563
+ },
1564
+ modal: false,
1565
+ children: [
1566
+ /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { asChild: true, children: trigger }),
1567
+ portal ? /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: contentEl }) : contentEl
1568
+ ]
1569
+ }
1570
+ );
1571
+ }
1437
1572
  var Accordion = AccordionPrimitive.Root;
1438
1573
  var AccordionItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Item, { ref, className: cn("border-b", className), ...props }));
1439
1574
  AccordionItem.displayName = "AccordionItem";
@@ -1659,20 +1794,24 @@ function Card({
1659
1794
  "section",
1660
1795
  {
1661
1796
  id,
1662
- className: cn("terminal flex flex-col rounded-sm border scroll-mt-16", toneClass, className),
1797
+ className: cn(
1798
+ "terminal flex flex-col rounded-sm border scroll-mt-16",
1799
+ toneClass,
1800
+ className
1801
+ ),
1663
1802
  children: [
1664
1803
  /* @__PURE__ */ jsxs("div", { className: "terminal-title flex items-center justify-between gap-3", children: [
1665
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1804
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
1666
1805
  /* @__PURE__ */ jsx("span", { className: "terminal-dot", "aria-hidden": true }),
1667
1806
  /* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-70", "aria-hidden": true }),
1668
1807
  /* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-50", "aria-hidden": true }),
1669
1808
  /* @__PURE__ */ jsx("span", { className: "ml-2 truncate", children: title }),
1670
- subtitle && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 ml-1 truncate text-[10px] tracking-normal normal-case", children: [
1809
+ subtitle && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 ml-1 min-w-0 truncate text-[10px] tracking-normal normal-case", children: [
1671
1810
  "\xB7 ",
1672
1811
  subtitle
1673
1812
  ] })
1674
1813
  ] }),
1675
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1814
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
1676
1815
  refreshedAt && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 hidden text-[10px] tracking-normal normal-case sm:inline", children: refreshedAt }),
1677
1816
  actions,
1678
1817
  expandable && /* @__PURE__ */ jsx(
@@ -2684,6 +2823,31 @@ function MenuCategoryChip({ category }) {
2684
2823
  }
2685
2824
  );
2686
2825
  }
2826
+ function SwitcherTooltipCard({ current }) {
2827
+ const prop = findFamilyProperty(current);
2828
+ return /* @__PURE__ */ jsxs("div", { className: "w-[13rem] max-w-[calc(100vw-1.5rem)]", children: [
2829
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col leading-tight", children: [
2830
+ /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-baseline gap-x-1.5", children: [
2831
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[9px] tracking-widest uppercase", children: "you\u2019re on" }),
2832
+ /* @__PURE__ */ jsx("span", { className: "text-primary font-display text-[12px] font-semibold tracking-tight", children: prop?.label ?? "orangecheck family" })
2833
+ ] }),
2834
+ prop?.sub && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground mt-0.5 font-mono text-[10px] tracking-wide", children: prop.sub })
2835
+ ] }),
2836
+ /* @__PURE__ */ jsx("div", { className: "border-border -mx-2.5 my-2 border-t" }),
2837
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
2838
+ /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": true, className: "text-muted-foreground h-3 w-3 shrink-0" }),
2839
+ /* @__PURE__ */ jsx("span", { className: "text-primary font-mono text-[10px] font-medium tracking-widest uppercase", children: "click" }),
2840
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[10px]", children: "\xB7" }),
2841
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[10px] tracking-wide", children: "switch site" })
2842
+ ] }),
2843
+ /* @__PURE__ */ jsxs("div", { className: "mt-1.5 flex items-center gap-1.5", children: [
2844
+ /* @__PURE__ */ jsx(CornerDownLeft, { "aria-hidden": true, className: "text-muted-foreground h-3 w-3 shrink-0" }),
2845
+ /* @__PURE__ */ jsx("span", { className: "text-primary font-mono text-[10px] font-medium tracking-widest uppercase", children: "double-click" }),
2846
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[10px]", children: "\xB7" }),
2847
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[10px] tracking-wide", children: "home" })
2848
+ ] })
2849
+ ] });
2850
+ }
2687
2851
  function OcLogoDropdown({
2688
2852
  current,
2689
2853
  homeHref = "/",
@@ -2733,31 +2897,45 @@ function OcLogoDropdown({
2733
2897
  "data-oc-current-category": currentCategory,
2734
2898
  "data-oc-site-state": siteState,
2735
2899
  children: [
2736
- /* @__PURE__ */ jsxs(
2737
- "button",
2900
+ /* @__PURE__ */ jsx(
2901
+ Tooltip,
2738
2902
  {
2739
- type: "button",
2740
- "aria-haspopup": "menu",
2741
- "aria-expanded": open,
2742
- "aria-controls": menuId,
2743
- "aria-label": "OrangeCheck family \xB7 click to open property menu, double-click to go home",
2744
- title: "single-click \xB7 family menu \xB7 double-click \xB7 go home",
2745
- onClick: handleTriggerClick,
2746
- className: triggerClassName ?? "group hover:bg-accent/30 -mx-1.5 -my-1 flex min-h-[40px] items-center gap-2 rounded-sm px-1.5 py-1 transition-colors " + (open ? "bg-accent/20" : ""),
2747
- "data-oc-logo-dropdown-trigger": "",
2748
- "data-oc-logo-dropdown-open": open ? "true" : "false",
2749
- children: [
2750
- children,
2751
- /* @__PURE__ */ jsx(CategoryChip, { category: currentCategory }),
2752
- /* @__PURE__ */ jsx(SiteStateBadge, { state: siteState }),
2753
- /* @__PURE__ */ jsx(
2754
- ChevronDown,
2755
- {
2756
- "aria-hidden": true,
2757
- className: "text-muted-foreground/70 group-hover:text-foreground/80 h-3.5 w-3.5 shrink-0 transition-transform duration-200 " + (open ? "rotate-180" : "")
2758
- }
2759
- )
2760
- ]
2903
+ content: /* @__PURE__ */ jsx(SwitcherTooltipCard, { current }),
2904
+ disabled: open,
2905
+ side: "bottom",
2906
+ align: "start",
2907
+ sideOffset: 8,
2908
+ zIndexClassName: "z-[70]",
2909
+ children: /* @__PURE__ */ jsxs(
2910
+ "button",
2911
+ {
2912
+ type: "button",
2913
+ "aria-haspopup": "menu",
2914
+ "aria-expanded": open,
2915
+ "aria-controls": menuId,
2916
+ "aria-label": "orangecheck family menu",
2917
+ onClick: handleTriggerClick,
2918
+ className: cn(
2919
+ // focus indicator is guaranteed even if a consumer overrides triggerClassName
2920
+ "focus-visible:ring-primary/60 rounded-sm focus-visible:ring-2 focus-visible:outline-none",
2921
+ triggerClassName ?? "group hover:bg-accent/30 -mx-1.5 -my-1 flex min-h-[40px] items-center gap-2 rounded-sm px-1.5 py-1 transition-colors " + (open ? "bg-accent/20" : "")
2922
+ ),
2923
+ "data-oc-logo-dropdown-trigger": "",
2924
+ "data-oc-logo-dropdown-open": open ? "true" : "false",
2925
+ children: [
2926
+ children,
2927
+ /* @__PURE__ */ jsx(CategoryChip, { category: currentCategory }),
2928
+ /* @__PURE__ */ jsx(SiteStateBadge, { state: siteState }),
2929
+ /* @__PURE__ */ jsx(
2930
+ ChevronDown,
2931
+ {
2932
+ "aria-hidden": true,
2933
+ className: "text-muted-foreground/70 group-hover:text-foreground/80 h-3.5 w-3.5 shrink-0 transition-transform duration-200 " + (open ? "rotate-180" : "")
2934
+ }
2935
+ )
2936
+ ]
2937
+ }
2938
+ )
2761
2939
  }
2762
2940
  ),
2763
2941
  /* @__PURE__ */ jsxs(
@@ -2786,7 +2964,7 @@ function OcLogoDropdown({
2786
2964
  {
2787
2965
  id: menuId,
2788
2966
  role: "menu",
2789
- "aria-label": "OrangeCheck family",
2967
+ "aria-label": "orangecheck family",
2790
2968
  className: popoverClassName ?? "bg-background absolute top-full left-0 z-[60] mt-2 w-[min(20rem,calc(100vw-1rem))] border shadow-lg",
2791
2969
  "data-oc-logo-dropdown-popover": "",
2792
2970
  children: [
@@ -3942,6 +4120,6 @@ function LayoutSubHeader({
3942
4120
  ] }) });
3943
4121
  }
3944
4122
 
3945
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithCountdown, AppShell, Badge, Bar, BitcoinAddress, Button, Callout, Card, Checkbox, ConfirmHost, CopyButton, DEFAULT_OC_THEME, DataRow, DefinitionList, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, EcosystemSwitcher, EmptyState, ErrorBoundary, FAMILY_PROPERTIES, HelpHint, Input, Label, LayoutSubHeader, Modal, OC_DEFAULT_ACCENT, OC_SKIN_COOKIE, OC_THEMES, OcAccountMenu, OcAccountMenuView, OcAppearanceMenu, OcAurora, OcDashboardHub, OcDashboardShell, OcLogoDropdown, OcPrimaryNav, OcThemeBridge, OcThemePicker, OcThemeProvider, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, QrCode, REFERENCE_BTC_USD, RadioGroup, RadioGroupItem, SITE_STATE_LABEL, SatsAmount, SectionHeader, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Sparkline, StatBlock, StatCard, StatGrid, StatTile, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Working, WorkingPanel, accentFor, asOf, badgeVariants, buttonVariants, cn, confirm, explorerUrl, findFamilyProperty, formatSats, formatSatsCompact, getOcThemeInitScript, isKnownTheme, makeStatusPill, priceBoth, prompt, relativeTime, resolveTheme, satsToUsd, shortenAddress, usdToSats, useOcSkin, useSpotPrice };
4123
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithCountdown, AppShell, Badge, Bar, BitcoinAddress, Button, Callout, Card, Checkbox, ConfirmHost, CopyButton, DEFAULT_OC_THEME, DataRow, DefinitionList, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, EcosystemSwitcher, EmptyState, ErrorBoundary, FAMILY_PROPERTIES, HelpHint, Input, Label, LayoutSubHeader, Modal, OC_DEFAULT_ACCENT, OC_SKIN_COOKIE, OC_THEMES, OcAccountMenu, OcAccountMenuView, OcAppearanceMenu, OcAurora, OcDashboardHub, OcDashboardShell, OcLogoDropdown, OcPrimaryNav, OcThemeBridge, OcThemePicker, OcThemeProvider, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, QrCode, REFERENCE_BTC_USD, RadioGroup, RadioGroupItem, SITE_STATE_LABEL, SatsAmount, SectionHeader, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Sparkline, StatBlock, StatCard, StatGrid, StatTile, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Tooltip, Working, WorkingPanel, accentFor, asOf, badgeVariants, buttonVariants, cn, confirm, explorerUrl, findFamilyProperty, formatSats, formatSatsCompact, getOcThemeInitScript, isKnownTheme, makeStatusPill, priceBoth, prompt, relativeTime, resolveTheme, satsToUsd, shortenAddress, usdToSats, useOcSkin, useSpotPrice };
3946
4124
  //# sourceMappingURL=index.mjs.map
3947
4125
  //# sourceMappingURL=index.mjs.map