@underverse-ui/underverse 1.0.118 → 1.0.120

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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to `@underverse-ui/underverse` are documented in this file.
4
4
 
5
+ ## Unreleased
6
+
7
+ ### Fixed
8
+
9
+ - `Tooltip` now closes immediately when its trigger is pressed or when document-level pointer/Escape interactions indicate an overlay flow has taken over. This prevents portal tooltips from sticking on screen after opening dropdowns, popovers, or modals from a tooltip trigger, without overriding the normal hover close delay on pointer movement.
10
+
5
11
  ## [1.0.34] - 2026-02-24
6
12
 
7
13
  ### Changed
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.118",
3
+ "version": "1.0.120",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 232,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -3101,6 +3101,10 @@ var Tooltip = React10.forwardRef(({
3101
3101
  setIsOpen(false);
3102
3102
  }, delayClose);
3103
3103
  };
3104
+ const closeNow = React10.useCallback(() => {
3105
+ clearTimeout(timeoutRef.current);
3106
+ setIsOpen(false);
3107
+ }, []);
3104
3108
  const handleFocus = () => {
3105
3109
  if (disabled) return;
3106
3110
  setIsOpen(true);
@@ -3111,6 +3115,10 @@ var Tooltip = React10.forwardRef(({
3111
3115
  React10.useEffect(() => {
3112
3116
  return () => clearTimeout(timeoutRef.current);
3113
3117
  }, []);
3118
+ React10.useEffect(() => {
3119
+ if (isOpen) return;
3120
+ clearTimeout(timeoutRef.current);
3121
+ }, [isOpen]);
3114
3122
  React10.useLayoutEffect(() => {
3115
3123
  if (!isOpen) {
3116
3124
  lastAppliedRef.current = null;
@@ -3154,6 +3162,18 @@ var Tooltip = React10.forwardRef(({
3154
3162
  if (panelRef.current) ro.observe(panelRef.current);
3155
3163
  return () => ro.disconnect();
3156
3164
  }, [isOpen, updatePosition]);
3165
+ React10.useEffect(() => {
3166
+ if (!isOpen) return;
3167
+ const handleDocumentKeyDown = (event) => {
3168
+ if (event.key === "Escape") closeNow();
3169
+ };
3170
+ document.addEventListener("pointerdown", closeNow, true);
3171
+ document.addEventListener("keydown", handleDocumentKeyDown);
3172
+ return () => {
3173
+ document.removeEventListener("pointerdown", closeNow, true);
3174
+ document.removeEventListener("keydown", handleDocumentKeyDown);
3175
+ };
3176
+ }, [closeNow, isOpen]);
3157
3177
  const childProps = children.props;
3158
3178
  const childRef = childProps.ref;
3159
3179
  const passthroughRef = mergeRefs(forwardedRef, childRef, (node) => {
@@ -3186,6 +3206,22 @@ var Tooltip = React10.forwardRef(({
3186
3206
  handleMouseLeave();
3187
3207
  }
3188
3208
  ),
3209
+ onPointerDown: chainEventHandlers(
3210
+ triggerPassthroughProps.onPointerDown,
3211
+ childProps.onPointerDown,
3212
+ (e) => {
3213
+ triggerRef.current = e.currentTarget;
3214
+ closeNow();
3215
+ }
3216
+ ),
3217
+ onClick: chainEventHandlers(
3218
+ triggerPassthroughProps.onClick,
3219
+ childProps.onClick,
3220
+ (e) => {
3221
+ triggerRef.current = e.currentTarget;
3222
+ closeNow();
3223
+ }
3224
+ ),
3189
3225
  onFocus: chainEventHandlers(
3190
3226
  triggerPassthroughProps.onFocus,
3191
3227
  childProps.onFocus,
@@ -17652,6 +17688,9 @@ function CategoryTreeSelect(props) {
17652
17688
  searchDebounceMs = 0,
17653
17689
  minSearchLength = 0,
17654
17690
  showSearchPromptWhenEmptyQuery = false,
17691
+ baseIndent = TREE_NODE_BASE_PADDING_REM,
17692
+ indentSize = TREE_NODE_INDENT_REM,
17693
+ renderItemActions,
17655
17694
  singleSelect = false
17656
17695
  } = props;
17657
17696
  const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
@@ -17955,7 +17994,7 @@ function CategoryTreeSelect(props) {
17955
17994
  // Selected state - đồng bộ cho tất cả
17956
17995
  !viewOnly && isSelected && "bg-accent/40"
17957
17996
  ),
17958
- style: { paddingLeft: `${level * TREE_NODE_INDENT_REM + TREE_NODE_BASE_PADDING_REM}rem` },
17997
+ style: { paddingLeft: `${level * indentSize + baseIndent}rem` },
17959
17998
  children: [
17960
17999
  hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
17961
18000
  "button",
@@ -18000,7 +18039,8 @@ function CategoryTreeSelect(props) {
18000
18039
  ),
18001
18040
  hasChildren && !isSelected && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "ml-auto shrink-0 text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
18002
18041
  ] })
18003
- )
18042
+ ),
18043
+ renderItemActions && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "shrink-0 ml-auto", onClick: (e) => e.stopPropagation(), children: renderItemActions(category) })
18004
18044
  ]
18005
18045
  }
18006
18046
  ),