@underverse-ui/underverse 1.0.94 → 1.0.95
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/api-reference.json +1 -1
- package/dist/index.cjs +98 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +108 -96
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -2930,20 +2930,10 @@ function useHydrated() {
|
|
|
2930
2930
|
return (0, import_react5.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
2931
2931
|
}
|
|
2932
2932
|
|
|
2933
|
-
// src/
|
|
2934
|
-
|
|
2935
|
-
var variantStyles2 = {
|
|
2936
|
-
default: "bg-popover text-popover-foreground border-border/50",
|
|
2937
|
-
info: "bg-info text-info-foreground border-info/20",
|
|
2938
|
-
warning: "bg-warning text-warning-foreground border-warning/20",
|
|
2939
|
-
error: "bg-destructive text-destructive-foreground border-destructive/20",
|
|
2940
|
-
success: "bg-success text-success-foreground border-success/20"
|
|
2941
|
-
};
|
|
2942
|
-
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
2943
|
-
function composeEventHandlers(theirHandler, ourHandler) {
|
|
2933
|
+
// src/utils/react-compose.ts
|
|
2934
|
+
function chainEventHandlers(...handlers) {
|
|
2944
2935
|
return (event) => {
|
|
2945
|
-
|
|
2946
|
-
ourHandler(event);
|
|
2936
|
+
handlers.forEach((handler) => handler?.(event));
|
|
2947
2937
|
};
|
|
2948
2938
|
}
|
|
2949
2939
|
function setRefValue(ref, value) {
|
|
@@ -2959,6 +2949,17 @@ function mergeRefs(...refs) {
|
|
|
2959
2949
|
refs.forEach((ref) => setRefValue(ref, value));
|
|
2960
2950
|
};
|
|
2961
2951
|
}
|
|
2952
|
+
|
|
2953
|
+
// src/components/Tooltip.tsx
|
|
2954
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2955
|
+
var variantStyles2 = {
|
|
2956
|
+
default: "bg-popover text-popover-foreground border-border/50",
|
|
2957
|
+
info: "bg-info text-info-foreground border-info/20",
|
|
2958
|
+
warning: "bg-warning text-warning-foreground border-warning/20",
|
|
2959
|
+
error: "bg-destructive text-destructive-foreground border-destructive/20",
|
|
2960
|
+
success: "bg-success text-success-foreground border-success/20"
|
|
2961
|
+
};
|
|
2962
|
+
var clamp = (value, min, max) => Math.max(min, Math.min(max, value));
|
|
2962
2963
|
function getTransformOrigin(side) {
|
|
2963
2964
|
switch (side) {
|
|
2964
2965
|
case "top":
|
|
@@ -3003,7 +3004,7 @@ function computeTooltipPosition(args) {
|
|
|
3003
3004
|
top = clamp(top, padding, viewport.height - contentSize.height - padding);
|
|
3004
3005
|
return { top, left, side };
|
|
3005
3006
|
}
|
|
3006
|
-
var Tooltip = ({
|
|
3007
|
+
var Tooltip = React9.forwardRef(({
|
|
3007
3008
|
children,
|
|
3008
3009
|
content,
|
|
3009
3010
|
placement = "top",
|
|
@@ -3011,8 +3012,9 @@ var Tooltip = ({
|
|
|
3011
3012
|
className,
|
|
3012
3013
|
disabled = false,
|
|
3013
3014
|
variant = "default",
|
|
3014
|
-
asChild = true
|
|
3015
|
-
|
|
3015
|
+
asChild = true,
|
|
3016
|
+
...triggerPassthroughProps
|
|
3017
|
+
}, forwardedRef) => {
|
|
3016
3018
|
const [isOpen, setIsOpen] = React9.useState(false);
|
|
3017
3019
|
const isMounted = useHydrated();
|
|
3018
3020
|
const triggerRef = React9.useRef(null);
|
|
@@ -3127,31 +3129,53 @@ var Tooltip = ({
|
|
|
3127
3129
|
if (panelRef.current) ro.observe(panelRef.current);
|
|
3128
3130
|
return () => ro.disconnect();
|
|
3129
3131
|
}, [isOpen, updatePosition]);
|
|
3132
|
+
const childProps = children.props;
|
|
3133
|
+
const childRef = childProps.ref;
|
|
3134
|
+
const passthroughRef = mergeRefs(forwardedRef, childRef, (node) => {
|
|
3135
|
+
triggerRef.current = node;
|
|
3136
|
+
});
|
|
3130
3137
|
if (disabled || !content) {
|
|
3131
|
-
return children;
|
|
3138
|
+
if (!asChild) return children;
|
|
3139
|
+
return React9.cloneElement(children, {
|
|
3140
|
+
...triggerPassthroughProps,
|
|
3141
|
+
ref: passthroughRef
|
|
3142
|
+
});
|
|
3132
3143
|
}
|
|
3133
|
-
const childProps = children.props;
|
|
3134
|
-
const childRef = children.ref ?? childProps.ref;
|
|
3135
3144
|
const triggerProps = {
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
}),
|
|
3145
|
+
...triggerPassthroughProps,
|
|
3146
|
+
ref: passthroughRef,
|
|
3139
3147
|
"data-underverse-tooltip-trigger": triggerSelector,
|
|
3140
|
-
onMouseEnter:
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3148
|
+
onMouseEnter: chainEventHandlers(
|
|
3149
|
+
triggerPassthroughProps.onMouseEnter,
|
|
3150
|
+
childProps.onMouseEnter,
|
|
3151
|
+
(e) => {
|
|
3152
|
+
triggerRef.current = e.currentTarget;
|
|
3153
|
+
handleMouseEnter();
|
|
3154
|
+
}
|
|
3155
|
+
),
|
|
3156
|
+
onMouseLeave: chainEventHandlers(
|
|
3157
|
+
triggerPassthroughProps.onMouseLeave,
|
|
3158
|
+
childProps.onMouseLeave,
|
|
3159
|
+
(e) => {
|
|
3160
|
+
triggerRef.current = e.currentTarget;
|
|
3161
|
+
handleMouseLeave();
|
|
3162
|
+
}
|
|
3163
|
+
),
|
|
3164
|
+
onFocus: chainEventHandlers(
|
|
3165
|
+
triggerPassthroughProps.onFocus,
|
|
3166
|
+
childProps.onFocus,
|
|
3167
|
+
(e) => {
|
|
3168
|
+
triggerRef.current = e.currentTarget;
|
|
3169
|
+
handleFocus();
|
|
3170
|
+
}
|
|
3171
|
+
),
|
|
3172
|
+
onBlur: chainEventHandlers(
|
|
3173
|
+
triggerPassthroughProps.onBlur,
|
|
3174
|
+
childProps.onBlur,
|
|
3175
|
+
(e) => {
|
|
3176
|
+
handleBlur();
|
|
3177
|
+
}
|
|
3178
|
+
)
|
|
3155
3179
|
};
|
|
3156
3180
|
const trigger = asChild ? React9.cloneElement(children, triggerProps) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { ...triggerProps, children });
|
|
3157
3181
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
@@ -3195,7 +3219,8 @@ var Tooltip = ({
|
|
|
3195
3219
|
document.body
|
|
3196
3220
|
)
|
|
3197
3221
|
] });
|
|
3198
|
-
};
|
|
3222
|
+
});
|
|
3223
|
+
Tooltip.displayName = "Tooltip";
|
|
3199
3224
|
|
|
3200
3225
|
// src/components/emoji-ui.tsx
|
|
3201
3226
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -6120,36 +6145,32 @@ var Popover = ({
|
|
|
6120
6145
|
) : null;
|
|
6121
6146
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
6122
6147
|
(() => {
|
|
6123
|
-
const TriggerComponent = trigger.type;
|
|
6124
6148
|
const triggerProps = trigger.props;
|
|
6125
|
-
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6149
|
+
const childRef = triggerProps.ref;
|
|
6150
|
+
return React18.cloneElement(trigger, {
|
|
6151
|
+
...triggerProps,
|
|
6152
|
+
ref: mergeRefs(childRef, (node) => {
|
|
6153
|
+
triggerRef.current = node;
|
|
6154
|
+
}),
|
|
6155
|
+
"data-underverse-popover-trigger": triggerSelector,
|
|
6156
|
+
onClick: chainEventHandlers(
|
|
6157
|
+
(e) => {
|
|
6131
6158
|
triggerRef.current = e.currentTarget;
|
|
6132
6159
|
e.preventDefault();
|
|
6133
6160
|
e.stopPropagation();
|
|
6134
6161
|
handleTriggerClick();
|
|
6135
|
-
if (typeof triggerProps.onClick === "function") {
|
|
6136
|
-
triggerProps.onClick(e);
|
|
6137
|
-
}
|
|
6138
6162
|
},
|
|
6139
|
-
|
|
6163
|
+
triggerProps.onClick
|
|
6164
|
+
),
|
|
6165
|
+
onFocus: chainEventHandlers(
|
|
6166
|
+
(e) => {
|
|
6140
6167
|
triggerRef.current = e.currentTarget;
|
|
6141
|
-
if (typeof triggerProps.onFocus === "function") {
|
|
6142
|
-
triggerProps.onFocus(e);
|
|
6143
|
-
}
|
|
6144
6168
|
},
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
)
|
|
6151
|
-
}
|
|
6152
|
-
);
|
|
6169
|
+
triggerProps.onFocus
|
|
6170
|
+
),
|
|
6171
|
+
"aria-expanded": isOpen,
|
|
6172
|
+
"aria-haspopup": triggerProps["aria-haspopup"] ?? "dialog"
|
|
6173
|
+
});
|
|
6153
6174
|
})(),
|
|
6154
6175
|
popoverContent
|
|
6155
6176
|
] });
|
|
@@ -7028,17 +7049,18 @@ var DropdownMenu = ({
|
|
|
7028
7049
|
index
|
|
7029
7050
|
);
|
|
7030
7051
|
}) : children });
|
|
7031
|
-
const TriggerComponent = trigger.type;
|
|
7032
7052
|
const triggerProps = trigger.props;
|
|
7033
|
-
const
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7053
|
+
const childRef = triggerProps.ref;
|
|
7054
|
+
const enhancedTrigger = import_react14.default.cloneElement(trigger, {
|
|
7055
|
+
...triggerProps,
|
|
7056
|
+
ref: mergeRefs(childRef, (node) => {
|
|
7057
|
+
triggerRef.current = node;
|
|
7058
|
+
}),
|
|
7059
|
+
"aria-haspopup": "menu",
|
|
7060
|
+
"aria-expanded": open,
|
|
7061
|
+
onKeyDown: chainEventHandlers((e) => {
|
|
7062
|
+
triggerRef.current = e.currentTarget;
|
|
7063
|
+
if (!disabled) {
|
|
7042
7064
|
if (e.key === "ArrowDown") {
|
|
7043
7065
|
e.preventDefault();
|
|
7044
7066
|
setOpen(true);
|
|
@@ -7054,22 +7076,12 @@ var DropdownMenu = ({
|
|
|
7054
7076
|
e.preventDefault();
|
|
7055
7077
|
setOpen(false);
|
|
7056
7078
|
}
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
if (typeof triggerProps.onFocus === "function") {
|
|
7064
|
-
triggerProps.onFocus(e);
|
|
7065
|
-
}
|
|
7066
|
-
},
|
|
7067
|
-
className: cn(
|
|
7068
|
-
triggerProps.className,
|
|
7069
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
7070
|
-
)
|
|
7071
|
-
}
|
|
7072
|
-
);
|
|
7079
|
+
}
|
|
7080
|
+
}, triggerProps.onKeyDown),
|
|
7081
|
+
onFocus: chainEventHandlers((e) => {
|
|
7082
|
+
triggerRef.current = e.currentTarget;
|
|
7083
|
+
}, triggerProps.onFocus)
|
|
7084
|
+
});
|
|
7073
7085
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
7074
7086
|
Popover,
|
|
7075
7087
|
{
|