@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.
@@ -1050,6 +1050,141 @@ function PopoverContent({
1050
1050
  function PopoverAnchor({ ...props }) {
1051
1051
  return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
1052
1052
  }
1053
+ var TOOLTIP_SURFACE_CLASS = "bg-popover text-popover-foreground border-border rounded-md border p-2.5 shadow-md";
1054
+ 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";
1055
+ function compose(theirs, ours) {
1056
+ return (e) => {
1057
+ theirs?.(e);
1058
+ ours(e);
1059
+ };
1060
+ }
1061
+ var lastInputWasKeyboard = false;
1062
+ var modalityInstalled = false;
1063
+ function installModalityTracking() {
1064
+ if (modalityInstalled || typeof window === "undefined") return;
1065
+ modalityInstalled = true;
1066
+ window.addEventListener("keydown", () => lastInputWasKeyboard = true, true);
1067
+ window.addEventListener("pointerdown", () => lastInputWasKeyboard = false, true);
1068
+ }
1069
+ function Tooltip({
1070
+ content,
1071
+ children,
1072
+ side = "bottom",
1073
+ align = "start",
1074
+ sideOffset = 8,
1075
+ collisionPadding = 12,
1076
+ openDelay = 300,
1077
+ closeDelay = 90,
1078
+ disabled = false,
1079
+ portal = true,
1080
+ zIndexClassName = "z-50",
1081
+ contentClassName
1082
+ }) {
1083
+ const [hovering, setHovering] = React2.useState(false);
1084
+ const [focusing, setFocusing] = React2.useState(false);
1085
+ const [isFinePointer, setIsFinePointer] = React2.useState(false);
1086
+ const openTimer = React2.useRef(null);
1087
+ const closeTimer = React2.useRef(null);
1088
+ React2.useEffect(() => {
1089
+ installModalityTracking();
1090
+ const mq = window.matchMedia("(hover: hover) and (pointer: fine)");
1091
+ const apply = () => setIsFinePointer(mq.matches);
1092
+ apply();
1093
+ mq.addEventListener("change", apply);
1094
+ return () => mq.removeEventListener("change", apply);
1095
+ }, []);
1096
+ const clearTimers = React2.useCallback(() => {
1097
+ if (openTimer.current) clearTimeout(openTimer.current);
1098
+ if (closeTimer.current) clearTimeout(closeTimer.current);
1099
+ }, []);
1100
+ React2.useEffect(() => clearTimers, [clearTimers]);
1101
+ React2.useEffect(() => {
1102
+ if (disabled) {
1103
+ clearTimers();
1104
+ setHovering(false);
1105
+ }
1106
+ }, [disabled, clearTimers]);
1107
+ const handlePointerEnter = () => {
1108
+ if (!isFinePointer) return;
1109
+ if (closeTimer.current) clearTimeout(closeTimer.current);
1110
+ openTimer.current = setTimeout(() => setHovering(true), openDelay);
1111
+ };
1112
+ const handlePointerLeave = () => {
1113
+ if (openTimer.current) clearTimeout(openTimer.current);
1114
+ closeTimer.current = setTimeout(() => setHovering(false), closeDelay);
1115
+ };
1116
+ const handlePointerDown = () => {
1117
+ clearTimers();
1118
+ setHovering(false);
1119
+ setFocusing(false);
1120
+ };
1121
+ const handleFocus = () => {
1122
+ if (lastInputWasKeyboard) {
1123
+ clearTimers();
1124
+ setFocusing(true);
1125
+ }
1126
+ };
1127
+ const handleBlur = () => {
1128
+ clearTimers();
1129
+ setFocusing(false);
1130
+ };
1131
+ const handleKeyDown = (e) => {
1132
+ if (e.key === "Escape") {
1133
+ clearTimers();
1134
+ setHovering(false);
1135
+ setFocusing(false);
1136
+ }
1137
+ };
1138
+ const effectiveOpen = !disabled && (isFinePointer && hovering || focusing);
1139
+ const extra = {};
1140
+ const childProps = children.props;
1141
+ extra.onPointerEnter = compose(childProps.onPointerEnter, handlePointerEnter);
1142
+ extra.onPointerLeave = compose(childProps.onPointerLeave, handlePointerLeave);
1143
+ extra.onPointerDown = compose(childProps.onPointerDown, handlePointerDown);
1144
+ extra.onFocus = compose(childProps.onFocus, handleFocus);
1145
+ extra.onBlur = compose(childProps.onBlur, handleBlur);
1146
+ extra.onKeyDown = compose(childProps.onKeyDown, handleKeyDown);
1147
+ const trigger = React2.cloneElement(children, extra);
1148
+ const contentEl = /* @__PURE__ */ jsx(
1149
+ PopoverPrimitive.Content,
1150
+ {
1151
+ side,
1152
+ align,
1153
+ sideOffset,
1154
+ collisionPadding,
1155
+ "aria-hidden": true,
1156
+ onOpenAutoFocus: (e) => e.preventDefault(),
1157
+ onCloseAutoFocus: (e) => e.preventDefault(),
1158
+ onFocusOutside: (e) => e.preventDefault(),
1159
+ className: cn(
1160
+ TOOLTIP_SURFACE_CLASS,
1161
+ TOOLTIP_MOTION_CLASS,
1162
+ "pointer-events-none",
1163
+ zIndexClassName,
1164
+ contentClassName
1165
+ ),
1166
+ children: content
1167
+ }
1168
+ );
1169
+ return /* @__PURE__ */ jsxs(
1170
+ PopoverPrimitive.Root,
1171
+ {
1172
+ open: effectiveOpen,
1173
+ onOpenChange: (o) => {
1174
+ if (!o) {
1175
+ clearTimers();
1176
+ setHovering(false);
1177
+ setFocusing(false);
1178
+ }
1179
+ },
1180
+ modal: false,
1181
+ children: [
1182
+ /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { asChild: true, children: trigger }),
1183
+ portal ? /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: contentEl }) : contentEl
1184
+ ]
1185
+ }
1186
+ );
1187
+ }
1053
1188
  var Accordion = AccordionPrimitive.Root;
