@hexdspace/react 0.1.34 → 0.1.36
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/index.d.ts +4 -2
- package/dist/index.js +40 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -669,6 +669,7 @@ declare function Popover({ trigger, children, open, defaultOpen, onOpenChange, m
|
|
|
669
669
|
|
|
670
670
|
declare const dropdownMenuContentVariants: (props?: ({
|
|
671
671
|
chrome?: "flat" | "glass" | "glow" | null | undefined;
|
|
672
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
672
673
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
673
674
|
type DropdownMenuContentControlledProps = 'asChild' | 'children' | 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'collisionPadding' | 'className' | 'style' | 'aria-label' | 'aria-labelledby';
|
|
674
675
|
type DropdownMenuContentProps = Omit<React.ComponentPropsWithoutRef<typeof DropdownMenu$1.Content>, DropdownMenuContentControlledProps> & {
|
|
@@ -679,6 +680,7 @@ type DropdownMenuContentProps = Omit<React.ComponentPropsWithoutRef<typeof Dropd
|
|
|
679
680
|
declare const dropdownMenuItemVariants: (props?: ({
|
|
680
681
|
inset?: boolean | null | undefined;
|
|
681
682
|
destructive?: boolean | null | undefined;
|
|
683
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
682
684
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
683
685
|
interface DropdownMenuProps extends VariantProps<typeof dropdownMenuContentVariants> {
|
|
684
686
|
trigger: React.ReactElement;
|
|
@@ -701,8 +703,8 @@ interface DropdownMenuProps extends VariantProps<typeof dropdownMenuContentVaria
|
|
|
701
703
|
style?: React.CSSProperties;
|
|
702
704
|
contentProps?: DropdownMenuContentProps;
|
|
703
705
|
}
|
|
704
|
-
declare function DropdownMenu({ trigger, children, open, defaultOpen, onOpenChange, hoverOpen, hoverCloseDelayMs, modal, side, align, sideOffset, alignOffset, collisionPadding, portalContainer, ariaLabel, ariaLabelledBy, chrome, className, style, contentProps, }: DropdownMenuProps): react_jsx_runtime.JSX.Element;
|
|
705
|
-
interface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu$1.Item>, VariantProps<typeof dropdownMenuItemVariants> {
|
|
706
|
+
declare function DropdownMenu({ trigger, children, open, defaultOpen, onOpenChange, hoverOpen, hoverCloseDelayMs, modal, side, align, sideOffset, alignOffset, collisionPadding, portalContainer, ariaLabel, ariaLabelledBy, chrome, orientation, className, style, contentProps, }: DropdownMenuProps): react_jsx_runtime.JSX.Element;
|
|
707
|
+
interface DropdownMenuItemProps extends React.ComponentPropsWithoutRef<typeof DropdownMenu$1.Item>, Omit<VariantProps<typeof dropdownMenuItemVariants>, 'orientation'> {
|
|
706
708
|
}
|
|
707
709
|
declare const DropdownMenuItem: React.ForwardRefExoticComponent<DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>>;
|
|
708
710
|
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenu$1.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -2795,10 +2795,15 @@ var dropdownMenuContentVariants = cva7(
|
|
|
2795
2795
|
"bg-[color:var(--surface-2)]",
|
|
2796
2796
|
"shadow-[0_0_0_1px_color-mix(in_oklab,var(--border),transparent_55%),0_12px_28px_color-mix(in_oklab,var(--border),transparent_65%)]"
|
|
2797
2797
|
)
|
|
2798
|
+
},
|
|
2799
|
+
orientation: {
|
|
2800
|
+
horizontal: "min-w-0 w-max flex flex-row items-center gap-1.5",
|
|
2801
|
+
vertical: ""
|
|
2798
2802
|
}
|
|
2799
2803
|
},
|
|
2800
2804
|
defaultVariants: {
|
|
2801
|
-
chrome: "flat"
|
|
2805
|
+
chrome: "flat",
|
|
2806
|
+
orientation: "vertical"
|
|
2802
2807
|
}
|
|
2803
2808
|
}
|
|
2804
2809
|
);
|
|
@@ -2809,11 +2814,10 @@ var dropdownMenuItemVariants = cva7(
|
|
|
2809
2814
|
"text-[color:var(--text-1)] cursor-pointer",
|
|
2810
2815
|
"data-[highlighted]:bg-[color:var(--surface-hover)] data-[highlighted]:text-[color:var(--text-1)]",
|
|
2811
2816
|
"data-[highlighted]:shadow-[0_0_0_1px_color-mix(in_oklab,var(--border),transparent_55%)]",
|
|
2812
|
-
"data-[highlighted]:translate-x-[1px]",
|
|
2813
2817
|
"active:bg-[color:var(--surface-active)]",
|
|
2814
2818
|
"data-[disabled]:text-[color:var(--disabled-fg)] data-[disabled]:pointer-events-none",
|
|
2815
2819
|
"data-[disabled]:cursor-not-allowed",
|
|
2816
|
-
"transition-[background-color,color,box-shadow,transform] duration-[var(--motion-fast)] ease-out"
|
|
2820
|
+
"transition-[background-color,color,box-shadow,transform,translate] duration-[var(--motion-fast)] ease-out"
|
|
2817
2821
|
),
|
|
2818
2822
|
{
|
|
2819
2823
|
variants: {
|
|
@@ -2824,10 +2828,18 @@ var dropdownMenuItemVariants = cva7(
|
|
|
2824
2828
|
"data-[highlighted]:text-[color:var(--danger)]",
|
|
2825
2829
|
"data-[highlighted]:bg-[color:color-mix(in_oklab,var(--danger),transparent_85%)]"
|
|
2826
2830
|
)
|
|
2831
|
+
},
|
|
2832
|
+
orientation: {
|
|
2833
|
+
vertical: "data-[highlighted]:translate-x-[1px]",
|
|
2834
|
+
horizontal: "data-[highlighted]:translate-y-[-1px]"
|
|
2827
2835
|
}
|
|
2836
|
+
},
|
|
2837
|
+
defaultVariants: {
|
|
2838
|
+
orientation: "vertical"
|
|
2828
2839
|
}
|
|
2829
2840
|
}
|
|
2830
2841
|
);
|
|
2842
|
+
var DropdownMenuOrientationContext = React13.createContext("vertical");
|
|
2831
2843
|
function useWindowTimeout() {
|
|
2832
2844
|
const timeoutRef = React13.useRef(null);
|
|
2833
2845
|
const clear = React13.useCallback(() => {
|
|
@@ -2885,10 +2897,12 @@ function DropdownMenu({
|
|
|
2885
2897
|
ariaLabel = "Menu",
|
|
2886
2898
|
ariaLabelledBy,
|
|
2887
2899
|
chrome,
|
|
2900
|
+
orientation,
|
|
2888
2901
|
className,
|
|
2889
2902
|
style,
|
|
2890
2903
|
contentProps
|
|
2891
2904
|
}) {
|
|
2905
|
+
const resolvedItemsOrientation = orientation ?? "vertical";
|
|
2892
2906
|
const [uncontrolledOpen, setUncontrolledOpen] = React13.useState(defaultOpen ?? false);
|
|
2893
2907
|
const isControlled = open2 !== void 0;
|
|
2894
2908
|
const resolvedOpen = isControlled ? open2 : uncontrolledOpen;
|
|
@@ -3001,7 +3015,7 @@ function DropdownMenu({
|
|
|
3001
3015
|
...restContentProps,
|
|
3002
3016
|
onKeyDown: handleContentKeyDown
|
|
3003
3017
|
};
|
|
3004
|
-
return /* @__PURE__ */ jsxs11(DropdownMenuPrimitive.Root, { open: resolvedOpen, onOpenChange: handleOpenChange, modal, children: [
|
|
3018
|
+
return /* @__PURE__ */ jsx19(DropdownMenuOrientationContext.Provider, { value: resolvedItemsOrientation, children: /* @__PURE__ */ jsxs11(DropdownMenuPrimitive.Root, { open: resolvedOpen, onOpenChange: handleOpenChange, modal, children: [
|
|
3005
3019
|
/* @__PURE__ */ jsx19(DropdownMenuPrimitive.Trigger, { asChild: true, children: resolvedTrigger }),
|
|
3006
3020
|
/* @__PURE__ */ jsx19(DropdownMenuPrimitive.Portal, { forceMount: true, container: portalContainer, children: /* @__PURE__ */ jsx19(AnimatePresence4, { children: resolvedOpen ? /* @__PURE__ */ jsx19(
|
|
3007
3021
|
DropdownMenuPrimitive.Content,
|
|
@@ -3019,7 +3033,11 @@ function DropdownMenu({
|
|
|
3019
3033
|
children: /* @__PURE__ */ jsx19(
|
|
3020
3034
|
motion4.div,
|
|
3021
3035
|
{
|
|
3022
|
-
className: cn(
|
|
3036
|
+
className: cn(
|
|
3037
|
+
dropdownMenuContentVariants({ chrome, orientation }),
|
|
3038
|
+
className,
|
|
3039
|
+
contentClassName
|
|
3040
|
+
),
|
|
3023
3041
|
ref: composedContentRef,
|
|
3024
3042
|
initial: {
|
|
3025
3043
|
opacity: 0,
|
|
@@ -3042,20 +3060,27 @@ function DropdownMenu({
|
|
|
3042
3060
|
)
|
|
3043
3061
|
}
|
|
3044
3062
|
) : null }) })
|
|
3045
|
-
] });
|
|
3063
|
+
] }) });
|
|
3046
3064
|
}
|
|
3047
3065
|
var DropdownMenuItem = React13.forwardRef(
|
|
3048
|
-
({ className, inset, destructive, ...props }, ref) =>
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3066
|
+
({ className, inset, destructive, ...props }, ref) => {
|
|
3067
|
+
const orientation = React13.useContext(DropdownMenuOrientationContext);
|
|
3068
|
+
return /* @__PURE__ */ jsx19(
|
|
3069
|
+
DropdownMenuPrimitive.Item,
|
|
3070
|
+
{
|
|
3071
|
+
ref,
|
|
3072
|
+
className: cn(dropdownMenuItemVariants({ inset, destructive, orientation }), className),
|
|
3073
|
+
...props
|
|
3074
|
+
}
|
|
3075
|
+
);
|
|
3076
|
+
}
|
|
3056
3077
|
);
|
|
3057
3078
|
DropdownMenuItem.displayName = "DropdownMenuItem";
|
|
3058
|
-
var DropdownMenuSeparator = React13.forwardRef(({ className, ...props }, ref) =>
|
|
3079
|
+
var DropdownMenuSeparator = React13.forwardRef(({ className, ...props }, ref) => {
|
|
3080
|
+
const orientation = React13.useContext(DropdownMenuOrientationContext);
|
|
3081
|
+
const orientationClassName = orientation === "horizontal" ? "mx-1 w-px self-stretch bg-(--divider)" : "my-1 h-px bg-(--divider)";
|
|
3082
|
+
return /* @__PURE__ */ jsx19(DropdownMenuPrimitive.Separator, { ref, className: cn(orientationClassName, className), ...props });
|
|
3083
|
+
});
|
|
3059
3084
|
DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
|
|
3060
3085
|
|
|
3061
3086
|
// src/ui/components/Kbd.tsx
|