@seekbuddy/dsh-ui 0.0.0-stage → 0.2.0-beta.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/CHANGELOG.md +49 -0
- package/LICENSE +22 -0
- package/README.md +175 -2
- package/README.zh.md +176 -0
- package/THIRD_PARTY_NOTICES.md +42 -0
- package/UPSTREAM.md +56 -0
- package/dist/blocks.js +1582 -0
- package/dist/chunks/chunk-23KOEBWJ.js +104 -0
- package/dist/chunks/chunk-3HCOU44R.js +697 -0
- package/dist/chunks/chunk-5JXG4BHW.js +31 -0
- package/dist/chunks/chunk-5XDVPALS.js +61 -0
- package/dist/chunks/chunk-AY44MQMD.js +3052 -0
- package/dist/chunks/chunk-B3EEK7A2.js +408 -0
- package/dist/chunks/chunk-CEBTQO6W.js +24 -0
- package/dist/chunks/chunk-CI73NXA5.js +202 -0
- package/dist/chunks/chunk-CTQPGUZP.js +22 -0
- package/dist/chunks/chunk-F352IICS.js +57 -0
- package/dist/chunks/chunk-IOBKTEKP.js +144 -0
- package/dist/chunks/chunk-KETGFAOH.js +66 -0
- package/dist/chunks/chunk-LA3QDZYN.js +2777 -0
- package/dist/chunks/chunk-NE62SYOZ.js +89 -0
- package/dist/chunks/chunk-OQPH36OI.js +754 -0
- package/dist/chunks/chunk-QJKAQ6PO.js +155 -0
- package/dist/chunks/chunk-R6AUJQ3G.js +129 -0
- package/dist/chunks/chunk-RNVSCTW7.js +24 -0
- package/dist/chunks/chunk-RZOP2PFC.js +152 -0
- package/dist/chunks/chunk-TQU54HSM.js +112 -0
- package/dist/chunks/chunk-TUK6UGXM.js +36 -0
- package/dist/chunks/chunk-TZ7HRE6D.js +328 -0
- package/dist/chunks/chunk-VIH56PDF.js +57 -0
- package/dist/chunks/chunk-WUL523OW.js +27 -0
- package/dist/chunks/chunk-XX6MSZLS.js +261 -0
- package/dist/chunks/chunk-ZA47FP7C.js +7 -0
- package/dist/chunks/chunk-ZZNL5PWF.js +170 -0
- package/dist/icons.js +803 -0
- package/dist/index.js +1182 -0
- package/dist/katex/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/katex/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +1 -0
- package/dist/katex.css.d.ts +2 -0
- package/dist/markdown.js +148 -0
- package/dist/meta.json +6876 -0
- package/dist/root-inputs.json +67 -0
- package/dist/seekbuddy-card.js +7 -0
- package/dist/seekbuddy-empty.js +8 -0
- package/dist/seekbuddy-internal/DangerButton.js +7 -0
- package/dist/seekbuddy-internal/Mark.js +7 -0
- package/dist/seekbuddy-internal/Message.js +10 -0
- package/dist/seekbuddy-internal/Pagination.js +9 -0
- package/dist/seekbuddy-internal/StatusBadge.js +7 -0
- package/dist/seekbuddy-internal/SubtleButton.js +7 -0
- package/dist/seekbuddy-internal/Switch.js +7 -0
- package/dist/seekbuddy-internal/Upload.js +7 -0
- package/dist/seekbuddy-internal/date/Calendar.js +8 -0
- package/dist/seekbuddy-internal/date/DatePicker.js +9 -0
- package/dist/seekbuddy-internal/date/DateRangePicker.js +9 -0
- package/dist/seekbuddy-internal/date/TimePicker.js +8 -0
- package/dist/seekbuddy-internal/date/fields.js +16 -0
- package/dist/seekbuddy-internal/qr/QrCode.js +7 -0
- package/dist/seekbuddy-spinner.js +7 -0
- package/dist/seekbuddy-tabs.js +7 -0
- package/dist/seekbuddy-timeline.js +8 -0
- package/dist/seekbuddy.js +89 -0
- package/dist/theme-bootstrap.js +13 -0
- package/dist/theme.js +37 -0
- package/dist/tokens.css +934 -0
- package/dist/tokens.css.d.ts +2 -0
- package/dist/types/Button.d.ts +18 -0
- package/dist/types/Checkbox.d.ts +19 -0
- package/dist/types/CodeFileIcon.d.ts +11 -0
- package/dist/types/CodeToolbar.d.ts +29 -0
- package/dist/types/ConfigField.d.ts +32 -0
- package/dist/types/ConnectionIndicator.d.ts +25 -0
- package/dist/types/DiffBlock.d.ts +51 -0
- package/dist/types/DisclosureRow.d.ts +35 -0
- package/dist/types/FileTypeIcon.d.ts +42 -0
- package/dist/types/FoldToggle.d.ts +19 -0
- package/dist/types/HoverCard.d.ts +36 -0
- package/dist/types/ImageLightbox.d.ts +26 -0
- package/dist/types/ImagePreview.d.ts +11 -0
- package/dist/types/Input.d.ts +11 -0
- package/dist/types/JsonTree.d.ts +58 -0
- package/dist/types/LinkIcon.d.ts +33 -0
- package/dist/types/Menu.d.ts +142 -0
- package/dist/types/MenuGroup.d.ts +21 -0
- package/dist/types/MenuSurface.d.ts +15 -0
- package/dist/types/Modal.d.ts +43 -0
- package/dist/types/PermissionIcon.d.ts +38 -0
- package/dist/types/Pill.d.ts +12 -0
- package/dist/types/ReadBlock.d.ts +47 -0
- package/dist/types/ReferenceIcon.d.ts +20 -0
- package/dist/types/RiskConfirmation.d.ts +19 -0
- package/dist/types/SearchBlock.d.ts +71 -0
- package/dist/types/SegmentedControl.d.ts +34 -0
- package/dist/types/SegmentedTabs.d.ts +25 -0
- package/dist/types/ShortcutKeys.d.ts +10 -0
- package/dist/types/SiteGlyph.d.ts +24 -0
- package/dist/types/StateDot.d.ts +19 -0
- package/dist/types/Switch.d.ts +19 -0
- package/dist/types/Tag.d.ts +31 -0
- package/dist/types/TerminalBlock.d.ts +77 -0
- package/dist/types/TextShimmer.d.ts +22 -0
- package/dist/types/Toast.d.ts +48 -0
- package/dist/types/Tooltip.d.ts +63 -0
- package/dist/types/WebBlock.d.ts +60 -0
- package/dist/types/ansi.d.ts +16 -0
- package/dist/types/blocks.d.ts +19 -0
- package/dist/types/clipboard.d.ts +8 -0
- package/dist/types/code-file-icon-artwork.d.ts +53 -0
- package/dist/types/code-file-types.d.ts +29 -0
- package/dist/types/code-highlighting.d.ts +11 -0
- package/dist/types/css-modules.d.ts +6 -0
- package/dist/types/darwin-desktop.d.ts +8 -0
- package/dist/types/file-size.d.ts +7 -0
- package/dist/types/focus.d.ts +8 -0
- package/dist/types/guide-artwork.d.ts +14 -0
- package/dist/types/head-tail-cap.d.ts +22 -0
- package/dist/types/icons/index.d.ts +384 -0
- package/dist/types/icons/props.d.ts +8 -0
- package/dist/types/icons/shared-artwork.d.ts +42 -0
- package/dist/types/icons.d.ts +6 -0
- package/dist/types/index.d.ts +53 -0
- package/dist/types/input-modality.d.ts +18 -0
- package/dist/types/keyboard-composition.d.ts +10 -0
- package/dist/types/markdown/CodeBlock.d.ts +34 -0
- package/dist/types/markdown/JsonBlock.d.ts +7 -0
- package/dist/types/markdown/MarkdownDelegate.d.ts +45 -0
- package/dist/types/markdown/MarkdownText.d.ts +47 -0
- package/dist/types/markdown/cjkFriendlyStrong.d.ts +8 -0
- package/dist/types/markdown/file-link.d.ts +12 -0
- package/dist/types/markdown/highlight.d.ts +147 -0
- package/dist/types/markdown/incremental.d.ts +79 -0
- package/dist/types/markdown/katex.d.ts +18 -0
- package/dist/types/markdown/local-image-syntax.d.ts +9 -0
- package/dist/types/markdown/mathCompatibility.d.ts +10 -0
- package/dist/types/markdown/parse.d.ts +24 -0
- package/dist/types/markdown/plain-text.d.ts +21 -0
- package/dist/types/markdown/render.d.ts +140 -0
- package/dist/types/markdown/useViewportHighlighting.d.ts +10 -0
- package/dist/types/markdown.d.ts +9 -0
- package/dist/types/overlay-top-margin.d.ts +7 -0
- package/dist/types/plugin-artwork.d.ts +16 -0
- package/dist/types/pointer-grace.d.ts +21 -0
- package/dist/types/rank-by-name.d.ts +21 -0
- package/dist/types/relative-time.d.ts +22 -0
- package/dist/types/seekbuddy/Card.d.ts +28 -0
- package/dist/types/seekbuddy/DangerButton.d.ts +31 -0
- package/dist/types/seekbuddy/Empty.d.ts +34 -0
- package/dist/types/seekbuddy/Mark.d.ts +27 -0
- package/dist/types/seekbuddy/Message.d.ts +52 -0
- package/dist/types/seekbuddy/Pagination.d.ts +66 -0
- package/dist/types/seekbuddy/Spinner.d.ts +20 -0
- package/dist/types/seekbuddy/StatusBadge.d.ts +33 -0
- package/dist/types/seekbuddy/SubtleButton.d.ts +30 -0
- package/dist/types/seekbuddy/Switch.d.ts +36 -0
- package/dist/types/seekbuddy/Tabs.d.ts +49 -0
- package/dist/types/seekbuddy/Timeline.d.ts +42 -0
- package/dist/types/seekbuddy/Upload.d.ts +101 -0
- package/dist/types/seekbuddy/date/Calendar.d.ts +94 -0
- package/dist/types/seekbuddy/date/DatePicker.d.ts +29 -0
- package/dist/types/seekbuddy/date/DateRangePicker.d.ts +41 -0
- package/dist/types/seekbuddy/date/TimePicker.d.ts +35 -0
- package/dist/types/seekbuddy/date/date.d.ts +79 -0
- package/dist/types/seekbuddy/date/fields.d.ts +45 -0
- package/dist/types/seekbuddy/index.d.ts +49 -0
- package/dist/types/seekbuddy/qr/QrCode.d.ts +37 -0
- package/dist/types/seekbuddy/qr/qr.d.ts +38 -0
- package/dist/types/theme-bootstrap.d.ts +3 -0
- package/dist/types/theme-core.d.ts +14 -0
- package/dist/types/theme.d.ts +4 -0
- package/dist/types/use-copy-feedback.d.ts +13 -0
- package/dist/types/useAnchoredMaxHeight.d.ts +13 -0
- package/dist/types/useAnchoredPosition.d.ts +35 -0
- package/dist/types/useDismissOnOutsidePointer.d.ts +10 -0
- package/dist/types/useModalLayer.d.ts +26 -0
- package/dist/types/user-text.d.ts +36 -0
- package/package.json +151 -4
|
@@ -0,0 +1,754 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IconCloseOutlineRegular
|
|
3
|
+
} from "./chunk-LA3QDZYN.js";
|
|
4
|
+
|
|
5
|
+
// .build/css/ShortcutKeys.module.mjs
|
|
6
|
+
var id = "@seekbuddy/dsh-ui/ShortcutKeys.module.css";
|
|
7
|
+
if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id + '"]')) {
|
|
8
|
+
const element = document.createElement("style");
|
|
9
|
+
element.setAttribute("data-dsh-ui-primitives", id);
|
|
10
|
+
element.textContent = ".dF9bOG_keys{color:var(--dsw-alias-label-tertiary);white-space:nowrap;flex:none;align-items:center;gap:3px;font-size:12px;line-height:16px;display:inline-flex}.dF9bOG_key{box-sizing:border-box;font:inherit;justify-content:center;align-items:center;display:inline-flex}.dF9bOG_tooltip{color:inherit;gap:2px;font-size:11px;line-height:14px}.dF9bOG_tooltip .dF9bOG_key{background:var(--dsw-alias-tooltip-key-bg);border:0;border-radius:4px;min-width:16px;height:16px;padding:0 2px}.dF9bOG_separator{font:inherit}.dF9bOG_joined{box-sizing:border-box;background:var(--dsw-alias-tooltip-key-bg);border-radius:4px;height:16px;padding:0 4px}.dF9bOG_joined .dF9bOG_key{background:0 0;border:0;min-width:0;height:auto;padding:0}";
|
|
11
|
+
document.head.appendChild(element);
|
|
12
|
+
}
|
|
13
|
+
var ShortcutKeys_module_default = { "key": "dF9bOG_key", "tooltip": "dF9bOG_tooltip", "separator": "dF9bOG_separator", "joined": "dF9bOG_joined", "keys": "dF9bOG_keys" };
|
|
14
|
+
|
|
15
|
+
// src/ShortcutKeys.tsx
|
|
16
|
+
import clsx from "clsx";
|
|
17
|
+
import { jsx } from "react/jsx-runtime";
|
|
18
|
+
function ShortcutKeys({
|
|
19
|
+
keys,
|
|
20
|
+
variant = "plain",
|
|
21
|
+
className
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"span",
|
|
25
|
+
{
|
|
26
|
+
className: clsx(
|
|
27
|
+
ShortcutKeys_module_default.keys,
|
|
28
|
+
variant === "tooltip" && ShortcutKeys_module_default.tooltip,
|
|
29
|
+
variant === "tooltip" && keys.includes("+") && ShortcutKeys_module_default.joined,
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
children: keys.map((key, index) => /* @__PURE__ */ jsx("kbd", { className: key === "+" ? ShortcutKeys_module_default.separator : ShortcutKeys_module_default.key, children: key }, index))
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/useDismissOnOutsidePointer.ts
|
|
38
|
+
import { useEffect } from "react";
|
|
39
|
+
function useDismissOnOutsidePointer(root, open, setOpen, portal) {
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!open) return;
|
|
42
|
+
const closeOutside = (event) => {
|
|
43
|
+
if (event.target instanceof Node && root.current?.contains(event.target) !== true && portal?.current?.contains(event.target) !== true) {
|
|
44
|
+
setOpen(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
document.addEventListener("pointerdown", closeOutside);
|
|
48
|
+
return () => {
|
|
49
|
+
document.removeEventListener("pointerdown", closeOutside);
|
|
50
|
+
};
|
|
51
|
+
}, [root, open, setOpen, portal]);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/clipboard.ts
|
|
55
|
+
async function writeClipboard(text) {
|
|
56
|
+
if (navigator.clipboard?.writeText) {
|
|
57
|
+
try {
|
|
58
|
+
await navigator.clipboard.writeText(text);
|
|
59
|
+
return true;
|
|
60
|
+
} catch {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const exec = typeof document.execCommand === "function" ? document.execCommand.bind(document) : void 0;
|
|
65
|
+
if (exec === void 0) return false;
|
|
66
|
+
const el = document.createElement("textarea");
|
|
67
|
+
el.value = text;
|
|
68
|
+
el.setAttribute("readonly", "");
|
|
69
|
+
el.style.position = "fixed";
|
|
70
|
+
el.style.left = "-9999px";
|
|
71
|
+
document.body.appendChild(el);
|
|
72
|
+
el.select();
|
|
73
|
+
try {
|
|
74
|
+
return exec("copy");
|
|
75
|
+
} catch {
|
|
76
|
+
return false;
|
|
77
|
+
} finally {
|
|
78
|
+
el.remove();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/input-modality.ts
|
|
83
|
+
var INPUT_MODALITY = { pointer: "pointer", keyboard: "keyboard" };
|
|
84
|
+
var INPUT_MODALITY_ATTRIBUTE = "data-input-modality";
|
|
85
|
+
var FOCUS_NAVIGATION = /* @__PURE__ */ new Set(["Tab", "Home", "End", "PageUp", "PageDown"]);
|
|
86
|
+
var pointer = false;
|
|
87
|
+
var pointerOwnsFocus = false;
|
|
88
|
+
var keyFocusOrigin;
|
|
89
|
+
function publish() {
|
|
90
|
+
document.documentElement.setAttribute(
|
|
91
|
+
INPUT_MODALITY_ATTRIBUTE,
|
|
92
|
+
pointerOwnsFocus ? INPUT_MODALITY.pointer : INPUT_MODALITY.keyboard
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
function pointerModality() {
|
|
96
|
+
return pointer;
|
|
97
|
+
}
|
|
98
|
+
if (typeof window !== "undefined") {
|
|
99
|
+
window.addEventListener(
|
|
100
|
+
"pointerdown",
|
|
101
|
+
() => {
|
|
102
|
+
pointer = true;
|
|
103
|
+
pointerOwnsFocus = true;
|
|
104
|
+
keyFocusOrigin = void 0;
|
|
105
|
+
publish();
|
|
106
|
+
},
|
|
107
|
+
true
|
|
108
|
+
);
|
|
109
|
+
window.addEventListener(
|
|
110
|
+
"keydown",
|
|
111
|
+
(event) => {
|
|
112
|
+
pointer = false;
|
|
113
|
+
if (event.isComposing) {
|
|
114
|
+
keyFocusOrigin = void 0;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
keyFocusOrigin = event.composedPath()[0];
|
|
118
|
+
if (!FOCUS_NAVIGATION.has(event.key) && !event.key.startsWith("Arrow")) return;
|
|
119
|
+
pointerOwnsFocus = false;
|
|
120
|
+
publish();
|
|
121
|
+
},
|
|
122
|
+
true
|
|
123
|
+
);
|
|
124
|
+
window.addEventListener(
|
|
125
|
+
"focusin",
|
|
126
|
+
(event) => {
|
|
127
|
+
if (keyFocusOrigin === void 0 || event.composedPath()[0] === keyFocusOrigin) return;
|
|
128
|
+
keyFocusOrigin = void 0;
|
|
129
|
+
if (!pointerOwnsFocus) return;
|
|
130
|
+
pointerOwnsFocus = false;
|
|
131
|
+
publish();
|
|
132
|
+
},
|
|
133
|
+
true
|
|
134
|
+
);
|
|
135
|
+
window.addEventListener("blur", () => {
|
|
136
|
+
keyFocusOrigin = void 0;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/Tooltip.tsx
|
|
141
|
+
import * as React from "react";
|
|
142
|
+
import { cloneElement, useCallback, useContext, useEffect as useEffect2, useId, useRef, useState } from "react";
|
|
143
|
+
import { createPortal } from "react-dom";
|
|
144
|
+
|
|
145
|
+
// .build/css/Tooltip.module.mjs
|
|
146
|
+
var id2 = "@seekbuddy/dsh-ui/Tooltip.module.css";
|
|
147
|
+
if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id2 + '"]')) {
|
|
148
|
+
const element = document.createElement("style");
|
|
149
|
+
element.setAttribute("data-dsh-ui-primitives", id2);
|
|
150
|
+
element.textContent = ".pspLTa_bubble{z-index:100;border-radius:var(--dsw-radius-sm);background:var(--dsw-alias-tooltip-bg);width:max-content;max-width:50vw;color:var(--dsw-static-neutral-bluish-00);white-space:pre-line;overflow-wrap:break-word;pointer-events:none;animation:pspLTa_tooltip-in .15s var(--ds-ease-in-out);align-items:center;gap:8px;padding:3px 7px;font-size:13px;line-height:20px;display:inline-flex;position:fixed}.pspLTa_bubble[data-portal]{z-index:1100}.pspLTa_bubble[data-pinned]{pointer-events:auto}.pspLTa_label{min-width:0}.pspLTa_bubble[data-has-shortcut]{padding-inline-end:5px}.pspLTa_bubble[data-has-shortcut]:not(:has(.pspLTa_label)){padding:3px}.pspLTa_bubble[data-side=right]{transform:translateY(-50%)}.pspLTa_bubble[data-side=bottom]{transform:translate(-50%)}.pspLTa_bubble[data-side=top]{transform:translate(-50%,-100%)}.pspLTa_bubble[data-side=bottom][data-align=end]{transform:translate(-100%)}.pspLTa_bubble[data-side=top][data-align=end]{transform:translate(-100%,-100%)}@keyframes pspLTa_tooltip-in{0%{opacity:0}}@media (prefers-reduced-motion:reduce){.pspLTa_bubble{animation:none}}";
|
|
151
|
+
document.head.appendChild(element);
|
|
152
|
+
}
|
|
153
|
+
var Tooltip_module_default = { "tooltip-in": "pspLTa_tooltip-in", "bubble": "pspLTa_bubble", "label": "pspLTa_label" };
|
|
154
|
+
|
|
155
|
+
// src/Tooltip.tsx
|
|
156
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
157
|
+
var TooltipSuppression = typeof React.createContext === "function" ? React.createContext(null) : null;
|
|
158
|
+
function Tooltip({
|
|
159
|
+
label,
|
|
160
|
+
shortcutKeys,
|
|
161
|
+
side = "right",
|
|
162
|
+
align = "center",
|
|
163
|
+
delayMs = 0,
|
|
164
|
+
focusDelayMs = 0,
|
|
165
|
+
gap = 8,
|
|
166
|
+
disabled = false,
|
|
167
|
+
portal = false,
|
|
168
|
+
maxWidth,
|
|
169
|
+
openOnClick = false,
|
|
170
|
+
children
|
|
171
|
+
}) {
|
|
172
|
+
const id6 = useId();
|
|
173
|
+
const [pinned, setPinned] = useState(false);
|
|
174
|
+
const anchor = useRef(null);
|
|
175
|
+
const childRef = children.ref;
|
|
176
|
+
const mergedRef = useCallback(
|
|
177
|
+
(el) => {
|
|
178
|
+
anchor.current = el;
|
|
179
|
+
if (typeof childRef === "function") childRef(el);
|
|
180
|
+
else if (childRef != null) childRef.current = el;
|
|
181
|
+
},
|
|
182
|
+
[childRef]
|
|
183
|
+
);
|
|
184
|
+
const [pos, setPos] = useState(null);
|
|
185
|
+
const bubble = useRef(null);
|
|
186
|
+
const resolvedLabel = pos === null ? null : typeof label === "function" ? label() : label;
|
|
187
|
+
const y = pos === null ? 0 : side === "right" ? pos.top + (pos.bottom - pos.top) / 2 : side === "top" ? pos.top - gap : pos.bottom + gap;
|
|
188
|
+
const showTimer = useRef(null);
|
|
189
|
+
const triggers = useRef({ hover: false, focus: false });
|
|
190
|
+
const suppressAncestors = useContext(TooltipSuppression);
|
|
191
|
+
const [suppressed, setSuppressed] = useState(false);
|
|
192
|
+
const announce = useCallback(
|
|
193
|
+
(active) => {
|
|
194
|
+
suppressAncestors?.(active);
|
|
195
|
+
},
|
|
196
|
+
[suppressAncestors]
|
|
197
|
+
);
|
|
198
|
+
const visible = pos !== null && !disabled;
|
|
199
|
+
useEffect2(() => {
|
|
200
|
+
const el = bubble.current;
|
|
201
|
+
if (pos === null || !visible || suppressed || el === null) return;
|
|
202
|
+
const edgeMargin = 12;
|
|
203
|
+
let size;
|
|
204
|
+
let placement = side;
|
|
205
|
+
const fit = () => {
|
|
206
|
+
if (size === void 0) return;
|
|
207
|
+
const { inlineSize: width, blockSize: height } = size;
|
|
208
|
+
const offset = side === "right" ? 0 : align === "end" ? width : width / 2;
|
|
209
|
+
const left = Math.max(edgeMargin, Math.min(pos.x - offset, window.innerWidth - edgeMargin - width));
|
|
210
|
+
const fitsBelow = pos.bottom + gap + height <= window.innerHeight - edgeMargin;
|
|
211
|
+
const fitsAbove = pos.top - gap - height >= edgeMargin;
|
|
212
|
+
if (placement === "bottom" && !fitsBelow && fitsAbove) placement = "top";
|
|
213
|
+
else if (placement === "top" && !fitsAbove && fitsBelow) placement = "bottom";
|
|
214
|
+
el.style.left = `${left + offset}px`;
|
|
215
|
+
el.style.top = `${placement === "right" ? (pos.top + pos.bottom) / 2 : placement === "top" ? pos.top - gap : pos.bottom + gap}px`;
|
|
216
|
+
el.dataset.side = placement;
|
|
217
|
+
el.style.visibility = "visible";
|
|
218
|
+
};
|
|
219
|
+
const observer = new ResizeObserver((entries) => {
|
|
220
|
+
size = entries[0]?.borderBoxSize[0];
|
|
221
|
+
fit();
|
|
222
|
+
});
|
|
223
|
+
observer.observe(el, { box: "border-box" });
|
|
224
|
+
window.addEventListener("resize", fit);
|
|
225
|
+
return () => {
|
|
226
|
+
observer.disconnect();
|
|
227
|
+
window.removeEventListener("resize", fit);
|
|
228
|
+
};
|
|
229
|
+
}, [align, gap, pos, side, suppressed, visible]);
|
|
230
|
+
useEffect2(() => {
|
|
231
|
+
announce(visible);
|
|
232
|
+
return () => {
|
|
233
|
+
announce(false);
|
|
234
|
+
};
|
|
235
|
+
}, [announce, visible]);
|
|
236
|
+
const cancelShow = useCallback(() => {
|
|
237
|
+
if (showTimer.current === null) return;
|
|
238
|
+
clearTimeout(showTimer.current);
|
|
239
|
+
showTimer.current = null;
|
|
240
|
+
}, []);
|
|
241
|
+
useEffect2(() => {
|
|
242
|
+
if (pinned && (disabled || !openOnClick)) setPinned(false);
|
|
243
|
+
if (disabled) {
|
|
244
|
+
cancelShow();
|
|
245
|
+
triggers.current = { hover: false, focus: false };
|
|
246
|
+
setPos(null);
|
|
247
|
+
}
|
|
248
|
+
return cancelShow;
|
|
249
|
+
}, [cancelShow, disabled, openOnClick, pinned]);
|
|
250
|
+
const show = () => {
|
|
251
|
+
if (disabled) return;
|
|
252
|
+
const el = anchor.current;
|
|
253
|
+
if (el === null) return;
|
|
254
|
+
const r = el.getBoundingClientRect();
|
|
255
|
+
setPos({
|
|
256
|
+
x: side === "right" ? r.right + 10 : align === "end" ? r.right : r.left + r.width / 2,
|
|
257
|
+
top: r.top,
|
|
258
|
+
bottom: r.bottom
|
|
259
|
+
});
|
|
260
|
+
announce(true);
|
|
261
|
+
};
|
|
262
|
+
const showAfterDelay = (delay) => {
|
|
263
|
+
cancelShow();
|
|
264
|
+
if (delay <= 0) {
|
|
265
|
+
show();
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
showTimer.current = setTimeout(() => {
|
|
269
|
+
showTimer.current = null;
|
|
270
|
+
show();
|
|
271
|
+
}, delay);
|
|
272
|
+
};
|
|
273
|
+
const withdraw = useCallback(() => {
|
|
274
|
+
setPinned(false);
|
|
275
|
+
setPos(null);
|
|
276
|
+
announce(false);
|
|
277
|
+
}, [announce]);
|
|
278
|
+
const hide = () => {
|
|
279
|
+
cancelShow();
|
|
280
|
+
if (!triggers.current.hover && !triggers.current.focus && !pinned) withdraw();
|
|
281
|
+
};
|
|
282
|
+
const dismiss = useCallback(() => {
|
|
283
|
+
cancelShow();
|
|
284
|
+
triggers.current = { hover: false, focus: false };
|
|
285
|
+
withdraw();
|
|
286
|
+
}, [cancelShow, withdraw]);
|
|
287
|
+
useDismissOnOutsidePointer(anchor, openOnClick && visible, dismiss, bubble);
|
|
288
|
+
useEffect2(() => {
|
|
289
|
+
if (!openOnClick || !visible) return;
|
|
290
|
+
const onKeyDown = (event) => {
|
|
291
|
+
if (event.key !== "Escape" && event.key !== "Tab") return;
|
|
292
|
+
if (event.key === "Escape") {
|
|
293
|
+
event.preventDefault();
|
|
294
|
+
event.stopPropagation();
|
|
295
|
+
}
|
|
296
|
+
dismiss();
|
|
297
|
+
};
|
|
298
|
+
document.addEventListener("keydown", onKeyDown, true);
|
|
299
|
+
return () => {
|
|
300
|
+
document.removeEventListener("keydown", onKeyDown, true);
|
|
301
|
+
};
|
|
302
|
+
}, [dismiss, openOnClick, visible]);
|
|
303
|
+
const content = visible && !suppressed && /* @__PURE__ */ jsxs(
|
|
304
|
+
"span",
|
|
305
|
+
{
|
|
306
|
+
ref: bubble,
|
|
307
|
+
id: openOnClick ? id6 : void 0,
|
|
308
|
+
className: Tooltip_module_default.bubble,
|
|
309
|
+
"data-side": side,
|
|
310
|
+
"data-portal": portal || void 0,
|
|
311
|
+
"data-pinned": pinned || void 0,
|
|
312
|
+
"data-align": align,
|
|
313
|
+
"data-has-shortcut": shortcutKeys?.length ? true : void 0,
|
|
314
|
+
style: { left: pos.x, top: y, visibility: "hidden", ...maxWidth === void 0 ? {} : { maxWidth } },
|
|
315
|
+
role: "tooltip",
|
|
316
|
+
"aria-label": shortcutKeys?.length ? [resolvedLabel, shortcutKeys.join(" ")].filter(Boolean).join(" ") : void 0,
|
|
317
|
+
children: [
|
|
318
|
+
resolvedLabel && /* @__PURE__ */ jsx2("span", { className: Tooltip_module_default.label, children: resolvedLabel }),
|
|
319
|
+
shortcutKeys !== void 0 && shortcutKeys.length > 0 && /* @__PURE__ */ jsx2(ShortcutKeys, { keys: shortcutKeys, variant: "tooltip" })
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
return /* @__PURE__ */ jsxs(TooltipSuppression.Provider, { value: setSuppressed, children: [
|
|
324
|
+
cloneElement(children, {
|
|
325
|
+
ref: mergedRef,
|
|
326
|
+
"aria-describedby": openOnClick && visible ? [children.props["aria-describedby"], id6].filter(Boolean).join(" ") : children.props["aria-describedby"],
|
|
327
|
+
onMouseEnter: (e) => {
|
|
328
|
+
children.props.onMouseEnter?.(e);
|
|
329
|
+
triggers.current.hover = true;
|
|
330
|
+
showAfterDelay(delayMs);
|
|
331
|
+
},
|
|
332
|
+
onMouseLeave: (e) => {
|
|
333
|
+
children.props.onMouseLeave?.(e);
|
|
334
|
+
triggers.current.hover = false;
|
|
335
|
+
cancelShow();
|
|
336
|
+
if (!pinned) withdraw();
|
|
337
|
+
},
|
|
338
|
+
// Activating an ordinary action dismisses the bubble: it often changes
|
|
339
|
+
// what the anchor now does (pin → unpin), and the click leaves the
|
|
340
|
+
// anchor focused, which would otherwise pin the relabelled bubble up.
|
|
341
|
+
onClick: (e) => {
|
|
342
|
+
children.props.onClick?.(e);
|
|
343
|
+
triggers.current.focus = false;
|
|
344
|
+
cancelShow();
|
|
345
|
+
if (openOnClick && !disabled && !pinned) {
|
|
346
|
+
setPinned(true);
|
|
347
|
+
show();
|
|
348
|
+
} else withdraw();
|
|
349
|
+
},
|
|
350
|
+
onFocus: (e) => {
|
|
351
|
+
children.props.onFocus?.(e);
|
|
352
|
+
if (pointerModality()) return;
|
|
353
|
+
triggers.current.focus = true;
|
|
354
|
+
showAfterDelay(focusDelayMs);
|
|
355
|
+
},
|
|
356
|
+
onBlur: (e) => {
|
|
357
|
+
children.props.onBlur?.(e);
|
|
358
|
+
triggers.current.focus = false;
|
|
359
|
+
hide();
|
|
360
|
+
}
|
|
361
|
+
}),
|
|
362
|
+
portal ? content !== false && createPortal(content, document.body) : content
|
|
363
|
+
] });
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// src/HoverCard.tsx
|
|
367
|
+
import { useCallback as useCallback3, useEffect as useEffect4, useLayoutEffect, useRef as useRef3, useState as useState2 } from "react";
|
|
368
|
+
import clsx2 from "clsx";
|
|
369
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
370
|
+
|
|
371
|
+
// src/pointer-grace.ts
|
|
372
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
373
|
+
var POINTER_GRACE_MS = 200;
|
|
374
|
+
function usePointerGrace(close) {
|
|
375
|
+
const timerRef = useRef2(null);
|
|
376
|
+
const closeRef = useRef2(close);
|
|
377
|
+
closeRef.current = close;
|
|
378
|
+
const cancel = useCallback2(() => {
|
|
379
|
+
if (timerRef.current === null) return;
|
|
380
|
+
clearTimeout(timerRef.current);
|
|
381
|
+
timerRef.current = null;
|
|
382
|
+
}, []);
|
|
383
|
+
const arm = useCallback2(() => {
|
|
384
|
+
cancel();
|
|
385
|
+
timerRef.current = setTimeout(() => {
|
|
386
|
+
timerRef.current = null;
|
|
387
|
+
closeRef.current();
|
|
388
|
+
}, POINTER_GRACE_MS);
|
|
389
|
+
}, [cancel]);
|
|
390
|
+
useEffect3(() => cancel, [cancel]);
|
|
391
|
+
return { arm, cancel };
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// src/overlay-top-margin.ts
|
|
395
|
+
function overlayTopMargin(min) {
|
|
396
|
+
const root = document.documentElement;
|
|
397
|
+
const clearance = Number.parseFloat(getComputedStyle(root).getPropertyValue("--dsh-frame-top-clearance"));
|
|
398
|
+
if (Number.isNaN(clearance)) return min;
|
|
399
|
+
return Math.max(min, (root.hasAttribute("data-fullscreen") ? 0 : clearance) + 20);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// .build/css/HoverCard.module.mjs
|
|
403
|
+
var id3 = "@seekbuddy/dsh-ui/HoverCard.module.css";
|
|
404
|
+
if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id3 + '"]')) {
|
|
405
|
+
const element = document.createElement("style");
|
|
406
|
+
element.setAttribute("data-dsh-ui-primitives", id3);
|
|
407
|
+
element.textContent = ".LXrvdG_root{display:block;position:relative}.LXrvdG_card{--dsw-hovercard-bg:#2c2c2e;z-index:100;box-sizing:border-box;border-radius:var(--dsw-radius-lg);background:var(--dsw-hovercard-bg);color:#fff;width:244px;box-shadow:var(--dsw-shadow-lv3);padding:12px 16px;position:fixed}.LXrvdG_copyable{cursor:pointer}.LXrvdG_copyable:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px}.LXrvdG_feedback{justify-content:center;align-items:center;display:flex}.LXrvdG_copied{color:#fff;text-align:center;font-size:14px;line-height:20px}.LXrvdG_status{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.LXrvdG_preview{border-radius:var(--dsw-radius-lg);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);box-shadow:var(--dsw-elevation-panel);opacity:1;transition:opacity var(--dsh-hover-preview-fade) linear;border:0;flex-direction:column;padding:0;display:flex;overflow:hidden}@starting-style{.LXrvdG_preview{opacity:0}}.LXrvdG_preview[data-closing]{opacity:0;pointer-events:none}@media (prefers-reduced-motion:reduce){.LXrvdG_preview{transition:none}}.LXrvdG_inline{display:inline}.LXrvdG_media{--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);color:var(--dsw-alias-label-primary);background:var(--dsw-specific-menu);backdrop-filter:var(--dsw-menu-backdrop-filter);box-shadow:var(--dsw-elevation-panel);border:0;padding:8px;overflow:auto}";
|
|
408
|
+
document.head.appendChild(element);
|
|
409
|
+
}
|
|
410
|
+
var HoverCard_module_default = { "status": "LXrvdG_status", "card": "LXrvdG_card", "preview": "LXrvdG_preview", "root": "LXrvdG_root", "media": "LXrvdG_media", "copied": "LXrvdG_copied", "feedback": "LXrvdG_feedback", "inline": "LXrvdG_inline", "copyable": "LXrvdG_copyable" };
|
|
411
|
+
|
|
412
|
+
// src/HoverCard.tsx
|
|
413
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
414
|
+
var PREVIEW_FADE_MS = 100;
|
|
415
|
+
var PREVIEW_MAX_HEIGHT = 420;
|
|
416
|
+
var PREVIEW_INSET = 24;
|
|
417
|
+
var INLINE_PREVIEW_WIDTH = 300;
|
|
418
|
+
var ANCHOR_GAP = 8;
|
|
419
|
+
var VIEWPORT_MARGIN = 8;
|
|
420
|
+
function HoverCard({
|
|
421
|
+
anchor,
|
|
422
|
+
content,
|
|
423
|
+
openDelayMs = 500,
|
|
424
|
+
disabled = false,
|
|
425
|
+
copyText,
|
|
426
|
+
copyLabel,
|
|
427
|
+
copiedLabel,
|
|
428
|
+
variant = "compact",
|
|
429
|
+
widthAnchorRef,
|
|
430
|
+
inline = false
|
|
431
|
+
}) {
|
|
432
|
+
const rootRef = useRef3(null);
|
|
433
|
+
const cardRef = useRef3(null);
|
|
434
|
+
const timerRef = useRef3(null);
|
|
435
|
+
const copyTimerRef = useRef3(null);
|
|
436
|
+
const copyHeightRef = useRef3(null);
|
|
437
|
+
const copyEpochRef = useRef3(0);
|
|
438
|
+
const copyingRef = useRef3(false);
|
|
439
|
+
const mountedRef = useRef3(true);
|
|
440
|
+
const [phase, setPhase] = useState2("closed");
|
|
441
|
+
const open = phase !== "closed";
|
|
442
|
+
const closing = phase === "closing";
|
|
443
|
+
const [pos, setPos] = useState2(null);
|
|
444
|
+
const positioned = pos !== null;
|
|
445
|
+
const [copied, setCopied] = useState2(false);
|
|
446
|
+
const [suppressed, setSuppressed] = useState2(false);
|
|
447
|
+
const clearCopied = useCallback3(() => {
|
|
448
|
+
if (copyTimerRef.current !== null) {
|
|
449
|
+
clearTimeout(copyTimerRef.current);
|
|
450
|
+
copyTimerRef.current = null;
|
|
451
|
+
}
|
|
452
|
+
copyHeightRef.current = null;
|
|
453
|
+
setCopied(false);
|
|
454
|
+
}, []);
|
|
455
|
+
const close = useCallback3(() => {
|
|
456
|
+
copyEpochRef.current += 1;
|
|
457
|
+
clearCopied();
|
|
458
|
+
setPhase((current) => variant === "preview" && current !== "closed" ? "closing" : "closed");
|
|
459
|
+
}, [clearCopied, variant]);
|
|
460
|
+
const { arm: armClose, cancel: cancelClose } = usePointerGrace(close);
|
|
461
|
+
const clearTimer = () => {
|
|
462
|
+
if (timerRef.current !== null) {
|
|
463
|
+
clearTimeout(timerRef.current);
|
|
464
|
+
timerRef.current = null;
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
useEffect4(() => {
|
|
468
|
+
if (!closing) return;
|
|
469
|
+
const timer = setTimeout(() => {
|
|
470
|
+
setPhase("closed");
|
|
471
|
+
}, PREVIEW_FADE_MS);
|
|
472
|
+
return () => {
|
|
473
|
+
clearTimeout(timer);
|
|
474
|
+
};
|
|
475
|
+
}, [closing]);
|
|
476
|
+
useEffect4(() => {
|
|
477
|
+
if (!disabled) return;
|
|
478
|
+
clearTimer();
|
|
479
|
+
cancelClose();
|
|
480
|
+
close();
|
|
481
|
+
}, [disabled, cancelClose, close]);
|
|
482
|
+
useEffect4(() => {
|
|
483
|
+
mountedRef.current = true;
|
|
484
|
+
return () => {
|
|
485
|
+
mountedRef.current = false;
|
|
486
|
+
copyEpochRef.current += 1;
|
|
487
|
+
clearTimer();
|
|
488
|
+
if (copyTimerRef.current !== null) {
|
|
489
|
+
clearTimeout(copyTimerRef.current);
|
|
490
|
+
copyTimerRef.current = null;
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
}, []);
|
|
494
|
+
useEffect4(() => {
|
|
495
|
+
if (!open || variant !== "preview" && !inline) return;
|
|
496
|
+
const dismiss = (event) => {
|
|
497
|
+
if (event.key !== "Escape") return;
|
|
498
|
+
if (inline) event.stopPropagation();
|
|
499
|
+
clearTimer();
|
|
500
|
+
cancelClose();
|
|
501
|
+
close();
|
|
502
|
+
};
|
|
503
|
+
window.addEventListener("keydown", dismiss, inline);
|
|
504
|
+
return () => {
|
|
505
|
+
window.removeEventListener("keydown", dismiss, inline);
|
|
506
|
+
};
|
|
507
|
+
}, [open, variant, inline, cancelClose, close]);
|
|
508
|
+
useLayoutEffect(() => {
|
|
509
|
+
if (!open) {
|
|
510
|
+
setPos(null);
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
const place = () => {
|
|
514
|
+
const wrapper = rootRef.current;
|
|
515
|
+
if (wrapper === null) return;
|
|
516
|
+
const r = wrapper.getBoundingClientRect();
|
|
517
|
+
const h = cardRef.current?.offsetHeight ?? 0;
|
|
518
|
+
if (variant === "preview") {
|
|
519
|
+
const bounds = widthAnchorRef?.current?.getBoundingClientRect() ?? r;
|
|
520
|
+
const width = Math.max(0, Math.min(bounds.width - PREVIEW_INSET * 2, window.innerWidth - VIEWPORT_MARGIN * 2));
|
|
521
|
+
const topMargin = overlayTopMargin(VIEWPORT_MARGIN);
|
|
522
|
+
const belowTop = Math.max(topMargin, r.bottom + ANCHOR_GAP);
|
|
523
|
+
const above = Math.max(0, r.top - ANCHOR_GAP - topMargin);
|
|
524
|
+
const below = Math.max(0, window.innerHeight - belowTop - VIEWPORT_MARGIN);
|
|
525
|
+
const onTop = above >= Math.min(PREVIEW_MAX_HEIGHT, below);
|
|
526
|
+
const maxHeight = Math.min(PREVIEW_MAX_HEIGHT, onTop ? above : below);
|
|
527
|
+
setPos({
|
|
528
|
+
left: Math.max(
|
|
529
|
+
VIEWPORT_MARGIN,
|
|
530
|
+
Math.min(bounds.left + PREVIEW_INSET, window.innerWidth - width - VIEWPORT_MARGIN)
|
|
531
|
+
),
|
|
532
|
+
top: onTop ? Math.max(topMargin, r.top - Math.min(h, maxHeight) - ANCHOR_GAP) : belowTop,
|
|
533
|
+
width,
|
|
534
|
+
maxHeight
|
|
535
|
+
});
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
if (inline) {
|
|
539
|
+
const height = Math.max(h, cardRef.current?.scrollHeight ?? 0);
|
|
540
|
+
const width = Math.max(0, Math.min(INLINE_PREVIEW_WIDTH, window.innerWidth - VIEWPORT_MARGIN * 2));
|
|
541
|
+
const topMargin = overlayTopMargin(VIEWPORT_MARGIN);
|
|
542
|
+
const belowTop = Math.max(topMargin, r.bottom + ANCHOR_GAP);
|
|
543
|
+
const above = Math.max(0, r.top - ANCHOR_GAP - topMargin);
|
|
544
|
+
const below = Math.max(0, window.innerHeight - belowTop - VIEWPORT_MARGIN);
|
|
545
|
+
const onTop = height > below && above > below;
|
|
546
|
+
const maxHeight = onTop ? above : below;
|
|
547
|
+
setPos({
|
|
548
|
+
left: Math.max(VIEWPORT_MARGIN, Math.min(r.left, window.innerWidth - width - VIEWPORT_MARGIN)),
|
|
549
|
+
top: onTop ? r.top - ANCHOR_GAP - Math.min(height, maxHeight) : belowTop,
|
|
550
|
+
width,
|
|
551
|
+
maxHeight
|
|
552
|
+
});
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
const top = r.top + h > window.innerHeight - VIEWPORT_MARGIN ? window.innerHeight - h - VIEWPORT_MARGIN : r.top;
|
|
556
|
+
setPos({ left: r.right + ANCHOR_GAP, top });
|
|
557
|
+
};
|
|
558
|
+
place();
|
|
559
|
+
const observer = (variant === "preview" || inline) && typeof ResizeObserver !== "undefined" ? new ResizeObserver(place) : null;
|
|
560
|
+
for (const element of [cardRef.current, rootRef.current, widthAnchorRef?.current]) {
|
|
561
|
+
if (element !== null && element !== void 0) observer?.observe(element);
|
|
562
|
+
}
|
|
563
|
+
window.addEventListener("scroll", place, true);
|
|
564
|
+
window.addEventListener("resize", place);
|
|
565
|
+
return () => {
|
|
566
|
+
observer?.disconnect();
|
|
567
|
+
window.removeEventListener("scroll", place, true);
|
|
568
|
+
window.removeEventListener("resize", place);
|
|
569
|
+
};
|
|
570
|
+
}, [open, variant, widthAnchorRef, positioned, inline]);
|
|
571
|
+
useLayoutEffect(() => {
|
|
572
|
+
if (!open || pos === null || variant === "preview" || inline || suppressed) return;
|
|
573
|
+
const h = cardRef.current?.offsetHeight ?? 0;
|
|
574
|
+
if (pos.top + h > window.innerHeight - VIEWPORT_MARGIN) {
|
|
575
|
+
setPos({ left: pos.left, top: window.innerHeight - h - VIEWPORT_MARGIN });
|
|
576
|
+
}
|
|
577
|
+
}, [open, pos, variant, inline, suppressed]);
|
|
578
|
+
const copy = async (text) => {
|
|
579
|
+
if (copied || copyingRef.current) return;
|
|
580
|
+
copyingRef.current = true;
|
|
581
|
+
const copyEpoch = copyEpochRef.current;
|
|
582
|
+
const accepted = await writeClipboard(text);
|
|
583
|
+
copyingRef.current = false;
|
|
584
|
+
const card2 = cardRef.current;
|
|
585
|
+
if (!accepted || !mountedRef.current || copyEpoch !== copyEpochRef.current || card2 === null) return;
|
|
586
|
+
const height = card2.offsetHeight;
|
|
587
|
+
copyHeightRef.current = height > 0 ? height : null;
|
|
588
|
+
setCopied(true);
|
|
589
|
+
copyTimerRef.current = setTimeout(clearCopied, 1e3);
|
|
590
|
+
};
|
|
591
|
+
const copyable = copyText !== void 0;
|
|
592
|
+
const dismissFromAnchor = (event) => {
|
|
593
|
+
if (cardRef.current?.contains(event.target)) return;
|
|
594
|
+
clearTimer();
|
|
595
|
+
cancelClose();
|
|
596
|
+
close();
|
|
597
|
+
};
|
|
598
|
+
const card = open && pos !== null && !suppressed && /* @__PURE__ */ jsx3(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
ref: cardRef,
|
|
602
|
+
className: clsx2(
|
|
603
|
+
HoverCard_module_default.card,
|
|
604
|
+
variant === "preview" && HoverCard_module_default.preview,
|
|
605
|
+
inline && HoverCard_module_default.media,
|
|
606
|
+
copyable && HoverCard_module_default.copyable,
|
|
607
|
+
copied && HoverCard_module_default.feedback
|
|
608
|
+
),
|
|
609
|
+
"data-closing": closing || void 0,
|
|
610
|
+
style: {
|
|
611
|
+
...pos,
|
|
612
|
+
minHeight: copied && copyHeightRef.current !== null ? copyHeightRef.current : void 0,
|
|
613
|
+
"--dsh-hover-preview-fade": `${PREVIEW_FADE_MS}ms`
|
|
614
|
+
},
|
|
615
|
+
role: copyable ? "button" : void 0,
|
|
616
|
+
tabIndex: copyable ? 0 : void 0,
|
|
617
|
+
"aria-label": copyable ? `${copyLabel}: ${copyText}` : void 0,
|
|
618
|
+
onClick: copyable ? (e) => {
|
|
619
|
+
const selection = window.getSelection();
|
|
620
|
+
if (selection !== null && !selection.isCollapsed) {
|
|
621
|
+
for (let i = 0; i < selection.rangeCount; i += 1) {
|
|
622
|
+
if (selection.getRangeAt(i).intersectsNode(e.currentTarget)) return;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
void copy(copyText);
|
|
626
|
+
} : void 0,
|
|
627
|
+
onKeyDown: copyable ? (e) => {
|
|
628
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
629
|
+
e.preventDefault();
|
|
630
|
+
void copy(copyText);
|
|
631
|
+
} : void 0,
|
|
632
|
+
children: copied ? /* @__PURE__ */ jsx3("span", { className: HoverCard_module_default.copied, "aria-hidden": "true", children: copiedLabel }) : content
|
|
633
|
+
}
|
|
634
|
+
);
|
|
635
|
+
return /* @__PURE__ */ jsxs2(
|
|
636
|
+
"span",
|
|
637
|
+
{
|
|
638
|
+
ref: rootRef,
|
|
639
|
+
className: clsx2(HoverCard_module_default.root, inline && HoverCard_module_default.inline),
|
|
640
|
+
onFocus: inline ? (event) => {
|
|
641
|
+
if (!disabled && event.target.matches(":focus-visible")) {
|
|
642
|
+
cancelClose();
|
|
643
|
+
setPhase("open");
|
|
644
|
+
}
|
|
645
|
+
} : void 0,
|
|
646
|
+
onBlur: inline ? (event) => {
|
|
647
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
648
|
+
clearTimer();
|
|
649
|
+
cancelClose();
|
|
650
|
+
close();
|
|
651
|
+
}
|
|
652
|
+
} : void 0,
|
|
653
|
+
onPointerEnter: (event) => {
|
|
654
|
+
if (disabled || inline && event.pointerType === "touch") return;
|
|
655
|
+
cancelClose();
|
|
656
|
+
if (open) {
|
|
657
|
+
setPhase("open");
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
clearTimer();
|
|
661
|
+
timerRef.current = setTimeout(() => {
|
|
662
|
+
setPhase("open");
|
|
663
|
+
}, openDelayMs);
|
|
664
|
+
},
|
|
665
|
+
onPointerLeave: () => {
|
|
666
|
+
clearTimer();
|
|
667
|
+
if (open) armClose();
|
|
668
|
+
},
|
|
669
|
+
onPointerDownCapture: dismissFromAnchor,
|
|
670
|
+
onClickCapture: dismissFromAnchor,
|
|
671
|
+
children: [
|
|
672
|
+
/* @__PURE__ */ jsx3(TooltipSuppression.Provider, { value: setSuppressed, children: anchor }),
|
|
673
|
+
open && !suppressed && copyable && /* @__PURE__ */ jsx3("span", { className: HoverCard_module_default.status, role: "status", children: copied ? copiedLabel : "" }),
|
|
674
|
+
card !== false && createPortal2(card, document.body)
|
|
675
|
+
]
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// src/ImageLightbox.tsx
|
|
681
|
+
import { useEffect as useEffect5, useRef as useRef4 } from "react";
|
|
682
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
683
|
+
|
|
684
|
+
// .build/css/ImageLightbox.module.mjs
|
|
685
|
+
var id4 = "@seekbuddy/dsh-ui/ImageLightbox.module.css";
|
|
686
|
+
if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id4 + '"]')) {
|
|
687
|
+
const element = document.createElement("style");
|
|
688
|
+
element.setAttribute("data-dsh-ui-primitives", id4);
|
|
689
|
+
element.textContent = ".burpAG_backdrop{z-index:1000;place-items:center;padding:40px;display:grid;position:fixed;inset:0}.burpAG_mask{background:var(--dsw-alias-bg-mask-1);backdrop-filter:var(--dsw-mask-blur);position:absolute;inset:0}.burpAG_image{object-fit:contain;border-radius:var(--dsw-radius-lg);background:var(--dsw-specific-input-major);max-width:min(100%,1600px);max-height:calc(100vh - 80px);box-shadow:var(--dsw-elevation-prominent);border:0;position:relative}.burpAG_close{z-index:1;border:.5px solid var(--dsw-alias-border-l2-darkmode-thin);corner-shape:round;background:var(--dsw-specific-input-major);width:36px;height:36px;color:var(--dsw-alias-label-primary);cursor:pointer;border-radius:999px;place-items:center;display:grid;position:fixed;top:20px;right:20px}.burpAG_close:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}";
|
|
690
|
+
document.head.appendChild(element);
|
|
691
|
+
}
|
|
692
|
+
var ImageLightbox_module_default = { "image": "burpAG_image", "backdrop": "burpAG_backdrop", "close": "burpAG_close", "mask": "burpAG_mask" };
|
|
693
|
+
|
|
694
|
+
// src/ImageLightbox.tsx
|
|
695
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
696
|
+
function ImageLightbox({
|
|
697
|
+
src,
|
|
698
|
+
alt,
|
|
699
|
+
labels,
|
|
700
|
+
onClose
|
|
701
|
+
}) {
|
|
702
|
+
const closeRef = useRef4(null);
|
|
703
|
+
const restoreRef = useRef4(null);
|
|
704
|
+
useEffect5(() => {
|
|
705
|
+
restoreRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
706
|
+
closeRef.current?.focus();
|
|
707
|
+
const onKeyDown = (event) => {
|
|
708
|
+
if (event.key === "Escape") {
|
|
709
|
+
event.stopPropagation();
|
|
710
|
+
onClose();
|
|
711
|
+
}
|
|
712
|
+
if (event.key === "Tab") {
|
|
713
|
+
event.preventDefault();
|
|
714
|
+
closeRef.current?.focus();
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
window.addEventListener("keydown", onKeyDown, true);
|
|
718
|
+
return () => {
|
|
719
|
+
window.removeEventListener("keydown", onKeyDown, true);
|
|
720
|
+
restoreRef.current?.focus();
|
|
721
|
+
};
|
|
722
|
+
}, [onClose]);
|
|
723
|
+
return createPortal3(
|
|
724
|
+
/* @__PURE__ */ jsxs3("div", { className: ImageLightbox_module_default.backdrop, role: "dialog", "aria-modal": "true", "aria-label": labels.dialog, children: [
|
|
725
|
+
/* @__PURE__ */ jsx4("div", { className: ImageLightbox_module_default.mask, "aria-hidden": "true", onMouseDown: onClose }),
|
|
726
|
+
/* @__PURE__ */ jsx4("img", { className: ImageLightbox_module_default.image, src, alt }),
|
|
727
|
+
/* @__PURE__ */ jsx4("button", { ref: closeRef, type: "button", className: ImageLightbox_module_default.close, "aria-label": labels.close, onClick: onClose, children: /* @__PURE__ */ jsx4(IconCloseOutlineRegular, { size: 16 }) })
|
|
728
|
+
] }),
|
|
729
|
+
document.body
|
|
730
|
+
);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// .build/css/markdown/MarkdownText.module.mjs
|
|
734
|
+
var id5 = "@seekbuddy/dsh-ui/markdown/MarkdownText.module.css";
|
|
735
|
+
if (typeof document !== "undefined" && !document.querySelector('style[data-dsh-ui-primitives="' + id5 + '"]')) {
|
|
736
|
+
const element = document.createElement("style");
|
|
737
|
+
element.setAttribute("data-dsh-ui-primitives", id5);
|
|
738
|
+
element.textContent = "._8yfcBG_markdown{overflow-wrap:anywhere;min-width:0;font:var(--dsw-font-markdown-base);color:var(--dsw-alias-label-primary)}._8yfcBG_markdown strong{font-weight:600}._8yfcBG_markdown h1{font:var(--dsw-font-markdown-h1);margin:32px 0 16px}._8yfcBG_markdown h2{font:var(--dsw-font-markdown-h2);margin:32px 0 16px}._8yfcBG_markdown h3{font:var(--dsw-font-markdown-h3);margin:32px 0 16px}._8yfcBG_markdown h4{font:var(--dsw-font-markdown-h4);margin:16px 0}._8yfcBG_markdown :where(h5,h6){font:var(--dsw-font-markdown-base-strong);margin:16px 0}._8yfcBG_markdown :where(h1,h2,h3,h4,h5,h6) strong{font-weight:inherit}._8yfcBG_markdown p{margin:16px 0}._8yfcBG_markdown :where(h4,h5,h6)+:where(ul,ol){margin-top:8px}._8yfcBG_markdown :where(h4,h5,h6):has(+:where(ul,ol)){margin-bottom:8px}._8yfcBG_markdown a,._8yfcBG_markdown ._8yfcBG_fileLink{color:var(--dsw-alias-link);transition:box-shadow var(--ds-transition-duration) var(--ds-ease-in-out);border:2px solid #fff0;border-width:2px 3px;margin-left:-3px;margin-right:-3px;font-weight:500;text-decoration:none;position:relative}._8yfcBG_markdown a:hover,._8yfcBG_markdown a:focus{text-decoration:underline dotted var(--dsw-alias-link);text-underline-offset:3px;outline:none}._8yfcBG_markdown a:focus-visible,._8yfcBG_fileMention:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary))}._8yfcBG_linkIcon{vertical-align:-.25em;flex:none;width:1.1em;height:1.1em;margin-right:5px}._8yfcBG_markdown :where(ul,ol){margin:16px 0;padding-left:18px}._8yfcBG_markdown li:not(:first-child){margin-top:6px}._8yfcBG_markdown li>:where(ul,ol){margin-top:4px}._8yfcBG_markdown li::marker{color:var(--dsw-alias-label-secondary);line-height:24px}._8yfcBG_markdown :where(ul,ol) ol{padding-left:0;list-style-position:inside}._8yfcBG_markdown :where(ul,ol) ol li p{display:inline}._8yfcBG_markdown li>p{margin:8px 0}._8yfcBG_markdown li>:first-child{margin-top:0}._8yfcBG_markdown li>:last-child:not(.md-code-block){margin-bottom:0}._8yfcBG_markdown hr{background:var(--dsw-alias-border-l2);border:none;height:.5px;margin:32px 0;display:block}._8yfcBG_markdown blockquote{border-left:2px solid var(--dsw-alias-label-caption);margin:16px 0 0;padding-left:14px}._8yfcBG_markdown pre{font-family:var(--ds-font-family-code);margin:16px 0;overflow:auto}._8yfcBG_markdown :not(pre)>code{box-sizing:border-box;font:var(--dsw-font-markdown-code);font-family:var(--ds-font-family-code);background-color:var(--dsw-alias-markdown-inline-code);border:.5px solid var(--dsw-alias-border-l1);border-radius:var(--dsw-radius-sm);align-items:center;padding:0 5px;display:inline-flex;font-size:.875em!important}._8yfcBG_markdown :where(h1,h2,h3,h4,h5,h6) code{font:inherit;font-family:var(--ds-font-family-code)}._8yfcBG_markdown .katex-display{max-width:100%;overflow:auto hidden}._8yfcBG_markdown input[type=checkbox]{accent-color:var(--dsw-alias-label-secondary);margin:0 8px 0 0}._8yfcBG_tableScroll{overscroll-behavior-x:contain;max-width:100%;overflow-x:auto}._8yfcBG_tableScroll.md-table-wide{padding-bottom:var(--dsh-scrollbar-width,5px);overflow-x:hidden}._8yfcBG_tableScroll.md-table-wide:hover,._8yfcBG_tableScroll.md-table-wide:focus-visible{padding-bottom:0;overflow-x:scroll}._8yfcBG_tableScroll:focus-visible{box-shadow:0 0 0 2px var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline:none}._8yfcBG_tableScroll table{border-collapse:collapse;width:max-content;max-width:max-content}._8yfcBG_tableFill table{width:100%;max-width:none}._8yfcBG_tableScroll th{text-align:start;border-bottom:.5px solid var(--dsw-alias-border-l3);font:var(--dsw-font-markdown-table-head);border-top:none;min-width:100px;max-width:min(30vw,320px);padding:10px 16px}._8yfcBG_tableScroll td{border-bottom:.5px solid var(--dsw-alias-border-l2);font:var(--dsw-font-markdown-table);min-width:100px;max-width:min(30vw,320px);padding:10px 16px}._8yfcBG_tableScroll th:first-child,._8yfcBG_tableScroll td:first-child{padding-left:0}._8yfcBG_tableScroll td:last-child{padding-right:0}._8yfcBG_tableScroll table code{font-size:11px}._8yfcBG_markdown>:first-child,._8yfcBG_markdown p:first-child{margin-top:0!important}._8yfcBG_markdown>:last-child,._8yfcBG_markdown p:last-child{margin-bottom:0!important}._8yfcBG_imageAlt{color:var(--dsw-alias-label-tertiary);font-style:italic}._8yfcBG_image{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-base);object-fit:contain;width:auto;max-width:100%;height:auto;margin:0;display:block}._8yfcBG_fileMention{font:inherit;color:var(--dsw-alias-link);cursor:pointer;background:0 0;border:none;margin:0;padding:0;font-weight:500;text-decoration:none}._8yfcBG_fileLink{max-width:100%;text-align:inherit}._8yfcBG_fileMention:hover,._8yfcBG_fileMention:focus{text-decoration:underline dotted var(--dsw-alias-link);text-underline-offset:3px;outline:none}._8yfcBG_compact{max-width:100%;font-size:var(--dsh-content-font-size-secondary,13px);line-height:calc(20px + var(--dsh-content-font-delta-secondary,0px));color:var(--dsw-alias-label-tertiary)}._8yfcBG_compact :is(h1,h2,h3,h4,h5,h6){font:inherit;color:inherit;margin:8px 0 4px;font-weight:600}._8yfcBG_compact :is(p,ul,ol,blockquote){margin:4px 0}._8yfcBG_compact li:not(:first-child){margin-top:2px}._8yfcBG_compact li>p{margin:4px 0}._8yfcBG_compact li::marker{line-height:inherit;color:inherit}._8yfcBG_compact blockquote{padding-left:8px}._8yfcBG_compact hr{margin:8px 0}._8yfcBG_compact a,._8yfcBG_compact ._8yfcBG_fileMention{font-weight:inherit;color:inherit;text-decoration:underline dotted}._8yfcBG_compact a:hover,._8yfcBG_compact a:focus,._8yfcBG_compact ._8yfcBG_fileMention:hover,._8yfcBG_compact ._8yfcBG_fileMention:focus{text-decoration-color:currentColor}._8yfcBG_compact :not(pre)>code{font:inherit;font-family:var(--ds-font-family-code);border-radius:var(--dsw-radius-xs);box-decoration-break:clone;padding:0 3px;display:inline;font-size:1em!important}._8yfcBG_markdown._8yfcBG_compact .md-code-block{color:inherit;margin:4px 0}._8yfcBG_compact .md-code-block>:has(>[data-code-block-banner]){z-index:auto;position:static}._8yfcBG_compact pre,._8yfcBG_compact pre :is(code,span){color:inherit!important}._8yfcBG_markdown._8yfcBG_compact ._8yfcBG_tableScroll{width:100%;max-width:100%;margin:4px 0;padding-left:0}._8yfcBG_markdown._8yfcBG_compact ._8yfcBG_tableScroll>table{z-index:auto}._8yfcBG_compact :is(th,td){font:inherit;padding:4px 8px}._8yfcBG_compact th{font-weight:600}._8yfcBG_compact .katex{font-size:1em}._8yfcBG_compact :is(p,h1,h2,h3,h4,h5,h6,ul,ol):has(.katex){padding-bottom:1px;overflow:auto hidden}._8yfcBG_compact .katex-display{margin:4px 0}._8yfcBG_imageButton{border-radius:var(--dsw-radius-sm);vertical-align:middle;cursor:zoom-in;background:0 0;border:0;max-width:100%;padding:0;display:inline-block}._8yfcBG_imageButton ._8yfcBG_image{max-width:min(100%,640px);max-height:360px}._8yfcBG_imageButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:3px}._8yfcBG_previewName{text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);margin-top:8px;font-size:12px;line-height:18px;display:block;overflow:hidden}";
|
|
739
|
+
document.head.appendChild(element);
|
|
740
|
+
}
|
|
741
|
+
var MarkdownText_module_default = { "imageButton": "_8yfcBG_imageButton", "previewName": "_8yfcBG_previewName", "markdown": "_8yfcBG_markdown", "fileLink": "_8yfcBG_fileLink", "imageAlt": "_8yfcBG_imageAlt", "tableFill": "_8yfcBG_tableFill", "linkIcon": "_8yfcBG_linkIcon", "fileMention": "_8yfcBG_fileMention", "tableScroll": "_8yfcBG_tableScroll", "compact": "_8yfcBG_compact", "image": "_8yfcBG_image" };
|
|
742
|
+
|
|
743
|
+
export {
|
|
744
|
+
overlayTopMargin,
|
|
745
|
+
usePointerGrace,
|
|
746
|
+
ShortcutKeys,
|
|
747
|
+
useDismissOnOutsidePointer,
|
|
748
|
+
writeClipboard,
|
|
749
|
+
pointerModality,
|
|
750
|
+
Tooltip,
|
|
751
|
+
HoverCard,
|
|
752
|
+
MarkdownText_module_default,
|
|
753
|
+
ImageLightbox
|
|
754
|
+
};
|