@kortix/ui 0.15.7 → 0.15.8
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/README.md +7 -7
- package/dist/_vendor/kortix-shared.js +36 -1
- package/dist/_vendor/shared/my-kortix-agent.d.ts +7 -0
- package/dist/_vendor/shared/pixel-mark.d.ts +18 -0
- package/dist/customize/connectors/catalog/connector-categories.d.ts +2 -2
- package/dist/customize/connectors/catalog/connector-categories.js +2 -2
- package/dist/customize/connectors/detail/connector-modal.js +1 -1
- package/dist/customize/sections/gateway-view.d.ts +1 -1
- package/dist/customize/sections/gateway-view.js +1 -1
- package/dist/customize/sections/view/account-secret-resources-panel.js +4 -2
- package/dist/customize/sections/view/agent-editor-basics-fields.js +1 -1
- package/dist/customize/sections/view/gateway/gateway-logs.d.ts +1 -1
- package/dist/customize/sections/view/git-view.js +1 -1
- package/dist/customize/sections/view/permission-editor.js +1 -1
- package/dist/customize/sections/view/subscription-usage.d.ts +3 -32
- package/dist/customize/sections/view/subscription-usage.js +2 -86
- package/dist/customize/shared/entity/entity-modal.js +8 -10
- package/dist/files/project/components/drive-toolbar.d.ts +1 -1
- package/dist/files/project/components/drive-toolbar.js +1 -1
- package/dist/files/project/store/version-store.d.ts +1 -1
- package/dist/files/renderers/shared/scroll-area-compat.d.ts +6 -6
- package/dist/files/renderers/shared/scroll-area-compat.js +7 -9
- package/dist/files/renderers/shared/select-compat.js +3 -7
- package/dist/files/viewer/file-preview-modal.d.ts +10 -11
- package/dist/files/viewer/file-preview-modal.js +17 -18
- package/dist/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +7 -4
- package/dist/index.js +1 -1
- package/dist/internal/account-hub/account-hub-location.js +2 -2
- package/dist/internal/account-hub/use-account-members.d.ts +28 -1
- package/dist/internal/account-hub/use-account-members.js +27 -10
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/navigation/modified-click.js +2 -2
- package/dist/internal/lib/pixel-mark.d.ts +3 -20
- package/dist/internal/lib/pixel-mark.js +3 -34
- package/dist/internal/stores/active-space-store.d.ts +1 -1
- package/dist/internal/stores/browser-recents-store.d.ts +1 -1
- package/dist/internal/stores/current-account-store.d.ts +1 -1
- package/dist/internal/stores/first-chat-store.d.ts +1 -1
- package/dist/internal/stores/mobile-app-promo-store.d.ts +1 -1
- package/dist/internal/stores/session-browser-store.d.ts +1 -1
- package/dist/internal/stores/session-expanded-store.d.ts +1 -1
- package/dist/internal/stores/session-filter-store.d.ts +1 -1
- package/dist/internal/stores/session-history-view-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.d.ts +1 -1
- package/dist/internal/stores/session-hover-store.js +1 -1
- package/dist/internal/stores/session-panel-memory-store.d.ts +1 -1
- package/dist/internal/stores/sound-store.d.ts +1 -1
- package/dist/internal/stores/tab-store.d.ts +1 -1
- package/dist/internal/stores/user-preferences-store.d.ts +1 -1
- package/dist/internal/stores/web-notification-store.d.ts +1 -1
- package/dist/lib/base-ui-compat.d.ts +149 -0
- package/dist/lib/base-ui-compat.js +339 -0
- package/dist/lib/portal-container.d.ts +3 -7
- package/dist/lib/portal-container.js +5 -3
- package/dist/lib/z-stack.d.ts +4 -4
- package/dist/lib/z-stack.js +5 -5
- package/dist/primitives/accordion.d.ts +36 -5
- package/dist/primitives/accordion.js +41 -8
- package/dist/primitives/alert-dialog.d.ts +33 -11
- package/dist/primitives/alert-dialog.js +41 -19
- package/dist/primitives/avatar.d.ts +5 -2
- package/dist/primitives/avatar.js +3 -3
- package/dist/primitives/badge.js +1 -1
- package/dist/primitives/breadcrumb.js +1 -1
- package/dist/primitives/button-group.js +3 -3
- package/dist/primitives/button.js +1 -1
- package/dist/primitives/checkbox.d.ts +14 -5
- package/dist/primitives/checkbox.js +24 -9
- package/dist/primitives/collapsible.d.ts +16 -4
- package/dist/primitives/collapsible.js +18 -7
- package/dist/primitives/command-core.d.ts +121 -0
- package/dist/primitives/command-core.js +642 -0
- package/dist/primitives/command.d.ts +38 -4
- package/dist/primitives/command.js +22 -13
- package/dist/primitives/context-menu.d.ts +61 -31
- package/dist/primitives/context-menu.js +40 -53
- package/dist/primitives/dialog.d.ts +48 -10
- package/dist/primitives/dialog.js +48 -19
- package/dist/primitives/disclosure.d.ts +1 -1
- package/dist/primitives/disclosure.js +2 -2
- package/dist/primitives/drawer.d.ts +28 -9
- package/dist/primitives/drawer.js +42 -18
- package/dist/primitives/dropdown-menu.d.ts +55 -33
- package/dist/primitives/dropdown-menu.js +46 -82
- package/dist/primitives/faded-scroll-area.js +2 -1
- package/dist/primitives/hint.js +3 -3
- package/dist/primitives/hover-card.d.ts +17 -5
- package/dist/primitives/hover-card.js +45 -8
- package/dist/primitives/item.js +2 -2
- package/dist/primitives/label.d.ts +5 -2
- package/dist/primitives/label.js +10 -3
- package/dist/primitives/menu-base.d.ts +150 -0
- package/dist/primitives/menu-base.js +171 -0
- package/dist/primitives/menu-recipe.d.ts +1 -1
- package/dist/primitives/menu-recipe.js +2 -7
- package/dist/primitives/modal.d.ts +19 -52
- package/dist/primitives/modal.js +24 -28
- package/dist/primitives/navigation-menu.d.ts +36 -11
- package/dist/primitives/navigation-menu.js +31 -12
- package/dist/primitives/popover.d.ts +31 -6
- package/dist/primitives/popover.js +79 -12
- package/dist/primitives/preview-image.d.ts +18 -7
- package/dist/primitives/preview-image.js +14 -11
- package/dist/primitives/progress.d.ts +4 -2
- package/dist/primitives/progress.js +4 -3
- package/dist/primitives/project-icon-picker.js +2 -2
- package/dist/primitives/radio-group.d.ts +28 -5
- package/dist/primitives/radio-group.js +18 -10
- package/dist/primitives/scroll-area.d.ts +2 -2
- package/dist/primitives/scroll-area.js +8 -3
- package/dist/primitives/select.d.ts +55 -12
- package/dist/primitives/select.js +93 -36
- package/dist/primitives/separator.d.ts +6 -2
- package/dist/primitives/separator.js +10 -2
- package/dist/primitives/sheet.d.ts +17 -10
- package/dist/primitives/sheet.js +19 -22
- package/dist/primitives/sidebar-menu-primitives.js +8 -8
- package/dist/primitives/slider-native.d.ts +2 -2
- package/dist/primitives/slider-native.js +11 -9
- package/dist/primitives/slider.d.ts +24 -6
- package/dist/primitives/slider.js +26 -24
- package/dist/primitives/slot.d.ts +6 -0
- package/dist/primitives/slot.js +7 -0
- package/dist/primitives/split-sheet.js +1 -1
- package/dist/primitives/stepper.js +1 -1
- package/dist/primitives/switch.d.ts +16 -3
- package/dist/primitives/switch.js +7 -6
- package/dist/primitives/tabs.d.ts +36 -20
- package/dist/primitives/tabs.js +131 -102
- package/dist/primitives/toggle.d.ts +16 -3
- package/dist/primitives/toggle.js +8 -3
- package/dist/primitives/tooltip.d.ts +24 -5
- package/dist/primitives/tooltip.js +32 -10
- package/dist/primitives/type-to-confirm-dialog.d.ts +1 -1
- package/dist/primitives/type-to-confirm-dialog.js +1 -1
- package/dist/session/composer/animated-placeholder.js +1 -1
- package/dist/session/composer/chat-input/chat-input-control.js +3 -3
- package/dist/session/composer/editor/composer-editor.js +1 -1
- package/dist/session/composer/menus/menu-shell.d.ts +1 -1
- package/dist/session/composer/menus/menu-shell.js +1 -1
- package/dist/session/composer/menus/mount.js +1 -1
- package/dist/session/composer/reasoning-effort-selector.js +1 -1
- package/dist/session/header/session-site-header.js +2 -2
- package/dist/session/header/subagent-hover-card.js +2 -2
- package/dist/session/media/image-preview.js +1 -1
- package/dist/session/models/model-selector.d.ts +1 -1
- package/dist/session/models/model-selector.js +18 -12
- package/dist/session/models/subscription-switcher.d.ts +37 -0
- package/dist/session/models/subscription-switcher.js +97 -0
- package/dist/session/models/subscription-windows.d.ts +40 -0
- package/dist/session/models/subscription-windows.js +86 -0
- package/dist/session/overrides/session-overrides-control.js +3 -3
- package/dist/session/panel/diff-dialog.js +1 -1
- package/dist/session/panel/easy/detail-view.js +3 -3
- package/dist/session/panel/mobile-tool-drawer.js +2 -2
- package/dist/session/panel/panel-fallback.js +1 -1
- package/dist/session/panel/session-files-explorer.d.ts +1 -1
- package/dist/session/panel/session-files-explorer.js +1 -1
- package/dist/session/thread/session-chat.js +2 -2
- package/dist/session/thread/session-context-message-explorer.js +1 -1
- package/dist/session/thread/turn-share.js +3 -4
- package/dist/session/tool/shared/show-helpers.js +1 -1
- package/dist/session/turn/message-time-label.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/test-utils/intl.d.ts +3 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/review-center.js +1 -1
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/session-brief-hover-card.d.ts +1 -1
- package/dist/workspace/sidebar/session-brief-hover-card.js +3 -3
- package/dist/workspace/sidebar/session-title.d.ts +2 -2
- package/dist/workspace/sidebar/session-title.js +2 -2
- package/dist/workspace/sidebar/workspace-menu-section.js +1 -1
- package/dist/workspace/spaces/space-links.js +1 -1
- package/dist/workspace/spaces/space-threads-tab.js +1 -1
- package/package.json +16 -35
- package/skills/kortix-ui/SKILL.md +1 -1
- package/skills/kortix-ui/references/custom-dashboard.md +1 -1
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
type DrawerDirection = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
+
export interface DrawerProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
/** The edge the drawer slides in from. Swiping back toward it dismisses the drawer. */
|
|
8
|
+
direction?: DrawerDirection;
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare function Drawer({ open, defaultOpen, onOpenChange, direction, modal, children, }: DrawerProps): React.JSX.Element;
|
|
13
|
+
type ButtonLikeProps = React.ComponentProps<'button'> & {
|
|
14
|
+
asChild?: boolean;
|
|
15
|
+
};
|
|
16
|
+
declare function DrawerTrigger({ asChild, children, ...props }: ButtonLikeProps): React.JSX.Element;
|
|
17
|
+
declare function DrawerPortal({ container, children, }: {
|
|
18
|
+
container?: HTMLElement | null;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
}): React.JSX.Element;
|
|
21
|
+
declare function DrawerClose({ asChild, children, ...props }: ButtonLikeProps): React.JSX.Element;
|
|
22
|
+
declare function DrawerOverlay({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
23
|
+
declare function DrawerContent({ className, children, bar, ...props }: React.ComponentProps<'div'> & {
|
|
9
24
|
bar?: boolean;
|
|
10
25
|
}): React.JSX.Element;
|
|
11
26
|
declare function DrawerHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
27
|
declare function DrawerFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
13
|
-
declare function DrawerTitle({ className, ...props }: React.ComponentProps<
|
|
14
|
-
|
|
28
|
+
declare function DrawerTitle({ className, asChild, children, ...props }: React.ComponentProps<'h2'> & {
|
|
29
|
+
asChild?: boolean;
|
|
30
|
+
}): React.JSX.Element;
|
|
31
|
+
declare function DrawerDescription({ className, asChild, children, ...props }: React.ComponentProps<'p'> & {
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
}): React.JSX.Element;
|
|
15
34
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, };
|
|
@@ -1,26 +1,50 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Drawer as DrawerPrimitive } from '
|
|
3
|
+
import { Drawer as DrawerPrimitive } from '@base-ui/react/drawer';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { asChildRender, composeRefs, openState, stateRender, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
4
6
|
import { usePortalContainer } from '../lib/portal-container.js';
|
|
5
7
|
import { cn } from '../lib/utils.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
8
|
+
const SWIPE = {
|
|
9
|
+
top: 'up',
|
|
10
|
+
bottom: 'down',
|
|
11
|
+
left: 'left',
|
|
12
|
+
right: 'right',
|
|
13
|
+
};
|
|
14
|
+
const DrawerDirectionContext = React.createContext('bottom');
|
|
15
|
+
function Drawer({ open, defaultOpen, onOpenChange, direction = 'bottom', modal, children, }) {
|
|
16
|
+
return (_jsx(DrawerDirectionContext.Provider, { value: direction, children: _jsx(DrawerPrimitive.Root, { "data-slot": "drawer", open: open, defaultOpen: defaultOpen, onOpenChange: onOpenChange ? (next) => onOpenChange(next) : undefined, swipeDirection: SWIPE[direction], modal: modal, children: children }) }));
|
|
17
|
+
}
|
|
18
|
+
function DrawerTrigger({ asChild, children, ...props }) {
|
|
19
|
+
const slot = asChildRender(asChild, children);
|
|
20
|
+
const native = useNativeButton(asChild, children);
|
|
21
|
+
return (_jsx(DrawerPrimitive.Trigger, { "data-slot": "drawer-trigger", ...props, ref: composeRefs(props.ref, native.ref), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
22
|
+
}
|
|
23
|
+
function DrawerPortal({ container, children, }) {
|
|
13
24
|
const scoped = usePortalContainer();
|
|
14
|
-
return _jsx(DrawerPrimitive.Portal, { "data-slot": "drawer-portal",
|
|
25
|
+
return (_jsx(DrawerPrimitive.Portal, { "data-slot": "drawer-portal", container: container ?? scoped, children: children }));
|
|
15
26
|
}
|
|
16
|
-
function DrawerClose({ ...props }) {
|
|
17
|
-
|
|
27
|
+
function DrawerClose({ asChild, children, ...props }) {
|
|
28
|
+
const slot = asChildRender(asChild, children);
|
|
29
|
+
const native = useNativeButton(asChild, children);
|
|
30
|
+
return (_jsx(DrawerPrimitive.Close, { "data-slot": "drawer-close", ...props, ref: composeRefs(props.ref, native.ref), render: slot.render, nativeButton: native.nativeButton, children: slot.children }));
|
|
18
31
|
}
|
|
19
32
|
function DrawerOverlay({ className, ...props }) {
|
|
20
|
-
return (_jsx(DrawerPrimitive.
|
|
21
|
-
}
|
|
33
|
+
return (_jsx(DrawerPrimitive.Backdrop, { "data-slot": "drawer-overlay", className: cn('duration-moderate fixed inset-0 z-50 bg-black/50 opacity-[calc(1-var(--drawer-swipe-progress,0))] transition-opacity ease-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-swiping:duration-0', className), render: stateRender('div', openState), ...props }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Slide-in per edge. The swipe offset Base UI writes while the drawer is
|
|
37
|
+
* dragged moves the panel with the finger.
|
|
38
|
+
*/
|
|
39
|
+
const DRAWER_MOTION = {
|
|
40
|
+
top: '[transform:translateY(var(--drawer-swipe-movement-y,0px))] data-starting-style:[transform:translateY(-100%)] data-ending-style:[transform:translateY(-100%)]',
|
|
41
|
+
bottom: '[transform:translateY(var(--drawer-swipe-movement-y,0px))] data-starting-style:[transform:translateY(100%)] data-ending-style:[transform:translateY(100%)]',
|
|
42
|
+
left: '[transform:translateX(var(--drawer-swipe-movement-x,0px))] data-starting-style:[transform:translateX(-100%)] data-ending-style:[transform:translateX(-100%)]',
|
|
43
|
+
right: '[transform:translateX(var(--drawer-swipe-movement-x,0px))] data-starting-style:[transform:translateX(100%)] data-ending-style:[transform:translateX(100%)]',
|
|
44
|
+
};
|
|
22
45
|
function DrawerContent({ className, children, bar = true, ...props }) {
|
|
23
|
-
|
|
46
|
+
const direction = React.useContext(DrawerDirectionContext);
|
|
47
|
+
return (_jsxs(DrawerPortal, { children: [_jsx(DrawerOverlay, {}), _jsx(DrawerPrimitive.Viewport, { className: "fixed inset-0 z-50", children: _jsxs(DrawerPrimitive.Popup, { "data-slot": "drawer-content", "data-vaul-drawer-direction": direction, className: cn('group/drawer-content bg-background duration-moderate fixed z-50 flex h-auto flex-col transition-transform ease-out outline-none data-swiping:duration-0 data-swiping:select-none', DRAWER_MOTION[direction], 'data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b', 'data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t', 'data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm', 'data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm', className), render: stateRender('div', openState), ...props, children: [bar && (_jsx("div", { className: "bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full group-data-[vaul-drawer-direction=bottom]/drawer-content:block" })), children] }) })] }));
|
|
24
48
|
}
|
|
25
49
|
function DrawerHeader({ className, ...props }) {
|
|
26
50
|
return (_jsx("div", { "data-slot": "drawer-header", className: cn('flex flex-col gap-1.5 p-4', className), ...props }));
|
|
@@ -28,10 +52,10 @@ function DrawerHeader({ className, ...props }) {
|
|
|
28
52
|
function DrawerFooter({ className, ...props }) {
|
|
29
53
|
return (_jsx("div", { "data-slot": "drawer-footer", className: cn('mt-auto flex flex-col gap-2 p-4', className), ...props }));
|
|
30
54
|
}
|
|
31
|
-
function DrawerTitle({ className, ...props }) {
|
|
32
|
-
return (_jsx(DrawerPrimitive.Title, { "data-slot": "drawer-title", className: cn('text-foreground font-semibold', className), ...props }));
|
|
55
|
+
function DrawerTitle({ className, asChild, children, ...props }) {
|
|
56
|
+
return (_jsx(DrawerPrimitive.Title, { "data-slot": "drawer-title", className: cn('text-foreground font-semibold', className), ...props, ...asChildRender(asChild, children) }));
|
|
33
57
|
}
|
|
34
|
-
function DrawerDescription({ className, ...props }) {
|
|
35
|
-
return (_jsx(DrawerPrimitive.Description, { "data-slot": "drawer-description", className: cn('text-muted-foreground text-sm', className), ...props }));
|
|
58
|
+
function DrawerDescription({ className, asChild, children, ...props }) {
|
|
59
|
+
return (_jsx(DrawerPrimitive.Description, { "data-slot": "drawer-description", className: cn('text-muted-foreground text-sm', className), ...props, ...asChildRender(asChild, children) }));
|
|
36
60
|
}
|
|
37
61
|
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, };
|
|
@@ -1,50 +1,72 @@
|
|
|
1
|
-
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import { type
|
|
2
|
+
import { MenuPortalPassthrough, MenuSub, type MenuRootProps } from './menu-base.js';
|
|
4
3
|
import { type TriggerVariantProps } from './trigger-variants.js';
|
|
5
|
-
declare
|
|
6
|
-
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<Omit<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
declare const
|
|
13
|
-
declare const
|
|
14
|
-
/**
|
|
15
|
-
* Takes the same `size` and `inset` props as `DropdownMenuItem`, because a
|
|
16
|
-
* submenu trigger is a row like any other and has to line up with its siblings.
|
|
17
|
-
*
|
|
18
|
-
* The caret is `size-3.5` against the leading icon's `size-4`: it is an
|
|
19
|
-
* affordance, not content, and matching the icon's weight makes it compete with
|
|
20
|
-
* the label. `text-muted-foreground` for the same reason.
|
|
21
|
-
*/
|
|
22
|
-
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
4
|
+
declare function DropdownMenu({ onOpenChange, dir: _dir, children, ...props }: MenuRootProps): React.JSX.Element;
|
|
5
|
+
declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & TriggerVariantProps & {
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const DropdownMenuGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const DropdownMenuPortal: typeof MenuPortalPassthrough;
|
|
10
|
+
declare const DropdownMenuSub: typeof MenuSub;
|
|
11
|
+
declare const DropdownMenuRadioGroup: React.ForwardRefExoticComponent<import("./menu-base.js").MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
declare const DropdownMenuSubTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
23
13
|
inset?: boolean;
|
|
24
|
-
size?: MenuRowSize;
|
|
14
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
textValue?: string;
|
|
17
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
18
|
+
declare const DropdownMenuSubContent: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "dir"> & import("../lib/base-ui-compat.js").LegacyPositionProps & import("../lib/base-ui-compat.js").DismissHandlers & {
|
|
19
|
+
asChild?: boolean;
|
|
20
|
+
forceMount?: true;
|
|
21
|
+
loop?: boolean;
|
|
22
|
+
container?: HTMLElement;
|
|
23
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
24
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
25
25
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
-
declare const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "dir"> & import("../lib/base-ui-compat.js").LegacyPositionProps & import("../lib/base-ui-compat.js").DismissHandlers & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
forceMount?: true;
|
|
29
|
+
loop?: boolean;
|
|
30
|
+
container?: HTMLElement;
|
|
31
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
32
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
29
33
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
-
declare const
|
|
31
|
-
|
|
34
|
+
declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
35
|
+
asChild?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
textValue?: string;
|
|
38
|
+
onSelect?: (event: Event) => void;
|
|
39
|
+
} & {
|
|
32
40
|
inset?: boolean;
|
|
33
41
|
variant?: "default" | "destructive";
|
|
34
|
-
size?: "
|
|
42
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
35
43
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
-
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<
|
|
44
|
+
declare const DropdownMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
textValue?: string;
|
|
48
|
+
onSelect?: (event: Event) => void;
|
|
49
|
+
}, "onChange"> & {
|
|
50
|
+
checked?: boolean | "indeterminate";
|
|
51
|
+
defaultChecked?: boolean;
|
|
52
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
37
53
|
reverse?: boolean;
|
|
38
|
-
size?: MenuRowSize;
|
|
54
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
39
55
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
-
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<
|
|
41
|
-
|
|
56
|
+
declare const DropdownMenuRadioItem: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
57
|
+
asChild?: boolean;
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
textValue?: string;
|
|
60
|
+
onSelect?: (event: Event) => void;
|
|
61
|
+
} & {
|
|
62
|
+
value: string;
|
|
63
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
42
64
|
side?: "left" | "right";
|
|
43
65
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
-
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<
|
|
66
|
+
declare const DropdownMenuLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
45
67
|
inset?: boolean;
|
|
46
68
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
47
|
-
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<
|
|
69
|
+
declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
48
70
|
declare const DropdownMenuShortcut: {
|
|
49
71
|
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
50
72
|
displayName: string;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import { withPortalContainer } from '../lib/portal-container.js';
|
|
4
|
-
import { cn } from '../lib/utils.js';
|
|
5
|
-
import { floatingZ, useDialogDepth } from '../lib/z-stack.js';
|
|
6
|
-
import { CheckIcon as Check, CaretRightIcon as ChevronRight } from '@phosphor-icons/react';
|
|
7
|
-
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
3
|
import * as React from 'react';
|
|
9
|
-
import {
|
|
4
|
+
import { asChildRender, composeRefs, openState, stateRender, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
5
|
+
import { cn } from '../lib/utils.js';
|
|
6
|
+
import { makeMenuCheckboxItem, makeMenuItem, makeMenuLabel, makeMenuRadioItem, makeMenuSeparator, makeMenuSubTrigger, MenuContentImpl, MenuGroup, MenuPortalPassthrough, MenuPrimitive, MenuRadioGroup, MenuSub, useMenuRoot, } from './menu-base.js';
|
|
7
|
+
import { MENU_PANEL_STATIC, MENU_SHORTCUT } from './menu-recipe.js';
|
|
10
8
|
import { triggerVariants } from './trigger-variants.js';
|
|
11
9
|
/**
|
|
12
10
|
* The row recipe, the panel and the label/separator/shortcut classes live in
|
|
@@ -19,9 +17,9 @@ import { triggerVariants } from './trigger-variants.js';
|
|
|
19
17
|
* itself lower.
|
|
20
18
|
*
|
|
21
19
|
* No enter/exit animation on the root panel or the submenu. The root panel
|
|
22
|
-
* used to `animate-in` (fade + `zoom-in-95` + a 2-unit slide, ~150ms).
|
|
23
|
-
*
|
|
24
|
-
*
|
|
20
|
+
* used to `animate-in` (fade + `zoom-in-95` + a 2-unit slide, ~150ms). The
|
|
21
|
+
* library kept the node mounted until `animate-out` fired `animationend`, so
|
|
22
|
+
* every open AND every close waited on the animation. People
|
|
25
23
|
* open these menus tens of times a day; the project sidebar's workspace
|
|
26
24
|
* switcher is the worst case. The motion read as the menu lagging behind the
|
|
27
25
|
* click, and it dropped frames under load. The panel now paints on the frame it
|
|
@@ -31,82 +29,48 @@ import { triggerVariants } from './trigger-variants.js';
|
|
|
31
29
|
* pointer's path, so the slide moved its rows away from the cursor.
|
|
32
30
|
*/
|
|
33
31
|
const DROPDOWN_PANEL = cn(MENU_PANEL_STATIC, 'min-w-[14rem] overflow-hidden');
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
DropdownMenuTrigger
|
|
39
|
-
const
|
|
32
|
+
function DropdownMenu({ onOpenChange, dir: _dir, children, ...props }) {
|
|
33
|
+
const root = useMenuRoot(onOpenChange);
|
|
34
|
+
return root.wrap(_jsx(MenuPrimitive.Root, { ...props, onOpenChange: root.onOpenChange, children: children }));
|
|
35
|
+
}
|
|
36
|
+
const DropdownMenuTrigger = React.forwardRef(({ className, variant, size, asChild, children, ...props }, ref) => {
|
|
37
|
+
const slot = asChildRender(asChild, children);
|
|
38
|
+
const native = useNativeButton(asChild, children);
|
|
39
|
+
return (_jsx(MenuPrimitive.Trigger, { ref: composeRefs(ref, native.ref), ...props,
|
|
40
|
+
// With `asChild` the child owns its styling — merging ours would double it.
|
|
41
|
+
className: asChild ? className : cn(triggerVariants({ variant, size }), className), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
42
|
+
});
|
|
43
|
+
DropdownMenuTrigger.displayName = 'DropdownMenuTrigger';
|
|
40
44
|
// No padding of its own: the panel's `p-1` is the only inset, so a grouped
|
|
41
45
|
// row is exactly as wide as an ungrouped one.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
*/
|
|
55
|
-
const DropdownMenuSubTrigger = React.forwardRef(({ className, inset, size = 'sm', children, ...props }, ref) => (_jsxs(DropdownMenuPrimitive.SubTrigger, { ref: ref, className: cn('group', menuRow(size, 'default'), inset && MENU_INSET, className), ...props, children: [children, _jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-3.5" })] })));
|
|
56
|
-
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive.SubTrigger.displayName;
|
|
57
|
-
const DropdownMenuSubContent = React.forwardRef(({ className, side: _side, align: _align, sideOffset = 5, style, ...props }, ref) => {
|
|
58
|
-
const depth = useDialogDepth();
|
|
59
|
-
return (_jsx(DropdownMenuPrimitive.SubContent, { ref: ref, sideOffset: sideOffset, className: cn(DROPDOWN_PANEL, className), style: { zIndex: floatingZ(depth), ...style }, ...props }));
|
|
46
|
+
const DropdownMenuGroup = MenuGroup;
|
|
47
|
+
const DropdownMenuPortal = MenuPortalPassthrough;
|
|
48
|
+
const DropdownMenuSub = MenuSub;
|
|
49
|
+
const DropdownMenuRadioGroup = MenuRadioGroup;
|
|
50
|
+
const DropdownMenuSubTrigger = makeMenuSubTrigger();
|
|
51
|
+
DropdownMenuSubTrigger.displayName = 'DropdownMenuSubTrigger';
|
|
52
|
+
const DropdownMenuSubContent = React.forwardRef(
|
|
53
|
+
// `side` and `align` are accepted and unused: a submenu opens on the inline
|
|
54
|
+
// edge of its trigger. They previously selected a `slide-in-from-*` class;
|
|
55
|
+
// that was the enter animation, which no dropdown panel has any more.
|
|
56
|
+
({ className, side: _side, align: _align, sideOffset = 5, ...props }, ref) => {
|
|
57
|
+
return (_jsx(MenuContentImpl, { ref: ref, Positioner: MenuPrimitive.Positioner, varName: "dropdown-menu", ...props, sideOffset: sideOffset, className: cn(DROPDOWN_PANEL, className) }));
|
|
60
58
|
});
|
|
61
|
-
DropdownMenuSubContent.displayName =
|
|
62
|
-
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4,
|
|
63
|
-
|
|
64
|
-
return (_jsx(DropdownMenuPortal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn(DROPDOWN_PANEL, className), style: { zIndex: floatingZ(depth), ...style }, ...props }) }));
|
|
65
|
-
});
|
|
66
|
-
DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
|
|
67
|
-
const DropdownMenuItem = React.forwardRef(({ className, inset, variant = 'default', size = 'sm', ...props }, ref) => (_jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn(menuRow(size, variant), inset && MENU_INSET, className), ...props })));
|
|
68
|
-
DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
|
|
69
|
-
const DropdownMenuCheckboxItem = React.forwardRef(({ className, children, checked, reverse, size = 'sm', ...props }, ref) => (_jsxs(DropdownMenuPrimitive.CheckboxItem, { ref: ref,
|
|
70
|
-
// The check sits in the row's leading slot (absolute, so an unchecked row
|
|
71
|
-
// keeps the same label x as a checked one) and the label starts at
|
|
72
|
-
// `MENU_INSET` — the same x as an `inset` item or an icon row's label.
|
|
73
|
-
className: cn(menuRow(size, 'default'), reverse ? MENU_INSET_END : MENU_INSET, className), checked: checked, ...props, children: [_jsx("span", { className: cn(MENU_INDICATOR, 'absolute', reverse ? 'right-2' : 'left-2'), children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }), children] })));
|
|
74
|
-
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive.CheckboxItem.displayName;
|
|
75
|
-
/**
|
|
76
|
-
* The label column of a radio row.
|
|
77
|
-
*
|
|
78
|
-
* `flex-1` is what pushes the check to the row's far edge — but the span used
|
|
79
|
-
* to stop there, i.e. it was a BLOCK. Tailwind's Preflight sets
|
|
80
|
-
* `svg { display: block }`, so any radio row with a leading icon rendered the
|
|
81
|
-
* icon on its own line above the label. Every other row component
|
|
82
|
-
* (`Item`, `CheckboxItem`, `SubTrigger`) escapes this because `MENU_ROW_BASE`
|
|
83
|
-
* makes the row itself the flex container and their children are direct
|
|
84
|
-
* children of it; only `RadioItem` interposes this wrapper.
|
|
85
|
-
*
|
|
86
|
-
* Two consumers had already worked around it by hand-wrapping their children
|
|
87
|
-
* in exactly this class (`user-menu-shared.tsx`, `reasoning-effort-selector.tsx`)
|
|
88
|
-
* — the workaround is now the component's job. `gap-2` matches `MENU_ROW_BASE`
|
|
89
|
-
* so an icon+label pair is spaced identically whichever row type holds it.
|
|
90
|
-
*/
|
|
91
|
-
const RADIO_LABEL = 'flex min-w-0 flex-1 items-center gap-2';
|
|
92
|
-
const DropdownMenuRadioItem = React.forwardRef(({ className, children, size = 'sm', side = 'right', ...props }, ref) => {
|
|
93
|
-
/**
|
|
94
|
-
* A check, not a dot, and the same check `DropdownMenuCheckboxItem` uses.
|
|
95
|
-
*
|
|
96
|
-
* This was `<Circle className="h-2 w-2 fill-current" />`, which could not
|
|
97
|
-
* work: Phosphor's CircleIcon is a stroked outline, so `fill-current` painted
|
|
98
|
-
* nothing, and `MENU_ROW_BASE`'s `[&_svg]:size-4` — a descendant selector —
|
|
99
|
-
* outranked the `h-2 w-2` sitting on the icon itself. The mark rendered as a
|
|
100
|
-
* hollow ring. No consumer had ever rendered a RadioItem, so nobody saw it.
|
|
101
|
-
*/
|
|
102
|
-
const indicator = (_jsx("span", { className: MENU_INDICATOR, children: _jsx(DropdownMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }));
|
|
103
|
-
return (_jsx(DropdownMenuPrimitive.RadioItem, { ref: ref, className: cn(menuRow(size, 'default'), className), ...props, children: side === 'left' ? (_jsxs(_Fragment, { children: [indicator, _jsx("span", { className: RADIO_LABEL, children: children })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: RADIO_LABEL, children: children }), indicator] })) }));
|
|
59
|
+
DropdownMenuSubContent.displayName = 'DropdownMenuSubContent';
|
|
60
|
+
const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
61
|
+
return (_jsx(MenuContentImpl, { ref: ref, Positioner: MenuPrimitive.Positioner, varName: "dropdown-menu", ...props, sideOffset: sideOffset, className: cn(DROPDOWN_PANEL, className) }));
|
|
104
62
|
});
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
63
|
+
DropdownMenuContent.displayName = 'DropdownMenuContent';
|
|
64
|
+
const DropdownMenuItem = makeMenuItem();
|
|
65
|
+
DropdownMenuItem.displayName = 'DropdownMenuItem';
|
|
66
|
+
const DropdownMenuCheckboxItem = makeMenuCheckboxItem();
|
|
67
|
+
DropdownMenuCheckboxItem.displayName = 'DropdownMenuCheckboxItem';
|
|
68
|
+
const DropdownMenuRadioItem = makeMenuRadioItem();
|
|
69
|
+
DropdownMenuRadioItem.displayName = 'DropdownMenuRadioItem';
|
|
70
|
+
const DropdownMenuLabel = makeMenuLabel();
|
|
71
|
+
DropdownMenuLabel.displayName = 'DropdownMenuLabel';
|
|
72
|
+
const DropdownMenuSeparator = makeMenuSeparator();
|
|
73
|
+
DropdownMenuSeparator.displayName = 'DropdownMenuSeparator';
|
|
110
74
|
const DropdownMenuShortcut = ({ className, ...props }) => {
|
|
111
75
|
return _jsx("span", { className: cn(MENU_SHORTCUT, className), ...props });
|
|
112
76
|
};
|
|
@@ -59,7 +59,8 @@ export const FadedScrollArea = React.forwardRef(function FadedScrollArea({ child
|
|
|
59
59
|
ro.observe(el);
|
|
60
60
|
el.addEventListener('scroll', updateScrollFades, { passive: true });
|
|
61
61
|
window.addEventListener('resize', updateScrollFades);
|
|
62
|
-
//
|
|
62
|
+
// Stop wheel/touch events here, so a scroll lock listening on an ancestor
|
|
63
|
+
// layer (a dialog or modal) cannot cancel them.
|
|
63
64
|
const stopScrollLockCapture = (e) => e.stopPropagation();
|
|
64
65
|
el.addEventListener('wheel', stopScrollLockCapture, { passive: false });
|
|
65
66
|
el.addEventListener('touchmove', stopScrollLockCapture, { passive: false });
|
package/dist/primitives/hint.js
CHANGED
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './tooltip.js';
|
|
3
3
|
const Hint = ({ label, children, className, side = 'right', align = 'center', sideOffset = 10, alignOffset = 10, content, ...props }) => {
|
|
4
4
|
return (
|
|
5
|
-
// Own provider, same 300ms delay as the app root's:
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// Own provider, same 300ms delay as the app root's: Hint rides along into
|
|
6
|
+
// trees rendered outside the app shell (SSR tests, portals), where the
|
|
7
|
+
// tooltip default (700ms) would apply. Nesting under the root provider is
|
|
8
8
|
// supported and harmless.
|
|
9
9
|
_jsx(TooltipProvider, { delayDuration: 300, children: _jsxs(Tooltip, { ...props, children: [_jsx(TooltipTrigger, { asChild: true, children: children }), _jsx(TooltipContent, { side: side, align: align, sideOffset: sideOffset, alignOffset: alignOffset, className: className, children: label ? label : content })] }) }));
|
|
10
10
|
};
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import { HoverCard as HoverCardPrimitive } from 'radix-ui';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { type DismissHandlers, type LegacyPositionProps } from '../lib/base-ui-compat.js';
|
|
3
|
+
export interface HoverCardProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
onOpenChange?: (open: boolean) => void;
|
|
7
|
+
openDelay?: number;
|
|
8
|
+
closeDelay?: number;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function HoverCard({ open, defaultOpen, onOpenChange, openDelay, closeDelay, children, }: HoverCardProps): React.JSX.Element;
|
|
12
|
+
declare function HoverCardTrigger({ asChild, children, ...props }: React.ComponentProps<'a'> & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
}): React.JSX.Element;
|
|
5
15
|
/**
|
|
6
16
|
* The fifth panel to join `FLOATING_PANEL`.
|
|
7
17
|
*
|
|
@@ -13,7 +23,7 @@ declare function HoverCardTrigger({ ...props }: React.ComponentProps<typeof Hove
|
|
|
13
23
|
* its call site. The recipe owns the surface and the enter/exit now.
|
|
14
24
|
*
|
|
15
25
|
* Two things stay local because they are this primitive's own: the transform
|
|
16
|
-
* origin (the
|
|
26
|
+
* origin (the variable is named per primitive) and the `motion-reduce`
|
|
17
27
|
* guard, which no other panel ships and which must survive the move.
|
|
18
28
|
*
|
|
19
29
|
* `animated={false}` takes `FLOATING_PANEL_SURFACE` instead, the same split
|
|
@@ -22,7 +32,9 @@ declare function HoverCardTrigger({ ...props }: React.ComponentProps<typeof Hove
|
|
|
22
32
|
* animation moving content away from the cursor, which reads as the card
|
|
23
33
|
* lagging behind the hand rather than as polish.
|
|
24
34
|
*/
|
|
25
|
-
declare function HoverCardContent({ className, align, sideOffset, animated, style, ...
|
|
35
|
+
declare function HoverCardContent({ className, align, sideOffset, animated, style, asChild, forceMount, children, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, ...rest }: React.ComponentProps<'div'> & LegacyPositionProps & DismissHandlers & {
|
|
26
36
|
animated?: boolean;
|
|
37
|
+
asChild?: boolean;
|
|
38
|
+
forceMount?: true;
|
|
27
39
|
}): React.JSX.Element;
|
|
28
40
|
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
@@ -1,16 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { PreviewCard as HoverCardPrimitive } from '@base-ui/react/preview-card';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { asChildRender, openState, radixPositionVars, splitPosition, stateRender, useDismissRoot, FLOATING_LAYER_ATTR, } from '../lib/base-ui-compat.js';
|
|
4
6
|
import { withPortalContainer } from '../lib/portal-container.js';
|
|
5
7
|
import { cn } from '../lib/utils.js';
|
|
6
8
|
import { floatingZ, useDialogDepth } from '../lib/z-stack.js';
|
|
7
9
|
import { FLOATING_PANEL, FLOATING_PANEL_SURFACE } from './menu-recipe.js';
|
|
8
10
|
const HoverCardPortal = withPortalContainer(HoverCardPrimitive.Portal);
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
// Radix's defaults, kept so an unconfigured card opens and closes as it did.
|
|
12
|
+
const DEFAULT_OPEN_DELAY = 700;
|
|
13
|
+
const DEFAULT_CLOSE_DELAY = 300;
|
|
14
|
+
/**
|
|
15
|
+
* The card's own context: its delays and its dismiss registry. Its own, not
|
|
16
|
+
* the shared `DismissProvider`, so a content rendered inside a nested root of
|
|
17
|
+
* another kind still reaches this card.
|
|
18
|
+
*/
|
|
19
|
+
const HoverCardContext = React.createContext({
|
|
20
|
+
openDelay: DEFAULT_OPEN_DELAY,
|
|
21
|
+
closeDelay: DEFAULT_CLOSE_DELAY,
|
|
22
|
+
dismiss: null,
|
|
23
|
+
});
|
|
24
|
+
function HoverCard({ open, defaultOpen, onOpenChange, openDelay = DEFAULT_OPEN_DELAY, closeDelay = DEFAULT_CLOSE_DELAY, children, }) {
|
|
25
|
+
const dismiss = useDismissRoot(onOpenChange);
|
|
26
|
+
const registry = dismiss.registry;
|
|
27
|
+
const value = React.useMemo(() => ({ openDelay, closeDelay, dismiss: registry }), [openDelay, closeDelay, registry]);
|
|
28
|
+
return (_jsx(HoverCardContext.Provider, { value: value, children: _jsx(HoverCardPrimitive.Root, { "data-slot": "hover-card", open: open, defaultOpen: defaultOpen, onOpenChange: dismiss.onOpenChange, children: children }) }));
|
|
11
29
|
}
|
|
12
|
-
function HoverCardTrigger({ ...props }) {
|
|
13
|
-
|
|
30
|
+
function HoverCardTrigger({ asChild, children, ...props }) {
|
|
31
|
+
const { openDelay, closeDelay } = React.useContext(HoverCardContext);
|
|
32
|
+
const slot = asChildRender(asChild, children);
|
|
33
|
+
return (_jsx(HoverCardPrimitive.Trigger, { "data-slot": "hover-card-trigger", delay: openDelay, closeDelay: closeDelay, ...props, render: stateRender('a', openState, slot.render), children: slot.children }));
|
|
14
34
|
}
|
|
15
35
|
/**
|
|
16
36
|
* The fifth panel to join `FLOATING_PANEL`.
|
|
@@ -23,7 +43,7 @@ function HoverCardTrigger({ ...props }) {
|
|
|
23
43
|
* its call site. The recipe owns the surface and the enter/exit now.
|
|
24
44
|
*
|
|
25
45
|
* Two things stay local because they are this primitive's own: the transform
|
|
26
|
-
* origin (the
|
|
46
|
+
* origin (the variable is named per primitive) and the `motion-reduce`
|
|
27
47
|
* guard, which no other panel ships and which must survive the move.
|
|
28
48
|
*
|
|
29
49
|
* `animated={false}` takes `FLOATING_PANEL_SURFACE` instead, the same split
|
|
@@ -32,9 +52,26 @@ function HoverCardTrigger({ ...props }) {
|
|
|
32
52
|
* animation moving content away from the cursor, which reads as the card
|
|
33
53
|
* lagging behind the hand rather than as polish.
|
|
34
54
|
*/
|
|
35
|
-
function HoverCardContent({ className, align = 'center', sideOffset = 4, animated = true, style, ...
|
|
55
|
+
function HoverCardContent({ className, align = 'center', sideOffset = 4, animated = true, style, asChild, forceMount, children, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, ...rest }) {
|
|
36
56
|
// Inside a dialog the card stacks above it, as a popover does (`floatingZ`).
|
|
37
57
|
const depth = useDialogDepth();
|
|
38
|
-
|
|
58
|
+
const { dismiss } = React.useContext(HoverCardContext);
|
|
59
|
+
React.useLayoutEffect(() => {
|
|
60
|
+
if (dismiss) {
|
|
61
|
+
dismiss.current = {
|
|
62
|
+
onEscapeKeyDown,
|
|
63
|
+
onPointerDownOutside,
|
|
64
|
+
onFocusOutside,
|
|
65
|
+
onInteractOutside,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const { positioner, rest: props } = splitPosition({
|
|
70
|
+
align,
|
|
71
|
+
sideOffset,
|
|
72
|
+
...rest,
|
|
73
|
+
});
|
|
74
|
+
const slot = asChildRender(asChild, children);
|
|
75
|
+
return (_jsx(HoverCardPortal, { "data-slot": "hover-card-portal", keepMounted: forceMount, children: _jsx(HoverCardPrimitive.Positioner, { ...positioner, ...FLOATING_LAYER_ATTR, style: { zIndex: floatingZ(depth) }, children: _jsx(HoverCardPrimitive.Popup, { "data-slot": "hover-card-content", className: cn(animated ? FLOATING_PANEL : FLOATING_PANEL_SURFACE, 'w-64 origin-(--radix-hover-card-content-transform-origin) p-4 outline-hidden motion-reduce:animate-none motion-reduce:transition-none', className), style: { ...radixPositionVars('hover-card'), ...style }, ...props, render: stateRender('div', openState, slot.render), children: slot.children }) }) }));
|
|
39
76
|
}
|
|
40
77
|
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
package/dist/primitives/item.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
|
-
import { Slot } from '
|
|
3
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
4
4
|
import { Separator } from './separator.js';
|
|
5
5
|
import { cn } from '../lib/utils.js';
|
|
6
6
|
function ItemGroup({ className, ...props }) {
|
|
@@ -28,7 +28,7 @@ const itemVariants = cva('group/item flex flex-wrap items-center rounded-md bord
|
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
30
|
function Item({ className, variant = 'default', size = 'default', asChild = false, ...props }) {
|
|
31
|
-
const Comp = asChild ? Slot
|
|
31
|
+
const Comp = asChild ? Slot : 'div';
|
|
32
32
|
return (_jsx(Comp, { "data-slot": "item", "data-variant": variant, "data-size": size, className: cn(itemVariants({ variant, size, className })), ...props }));
|
|
33
33
|
}
|
|
34
34
|
const itemMediaVariants = cva('flex shrink-0 items-center justify-center gap-2 group-has-[[data-slot=item-description]]/item:translate-y-0.5 group-has-[[data-slot=item-description]]/item:self-start [&_svg]:pointer-events-none', {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
|
|
2
|
+
type LabelProps = React.ComponentProps<'label'> & {
|
|
3
|
+
asChild?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare function Label({ className, asChild, onMouseDown, ...props }: LabelProps): React.JSX.Element;
|
|
4
6
|
export { Label };
|
|
7
|
+
export type { LabelProps };
|
package/dist/primitives/label.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Slot } from '../lib/base-ui-compat.js';
|
|
4
4
|
import { cn } from '../lib/utils.js';
|
|
5
|
-
function Label({ className, ...props }) {
|
|
6
|
-
|
|
5
|
+
function Label({ className, asChild, onMouseDown, ...props }) {
|
|
6
|
+
const Comp = (asChild ? Slot : 'label');
|
|
7
|
+
return (_jsx(Comp, { "data-slot": "label",
|
|
8
|
+
// Radix Label: a double click on the label does not select its text.
|
|
9
|
+
onMouseDown: (event) => {
|
|
10
|
+
onMouseDown?.(event);
|
|
11
|
+
if (!event.defaultPrevented && event.detail > 1)
|
|
12
|
+
event.preventDefault();
|
|
13
|
+
}, className: cn('text-muted-foreground flex cursor-pointer items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-default peer-disabled:opacity-50', // cursor-default: disabled keeps the default cursor (AGENTS.md → States)
|
|
7
14
|
className), ...props }));
|
|
8
15
|
}
|
|
9
16
|
export { Label };
|