1054
1189
  var AccordionItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(AccordionPrimitive.Item, { ref, className: cn("border-b", className), ...props }));
1055
1190
  AccordionItem.displayName = "AccordionItem";
@@ -1275,20 +1410,24 @@ function Card({
1275
1410
  "section",
1276
1411
  {
1277
1412
  id,
1278
- className: cn("terminal flex flex-col rounded-sm border scroll-mt-16", toneClass, className),
1413
+ className: cn(
1414
+ "terminal flex flex-col rounded-sm border scroll-mt-16",
1415
+ toneClass,
1416
+ className
1417
+ ),
1279
1418
  children: [
1280
1419
  /* @__PURE__ */ jsxs("div", { className: "terminal-title flex items-center justify-between gap-3", children: [
1281
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1420
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
1282
1421
  /* @__PURE__ */ jsx("span", { className: "terminal-dot", "aria-hidden": true }),
1283
1422
  /* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-70", "aria-hidden": true }),
1284
1423
  /* @__PURE__ */ jsx("span", { className: "terminal-dot opacity-50", "aria-hidden": true }),
1285
1424
  /* @__PURE__ */ jsx("span", { className: "ml-2 truncate", children: title }),
1286
- subtitle && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 ml-1 truncate text-[10px] tracking-normal normal-case", children: [
1425
+ subtitle && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/70 ml-1 min-w-0 truncate text-[10px] tracking-normal normal-case", children: [
1287
1426
  "\xB7 ",
1288
1427
  subtitle
1289
1428
  ] })
1290
1429
  ] }),
1291
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1430
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [
1292
1431
  refreshedAt && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60 hidden text-[10px] tracking-normal normal-case sm:inline", children: refreshedAt }),
1293
1432
  actions,
1294
1433
  expandable && /* @__PURE__ */ jsx(
@@ -1669,6 +1808,6 @@ function QrCode({ value, size = 200, label, className }) {
1669
1808
  );
1670
1809
  }
1671
1810
 
1672
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithCountdown, Badge, Bar, BitcoinAddress, Button, Card, Checkbox, ConfirmHost, CopyButton, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, Input, Label, Modal, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, QrCode, RadioGroup, RadioGroupItem, SatsAmount, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Sparkline, StatBlock, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Working, WorkingPanel, badgeVariants, buttonVariants, confirm, makeStatusPill, prompt };
1811
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, AlertWithAction, AlertWithCountdown, Badge, Bar, BitcoinAddress, Button, Card, Checkbox, ConfirmHost, CopyButton, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, ErrorBoundary, Input, Label, Modal, Pagination, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PromptHost, QrCode, RadioGroup, RadioGroupItem, SatsAmount, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, Sparkline, StatBlock, StatusPill, Switch, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeToggle, ThemeToggleLink, Toaster, Tooltip, Working, WorkingPanel, badgeVariants, buttonVariants, confirm, makeStatusPill, prompt };
1673
1812
  //# sourceMappingURL=primitives.mjs.map
1674
1813
  //# sourceMappingURL=primitives.mjs.map