@inf-monkeys-tech/monkeys-design 0.4.49 → 0.4.51
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/components/base/index.d.mts +2 -2
- package/dist/components/base/index.d.ts +2 -2
- package/dist/components/base/index.js +79 -13
- package/dist/components/base/index.js.map +1 -1
- package/dist/components/base/index.mjs +80 -14
- package/dist/components/base/index.mjs.map +1 -1
- package/dist/components/layout/index.d.mts +1 -1
- package/dist/components/layout/index.d.ts +1 -1
- package/dist/components/layout/index.js +86 -17
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +87 -18
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/components/workbench/index.d.mts +1 -1
- package/dist/components/workbench/index.d.ts +1 -1
- package/dist/components/workbench/index.js +1 -0
- package/dist/components/workbench/index.js.map +1 -1
- package/dist/components/workbench/index.mjs +1 -0
- package/dist/components/workbench/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +86 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +86 -18
- package/dist/index.mjs.map +1 -1
- package/dist/{theme-Clm5dVb0.d.mts → theme-CSDlBl7e.d.ts} +2 -2
- package/dist/{theme-sIoU5-YC.d.ts → theme-K9M_pIiz.d.mts} +2 -2
- package/dist/theme-system/index.d.mts +1 -1
- package/dist/theme-system/index.d.ts +1 -1
- package/dist/theme-system/index.js +1 -1
- package/dist/theme-system/index.mjs +1 -1
- package/dist/{types-Bn6PEDsX.d.mts → types-5cYLLXs8.d.mts} +1 -0
- package/dist/{types-Bn6PEDsX.d.ts → types-5cYLLXs8.d.ts} +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { c as BaseAppearance } from '../../types-
|
|
3
|
+
import { c as BaseAppearance } from '../../types-5cYLLXs8.mjs';
|
|
4
4
|
import '@radix-ui/react-context-menu';
|
|
5
5
|
|
|
6
6
|
type UserAccountMenuRadius = 'default' | 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { c as BaseAppearance } from '../../types-
|
|
3
|
+
import { c as BaseAppearance } from '../../types-5cYLLXs8.js';
|
|
4
4
|
import '@radix-ui/react-context-menu';
|
|
5
5
|
|
|
6
6
|
type UserAccountMenuRadius = 'default' | 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
@@ -4,6 +4,7 @@ var react = require('react');
|
|
|
4
4
|
var DropdownMenu = require('@radix-ui/react-dropdown-menu');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
require('@radix-ui/react-context-menu');
|
|
7
|
+
var reactDom = require('react-dom');
|
|
7
8
|
|
|
8
9
|
function _interopNamespace(e) {
|
|
9
10
|
if (e && e.__esModule) return e;
|
|
@@ -2911,6 +2912,45 @@ function getTooltipPlacementClassName(placement) {
|
|
|
2911
2912
|
return "bottom-[calc(100%+0.5rem)] left-1/2 -translate-x-1/2";
|
|
2912
2913
|
}
|
|
2913
2914
|
}
|
|
2915
|
+
function getPortalTooltipStyle(placement, rect, themeStyle) {
|
|
2916
|
+
if (!rect) return themeStyle;
|
|
2917
|
+
const offset = 8;
|
|
2918
|
+
const baseStyle = {
|
|
2919
|
+
...themeStyle,
|
|
2920
|
+
position: "fixed"
|
|
2921
|
+
};
|
|
2922
|
+
switch (placement) {
|
|
2923
|
+
case "bottom":
|
|
2924
|
+
return {
|
|
2925
|
+
...baseStyle,
|
|
2926
|
+
left: rect.left + rect.width / 2,
|
|
2927
|
+
top: rect.bottom + offset,
|
|
2928
|
+
transform: "translateX(-50%)"
|
|
2929
|
+
};
|
|
2930
|
+
case "left":
|
|
2931
|
+
return {
|
|
2932
|
+
...baseStyle,
|
|
2933
|
+
right: window.innerWidth - rect.left + offset,
|
|
2934
|
+
top: rect.top + rect.height / 2,
|
|
2935
|
+
transform: "translateY(-50%)"
|
|
2936
|
+
};
|
|
2937
|
+
case "right":
|
|
2938
|
+
return {
|
|
2939
|
+
...baseStyle,
|
|
2940
|
+
left: rect.right + offset,
|
|
2941
|
+
top: rect.top + rect.height / 2,
|
|
2942
|
+
transform: "translateY(-50%)"
|
|
2943
|
+
};
|
|
2944
|
+
case "top":
|
|
2945
|
+
default:
|
|
2946
|
+
return {
|
|
2947
|
+
...baseStyle,
|
|
2948
|
+
bottom: window.innerHeight - rect.top + offset,
|
|
2949
|
+
left: rect.left + rect.width / 2,
|
|
2950
|
+
transform: "translateX(-50%)"
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
}
|
|
2914
2954
|
function BaseTooltip({
|
|
2915
2955
|
content,
|
|
2916
2956
|
children,
|
|
@@ -2918,6 +2958,7 @@ function BaseTooltip({
|
|
|
2918
2958
|
defaultOpen = false,
|
|
2919
2959
|
placement = "top",
|
|
2920
2960
|
disabled = false,
|
|
2961
|
+
portal = false,
|
|
2921
2962
|
appearance,
|
|
2922
2963
|
className,
|
|
2923
2964
|
classNames,
|
|
@@ -2926,21 +2967,58 @@ function BaseTooltip({
|
|
|
2926
2967
|
...tooltipProps
|
|
2927
2968
|
}) {
|
|
2928
2969
|
const theme = resolveBaseAppearance(appearance);
|
|
2970
|
+
const rootRef = react.useRef(null);
|
|
2971
|
+
const [triggerRect, setTriggerRect] = react.useState(null);
|
|
2929
2972
|
const [uncontrolledOpen, setUncontrolledOpen] = react.useState(defaultOpen);
|
|
2930
2973
|
const isControlled = open !== void 0;
|
|
2931
2974
|
const isOpen = isControlled ? open : uncontrolledOpen;
|
|
2932
2975
|
const canShow = !disabled && hasRenderableNode(content);
|
|
2976
|
+
const shouldPortal = portal && typeof document !== "undefined";
|
|
2977
|
+
const tooltipStyle = react.useMemo(
|
|
2978
|
+
() => shouldPortal ? getPortalTooltipStyle(placement, triggerRect, theme.styles.tooltip) : theme.styles.tooltip,
|
|
2979
|
+
[placement, shouldPortal, theme.styles.tooltip, triggerRect]
|
|
2980
|
+
);
|
|
2933
2981
|
const setOpen = (nextOpen) => {
|
|
2934
2982
|
if (!canShow && nextOpen) return;
|
|
2983
|
+
if (shouldPortal) {
|
|
2984
|
+
setTriggerRect(nextOpen ? rootRef.current?.getBoundingClientRect() ?? null : null);
|
|
2985
|
+
}
|
|
2935
2986
|
if (!isControlled) {
|
|
2936
2987
|
setUncontrolledOpen(nextOpen);
|
|
2937
2988
|
}
|
|
2938
2989
|
onOpenChange?.(nextOpen);
|
|
2939
2990
|
};
|
|
2991
|
+
react.useLayoutEffect(() => {
|
|
2992
|
+
if (!shouldPortal || !canShow || !isOpen) return;
|
|
2993
|
+
const updateTriggerRect = () => {
|
|
2994
|
+
setTriggerRect(rootRef.current?.getBoundingClientRect() ?? null);
|
|
2995
|
+
};
|
|
2996
|
+
updateTriggerRect();
|
|
2997
|
+
window.addEventListener("resize", updateTriggerRect);
|
|
2998
|
+
window.addEventListener("scroll", updateTriggerRect, true);
|
|
2999
|
+
return () => {
|
|
3000
|
+
window.removeEventListener("resize", updateTriggerRect);
|
|
3001
|
+
window.removeEventListener("scroll", updateTriggerRect, true);
|
|
3002
|
+
};
|
|
3003
|
+
}, [canShow, isOpen, shouldPortal]);
|
|
3004
|
+
const tooltipContent = canShow && isOpen && (!shouldPortal || triggerRect) ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3005
|
+
"span",
|
|
3006
|
+
{
|
|
3007
|
+
role: "tooltip",
|
|
3008
|
+
className: cn(
|
|
3009
|
+
theme.slots.tooltipContent,
|
|
3010
|
+
shouldPortal ? void 0 : getTooltipPlacementClassName(placement),
|
|
3011
|
+
classNames?.content
|
|
3012
|
+
),
|
|
3013
|
+
style: tooltipStyle,
|
|
3014
|
+
children: content
|
|
3015
|
+
}
|
|
3016
|
+
) : null;
|
|
2940
3017
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2941
3018
|
"span",
|
|
2942
3019
|
{
|
|
2943
3020
|
...tooltipProps,
|
|
3021
|
+
ref: rootRef,
|
|
2944
3022
|
className: cn(theme.slots.tooltipRoot, classNames?.root, className),
|
|
2945
3023
|
style,
|
|
2946
3024
|
onMouseEnter: () => setOpen(true),
|
|
@@ -2949,19 +3027,7 @@ function BaseTooltip({
|
|
|
2949
3027
|
onBlur: () => setOpen(false),
|
|
2950
3028
|
children: [
|
|
2951
3029
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(theme.slots.tooltipTrigger, classNames?.trigger), children }),
|
|
2952
|
-
|
|
2953
|
-
"span",
|
|
2954
|
-
{
|
|
2955
|
-
role: "tooltip",
|
|
2956
|
-
className: cn(
|
|
2957
|
-
theme.slots.tooltipContent,
|
|
2958
|
-
getTooltipPlacementClassName(placement),
|
|
2959
|
-
classNames?.content
|
|
2960
|
-
),
|
|
2961
|
-
style: theme.styles.tooltip,
|
|
2962
|
-
children: content
|
|
2963
|
-
}
|
|
2964
|
-
) : null
|
|
3030
|
+
shouldPortal && tooltipContent ? reactDom.createPortal(tooltipContent, document.body) : tooltipContent
|
|
2965
3031
|
]
|
|
2966
3032
|
}
|
|
2967
3033
|
);
|
|
@@ -3615,6 +3681,7 @@ function NavigationLayoutActionButtons({
|
|
|
3615
3681
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3616
3682
|
content: action.label,
|
|
3617
3683
|
placement: "right",
|
|
3684
|
+
portal: true,
|
|
3618
3685
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3619
3686
|
BaseButton,
|
|
3620
3687
|
{
|
|
@@ -3764,6 +3831,7 @@ function SidebarBrand({
|
|
|
3764
3831
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3765
3832
|
content: brandTitle,
|
|
3766
3833
|
placement: "right",
|
|
3834
|
+
portal: true,
|
|
3767
3835
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3768
3836
|
BaseButton,
|
|
3769
3837
|
{
|
|
@@ -3828,6 +3896,7 @@ function Sidebar({
|
|
|
3828
3896
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3829
3897
|
content: item.label,
|
|
3830
3898
|
placement: "right",
|
|
3899
|
+
portal: true,
|
|
3831
3900
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3832
3901
|
BaseButton,
|
|
3833
3902
|
{
|
|
@@ -3940,9 +4009,9 @@ function HeadbarNavMenuItem({
|
|
|
3940
4009
|
onMouseEnter: openMenu,
|
|
3941
4010
|
onMouseLeave: scheduleCloseMenu,
|
|
3942
4011
|
className: cn2(
|
|
3943
|
-
"h-9 max-w-[12rem] border-transparent
|
|
4012
|
+
"h-9 max-w-[12rem] border-transparent px-3 text-sm font-medium shadow-none",
|
|
3944
4013
|
menuButtonRadiusClass,
|
|
3945
|
-
isActive || open ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
|
|
4014
|
+
isActive || open ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "!bg-transparent text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
|
|
3946
4015
|
)
|
|
3947
4016
|
}
|
|
3948
4017
|
) }),
|
|
@@ -4020,9 +4089,9 @@ function HeadbarNav({
|
|
|
4020
4089
|
label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
4021
4090
|
onClick: () => onNavigate?.(item.id),
|
|
4022
4091
|
className: cn2(
|
|
4023
|
-
"h-9 max-w-[12rem] border-transparent
|
|
4092
|
+
"h-9 max-w-[12rem] border-transparent px-3 text-sm font-medium shadow-none",
|
|
4024
4093
|
menuButtonRadiusClass,
|
|
4025
|
-
isActive ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
|
|
4094
|
+
isActive ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "!bg-transparent text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
|
|
4026
4095
|
)
|
|
4027
4096
|
},
|
|
4028
4097
|
item.id
|