@kortix/ui 0.15.6 → 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/providers/provider-accordion.js +3 -2
- package/dist/customize/providers/provider-connect.d.ts +7 -0
- package/dist/customize/providers/provider-connect.js +21 -2
- package/dist/customize/providers/provider-sheet.js +3 -2
- package/dist/customize/sections/gateway-view.d.ts +2 -2
- package/dist/customize/sections/gateway-view.js +30 -15
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.d.ts +3 -1
- package/dist/customize/sections/llm-provider/chatgpt-subscription-connect.js +2 -2
- package/dist/customize/sections/view/account-secret-resources-panel.js +8 -5
- 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/review-center-connected.js +15 -3
- package/dist/customize/sections/view/subscription-usage.d.ts +269 -17
- package/dist/customize/sections/view/subscription-usage.js +197 -54
- 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 +40 -47
- package/dist/i18n/en.js +47 -54
- package/dist/i18n/ui-catalog/app-registry-translation-keys.generated.js +5 -0
- 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/auth/auth-primitives.d.ts +27 -0
- package/dist/internal/auth/auth-primitives.js +21 -0
- package/dist/internal/billing/index.d.ts +1 -0
- package/dist/internal/billing/index.js +2 -0
- package/dist/internal/billing/use-free-grant-unspent.d.ts +10 -0
- package/dist/internal/billing/use-free-grant-unspent.js +20 -0
- package/dist/internal/components/agent-mark.d.ts +1 -8
- package/dist/internal/components/agent-mark.js +2 -19
- package/dist/internal/lib/billing/billing-gate-state.d.ts +20 -0
- package/dist/internal/lib/billing/billing-gate-state.js +22 -0
- package/dist/internal/lib/error-handler.js +0 -2
- 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/notifications/notification-inbox.js +1 -1
- 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/upgrade-dialog-store.d.ts +0 -2
- package/dist/internal/stores/upgrade-dialog-store.js +0 -2
- 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/markdown/setup-links/approval-decision.d.ts +1 -1
- package/dist/markdown/setup-links/approval-decision.js +1 -1
- 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/prompts/ask-deck.d.ts +14 -2
- package/dist/session/prompts/ask-deck.js +6 -2
- 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 +40 -47
- package/dist/workspace/admin/settings-search.js +4 -12
- package/dist/workspace/inbox/workspace-inbox.js +11 -2
- package/dist/workspace/layout/new-session-create.d.ts +4 -2
- package/dist/workspace/layout/new-session-create.js +11 -0
- package/dist/workspace/projects/modal/project-icon-field.js +9 -23
- package/dist/workspace/review/approval-modal.d.ts +6 -6
- package/dist/workspace/review/approval-modal.js +10 -14
- package/dist/workspace/review/review-center.d.ts +9 -2
- package/dist/workspace/review/review-center.js +258 -126
- package/dist/workspace/review/review-detail.d.ts +20 -10
- package/dist/workspace/review/review-detail.js +39 -44
- package/dist/workspace/review/review-meta.d.ts +27 -6
- package/dist/workspace/review/review-meta.js +46 -34
- package/dist/workspace/sessions/session-row.js +1 -1
- package/dist/workspace/sidebar/footer/project-download-app-nav.d.ts +10 -0
- package/dist/workspace/sidebar/footer/project-download-app-nav.js +53 -0
- package/dist/workspace/sidebar/footer/promo-nav-row.d.ts +2 -1
- package/dist/workspace/sidebar/footer/promo-nav-row.js +1 -1
- package/dist/workspace/sidebar/project-session-list.js +2 -2
- package/dist/workspace/sidebar/project-sidebar.d.ts +6 -1
- package/dist/workspace/sidebar/project-sidebar.js +3 -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-model.d.ts +19 -13
- package/dist/workspace/sidebar/workspace-menu-model.js +7 -8
- 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
- package/dist/customize/sections/view/subscription-usage-tab.d.ts +0 -25
- package/dist/customize/sections/view/subscription-usage-tab.js +0 -121
|
@@ -1,11 +1,43 @@
|
|
|
1
|
-
import { Command as CommandPrimitive } from 'cmdk';
|
|
2
1
|
import * as React from 'react';
|
|
2
|
+
import { useCommandState } from './command-core.js';
|
|
3
3
|
import { Dialog } from './dialog.js';
|
|
4
|
+
/** The headless cmdk-compatible parts (`./command-core`), named as cmdk names them. */
|
|
5
|
+
declare const CommandPrimitive: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
label?: string;
|
|
7
|
+
shouldFilter?: boolean;
|
|
8
|
+
filter?: (value: string, search: string) => number;
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
value?: string;
|
|
11
|
+
onValueChange?: (value: string) => void;
|
|
12
|
+
loop?: boolean;
|
|
13
|
+
vimBindings?: boolean;
|
|
14
|
+
} & React.RefAttributes<HTMLDivElement>> & {
|
|
15
|
+
Input: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "type" | "value"> & {
|
|
16
|
+
value?: string;
|
|
17
|
+
onValueChange?: (search: string) => void;
|
|
18
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
+
List: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
Empty: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
|
|
21
|
+
Group: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "heading"> & {
|
|
22
|
+
heading?: React.ReactNode;
|
|
23
|
+
value?: string;
|
|
24
|
+
forceMount?: boolean;
|
|
25
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
Separator: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
27
|
+
alwaysRender?: boolean;
|
|
28
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
Item: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect" | "disabled" | "value"> & {
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
onSelect?: (value: string) => void;
|
|
32
|
+
value?: string;
|
|
33
|
+
forceMount?: boolean;
|
|
34
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
35
|
+
};
|
|
4
36
|
/**
|
|
5
37
|
* `data-nav` records which input moved the highlight last: `pointer` or
|
|
6
38
|
* `keyboard`. `CommandItem` reads it to pick ONE highlight source.
|
|
7
39
|
*
|
|
8
|
-
* cmdk 0.2.1 selects a row on every `pointermove` through its store, so
|
|
40
|
+
* The command core (cmdk 0.2.1) selects a row on every `pointermove` through its store, so
|
|
9
41
|
* `data-selected` moves only after React re-renders the whole list. In the ⌘K
|
|
10
42
|
* palette that re-render trails the cursor: the row you left stays lit until
|
|
11
43
|
* it lands, which reads as a hover transition. In pointer mode the row paints
|
|
@@ -44,7 +76,9 @@ declare function CommandPopover({ open, onOpenChange, children, modal, }: {
|
|
|
44
76
|
children: React.ReactNode;
|
|
45
77
|
modal?: boolean;
|
|
46
78
|
}): React.JSX.Element;
|
|
47
|
-
declare const CommandPopoverTrigger: React.ForwardRefExoticComponent<Omit<Omit<Omit<
|
|
79
|
+
declare const CommandPopoverTrigger: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "size"> & import("./trigger-variants.js").TriggerVariantProps & {
|
|
80
|
+
asChild?: boolean;
|
|
81
|
+
}, "ref">, "asChild"> & React.RefAttributes<HTMLButtonElement>>;
|
|
48
82
|
declare function CommandPopoverContent({ children, side, align, sideOffset, className, shouldFilter, defaultValue, }: {
|
|
49
83
|
children: React.ReactNode;
|
|
50
84
|
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
@@ -55,4 +89,4 @@ declare function CommandPopoverContent({ children, side, align, sideOffset, clas
|
|
|
55
89
|
/** The item value highlighted when the list opens (cmdk `defaultValue`). */
|
|
56
90
|
defaultValue?: string;
|
|
57
91
|
}): React.JSX.Element;
|
|
58
|
-
export { Command, CommandDialog, CommandEmpty, CommandFooter, CommandGroup, CommandInput, CommandItem, CommandList, CommandPopover, CommandPopoverContent, CommandPopoverTrigger, CommandSeparator, CommandShortcut, };
|
|
92
|
+
export { Command, CommandDialog, CommandEmpty, CommandFooter, CommandGroup, CommandInput, CommandItem, CommandList, CommandPopover, CommandPopoverContent, CommandPopoverTrigger, CommandSeparator, CommandShortcut, useCommandState, };
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Command as CommandPrimitive } from 'cmdk';
|
|
4
|
-
import { useUiStrings } from '../providers/ui-provider.js';
|
|
5
3
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useUiStrings } from '../providers/ui-provider.js';
|
|
5
|
+
import { CommandEmptyCore, CommandGroupCore, CommandInputCore, CommandItemCore, CommandListCore, CommandRoot, CommandSeparatorCore, useCommandState, } from './command-core.js';
|
|
8
6
|
import { cn } from '../lib/utils.js';
|
|
7
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './dialog.js';
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from './popover.js';
|
|
9
|
+
/** The headless cmdk-compatible parts (`./command-core`), named as cmdk names them. */
|
|
10
|
+
const CommandPrimitive = Object.assign(CommandRoot, {
|
|
11
|
+
Input: CommandInputCore,
|
|
12
|
+
List: CommandListCore,
|
|
13
|
+
Empty: CommandEmptyCore,
|
|
14
|
+
Group: CommandGroupCore,
|
|
15
|
+
Separator: CommandSeparatorCore,
|
|
16
|
+
Item: CommandItemCore,
|
|
17
|
+
});
|
|
9
18
|
const CMDK_SHARED_CLASSES = [
|
|
10
19
|
'[&_[cmdk-group]]:px-1.5',
|
|
11
20
|
'[&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0',
|
|
@@ -14,7 +23,7 @@ const CMDK_SHARED_CLASSES = [
|
|
|
14
23
|
* `data-nav` records which input moved the highlight last: `pointer` or
|
|
15
24
|
* `keyboard`. `CommandItem` reads it to pick ONE highlight source.
|
|
16
25
|
*
|
|
17
|
-
* cmdk 0.2.1 selects a row on every `pointermove` through its store, so
|
|
26
|
+
* The command core (cmdk 0.2.1) selects a row on every `pointermove` through its store, so
|
|
18
27
|
* `data-selected` moves only after React re-renders the whole list. In the ⌘K
|
|
19
28
|
* palette that re-render trails the cursor: the row you left stays lit until
|
|
20
29
|
* it lands, which reads as a hover transition. In pointer mode the row paints
|
|
@@ -44,10 +53,10 @@ function CommandDialog({ title, description, children, className, showCloseButto
|
|
|
44
53
|
// `data-[state=closed]:animate-none!` on the panel AND the overlay: the
|
|
45
54
|
// palette closes on the frame you dismiss it, with no exit animation.
|
|
46
55
|
// `DialogContent` and `DialogOverlay` both play a 200ms `animate-out`
|
|
47
|
-
// (fade, plus a zoom to 95% on the panel), and
|
|
48
|
-
// node mounted until
|
|
56
|
+
// (fade, plus a zoom to 95% on the panel), and the dialog keeps the
|
|
57
|
+
// node mounted until the animation ends — so Escape, a selected command,
|
|
49
58
|
// or an outside click left the palette on screen for 200ms after it
|
|
50
|
-
// was done. With `animation-name: none`,
|
|
59
|
+
// was done. With `animation-name: none`, it unmounts at once.
|
|
51
60
|
// `!` because tailwind-merge does not know `animate-out` (it comes from
|
|
52
61
|
// tw-animate-css) and keeps both classes; without it, the winner would
|
|
53
62
|
// be whichever utility Tailwind happens to emit last.
|
|
@@ -60,10 +69,10 @@ function CommandDialog({ title, description, children, className, showCloseButto
|
|
|
60
69
|
// `data-[state=closed]:animate-none!` on the panel AND the overlay: the
|
|
61
70
|
// palette closes on the frame you dismiss it, with no exit animation.
|
|
62
71
|
// `DialogContent` and `DialogOverlay` both play a 200ms `animate-out`
|
|
63
|
-
// (fade, plus a zoom to 95% on the panel), and
|
|
64
|
-
// node mounted until
|
|
72
|
+
// (fade, plus a zoom to 95% on the panel), and the dialog keeps the
|
|
73
|
+
// node mounted until the animation ends — so Escape, a selected command,
|
|
65
74
|
// or an outside click left the palette on screen for 200ms after it
|
|
66
|
-
// was done. With `animation-name: none`,
|
|
75
|
+
// was done. With `animation-name: none`, it unmounts at once.
|
|
67
76
|
// `!` because tailwind-merge does not know `animate-out` (it comes from
|
|
68
77
|
// tw-animate-css) and keeps both classes; without it, the winner would
|
|
69
78
|
// be whichever utility Tailwind happens to emit last.
|
|
@@ -72,7 +81,7 @@ function CommandDialog({ title, description, children, className, showCloseButto
|
|
|
72
81
|
// stock 200ms fade + zoom from 95% made ⌘K — opened dozens of times a
|
|
73
82
|
// day, almost always from the keyboard — read as late and as growing
|
|
74
83
|
// out of the page. The palette now paints complete on the first frame.
|
|
75
|
-
className: cn('p-0 shadow-[0_0_50px_0] shadow-black/10 data-[state=
|
|
84
|
+
className: cn('border p-0 shadow-[0_0_50px_0] shadow-black/10 data-[state=closed]:animate-none! data-[state=open]:animate-none!', className), hideCloseButton: !showCloseButton, overlayClassName: "bg-black/20 backdrop-blur-[1px] data-[state=open]:animate-none! data-[state=closed]:animate-none!", children: _jsx(Command, { loop: true, className: "[&_[cmdk-group-heading]]:text-muted-foreground bg-popover **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12", children: children }) })] }));
|
|
76
85
|
}
|
|
77
86
|
function CommandInput({ className, compact, leftElement, rightElement, ...props }) {
|
|
78
87
|
return (_jsxs("div", { "data-slot": "command-input-wrapper", className: cn('border-border flex items-center border-b', compact ? 'h-11 gap-2.5 px-4' : 'h-10 gap-3 px-4'), children: [leftElement, _jsx(CommandPrimitive.Input, { "data-slot": "command-input", className: cn('placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', compact ? 'h-11' : 'h-10', className), ...props }), rightElement] }));
|
|
@@ -132,4 +141,4 @@ const CommandPopoverTrigger = React.forwardRef(function CommandPopoverTrigger({
|
|
|
132
141
|
function CommandPopoverContent({ children, side = 'top', align = 'start', sideOffset = 8, className, shouldFilter = false, defaultValue, }) {
|
|
133
142
|
return (_jsx(PopoverContent, { side: side, align: align, sideOffset: sideOffset, className: cn('bg-sidebar text-sidebar-foreground hover:text-foreground relative w-[300px] overflow-hidden rounded-lg border p-0 shadow-xs ease-out', 'border-border', 'data-[state=closed]:duration-[140ms] data-[state=open]:duration-[180ms]', 'data-[state=open]:zoom-in-[0.97] data-[state=closed]:zoom-out-[0.97]', '[&_[data-slot=command-input-wrapper]]:h-9 [&_[data-slot=command-input-wrapper]]:gap-2 [&_[data-slot=command-input-wrapper]]:px-3', '[&_[data-slot=command-input]]:h-9 [&_[data-slot=command-input]]:text-sm', '[&_[data-slot=command-list]]:py-0', '[&_[data-slot=command-group]]:py-1', '[&_[cmdk-group-heading]]:!px-2 [&_[cmdk-group-heading]]:!pt-2 [&_[cmdk-group-heading]]:!pb-1 [&_[cmdk-group-heading]]:!text-xs [&_[cmdk-group-heading]]:!tracking-[0.12em]', className), children: _jsx(Command, { shouldFilter: shouldFilter, defaultValue: defaultValue, className: CMDK_SHARED_CLASSES, children: children }) }));
|
|
134
143
|
}
|
|
135
|
-
export { Command, CommandDialog, CommandEmpty, CommandFooter, CommandGroup, CommandInput, CommandItem, CommandList, CommandPopover, CommandPopoverContent, CommandPopoverTrigger, CommandSeparator, CommandShortcut, };
|
|
144
|
+
export { Command, CommandDialog, CommandEmpty, CommandFooter, CommandGroup, CommandInput, CommandItem, CommandList, CommandPopover, CommandPopoverContent, CommandPopoverTrigger, CommandSeparator, CommandShortcut, useCommandState, };
|
|
@@ -1,46 +1,76 @@
|
|
|
1
|
-
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
2
1
|
import * as React from 'react';
|
|
3
|
-
import { type
|
|
4
|
-
declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* affordance, not content, and matching the icon's weight makes it compete with
|
|
19
|
-
* the label. `text-muted-foreground` for the same reason.
|
|
20
|
-
*/
|
|
21
|
-
declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<ContextMenuPrimitive.ContextMenuSubTriggerProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
|
|
2
|
+
import { MenuPortalPassthrough, MenuSub, type MenuRootProps } from './menu-base.js';
|
|
3
|
+
declare function ContextMenu({ onOpenChange, dir: _dir, children, ...props }: Omit<MenuRootProps, 'open' | 'defaultOpen'> & {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
}): React.JSX.Element;
|
|
7
|
+
/** The right-click area. A `<span>` unless `asChild`, as on Radix. */
|
|
8
|
+
declare const ContextMenuTrigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
9
|
+
asChild?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
12
|
+
declare const ContextMenuPortal: typeof MenuPortalPassthrough;
|
|
13
|
+
declare const ContextMenuSub: typeof MenuSub;
|
|
14
|
+
declare const ContextMenuRadioGroup: React.ForwardRefExoticComponent<import("./menu-base.js").MenuRadioGroupProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const ContextMenuGroup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
declare const ContextMenuSubTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
22
17
|
inset?: boolean;
|
|
23
|
-
size?: MenuRowSize;
|
|
18
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
textValue?: string;
|
|
21
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
declare const ContextMenuSubContent: 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 & {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
forceMount?: true;
|
|
25
|
+
loop?: boolean;
|
|
26
|
+
container?: HTMLElement;
|
|
27
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
28
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
29
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
declare const ContextMenuContent: 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 & {
|
|
31
|
+
asChild?: boolean;
|
|
32
|
+
forceMount?: true;
|
|
33
|
+
loop?: boolean;
|
|
34
|
+
container?: HTMLElement;
|
|
35
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
36
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
24
37
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
-
declare const
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
declare const ContextMenuItem: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
39
|
+
asChild?: boolean;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
textValue?: string;
|
|
42
|
+
onSelect?: (event: Event) => void;
|
|
43
|
+
} & {
|
|
28
44
|
inset?: boolean;
|
|
29
45
|
variant?: "default" | "destructive";
|
|
30
|
-
size?: MenuRowSize;
|
|
46
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
31
47
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
-
declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<
|
|
48
|
+
declare const ContextMenuCheckboxItem: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
49
|
+
asChild?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
textValue?: string;
|
|
52
|
+
onSelect?: (event: Event) => void;
|
|
53
|
+
}, "onChange"> & {
|
|
54
|
+
checked?: boolean | "indeterminate";
|
|
55
|
+
defaultChecked?: boolean;
|
|
56
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
33
57
|
reverse?: boolean;
|
|
34
|
-
size?: MenuRowSize;
|
|
58
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
35
59
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
36
|
-
declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<
|
|
37
|
-
|
|
60
|
+
declare const ContextMenuRadioItem: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "onSelect"> & {
|
|
61
|
+
asChild?: boolean;
|
|
62
|
+
disabled?: boolean;
|
|
63
|
+
textValue?: string;
|
|
64
|
+
onSelect?: (event: Event) => void;
|
|
65
|
+
} & {
|
|
66
|
+
value: string;
|
|
67
|
+
size?: import("./menu-recipe.js").MenuRowSize;
|
|
38
68
|
side?: "left" | "right";
|
|
39
69
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
-
declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<
|
|
70
|
+
declare const ContextMenuLabel: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
41
71
|
inset?: boolean;
|
|
42
72
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
-
declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<
|
|
73
|
+
declare const ContextMenuSeparator: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
44
74
|
declare const ContextMenuShortcut: {
|
|
45
75
|
({ className, ...props }: React.HTMLAttributes<HTMLSpanElement>): React.JSX.Element;
|
|
46
76
|
displayName: string;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx
|
|
3
|
-
import {
|
|
4
|
-
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { ContextMenu as ContextMenuPrimitive } from '@base-ui/react/context-menu';
|
|
5
4
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
5
|
+
import { asChildRender, openState, stateRender } from '../lib/base-ui-compat.js';
|
|
7
6
|
import { cn } from '../lib/utils.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { makeMenuCheckboxItem, makeMenuItem, makeMenuLabel, makeMenuRadioItem, makeMenuSeparator, makeMenuSubTrigger, MenuContentImpl, MenuGroup, MenuPortalPassthrough, MenuPrimitive, MenuRadioGroup, MenuSub, useMenuRoot, } from './menu-base.js';
|
|
8
|
+
import { MENU_PANEL, MENU_SHORTCUT } from './menu-recipe.js';
|
|
10
9
|
/**
|
|
11
10
|
* A right-click menu is the same menu as a click menu. It shares the row
|
|
12
11
|
* recipe, panel, label, separator and shortcut in `./menu-recipe` with
|
|
@@ -37,56 +36,44 @@ import { MENU_INDICATOR, MENU_INDICATOR_ICON, MENU_INSET, MENU_INSET_END, MENU_L
|
|
|
37
36
|
* right-click and must stay visually untouched.
|
|
38
37
|
*/
|
|
39
38
|
const CONTEXT_PANEL = cn(MENU_PANEL, 'min-w-[8rem] origin-(--radix-context-menu-content-transform-origin)');
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* submenu trigger is a row like any other and has to line up with its siblings.
|
|
49
|
-
*
|
|
50
|
-
* The caret is `size-3.5` against the leading icon's `size-4`: it is an
|
|
51
|
-
* affordance, not content, and matching the icon's weight makes it compete with
|
|
52
|
-
* the label. `text-muted-foreground` for the same reason.
|
|
53
|
-
*/
|
|
54
|
-
const ContextMenuSubTrigger = React.forwardRef(({ className, inset, size = 'sm', children, ...props }, ref) => (_jsxs(ContextMenuPrimitive.SubTrigger, { ref: ref, "data-slot": "context-menu-sub-trigger", className: cn(menuRow(size, 'default'), inset && MENU_INSET, className), ...props, children: [children, _jsx(ChevronRight, { className: "text-muted-foreground ml-auto size-3.5" })] })));
|
|
55
|
-
ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
|
|
56
|
-
const ContextMenuSubContent = React.forwardRef(({ className, sideOffset = 4, style, ...props }, ref) => {
|
|
57
|
-
const depth = useDialogDepth();
|
|
58
|
-
return (_jsx(ContextMenuPrimitive.SubContent, { ref: ref, sideOffset: sideOffset, "data-slot": "context-menu-sub-content", className: cn(CONTEXT_PANEL, 'overflow-hidden', className), style: { zIndex: floatingZ(depth), ...style }, ...props }));
|
|
39
|
+
function ContextMenu({ onOpenChange, dir: _dir, children, ...props }) {
|
|
40
|
+
const root = useMenuRoot(onOpenChange);
|
|
41
|
+
return root.wrap(_jsx(ContextMenuPrimitive.Root, { ...props, onOpenChange: root.onOpenChange, children: children }));
|
|
42
|
+
}
|
|
43
|
+
/** The right-click area. A `<span>` unless `asChild`, as on Radix. */
|
|
44
|
+
const ContextMenuTrigger = React.forwardRef(({ asChild, children, disabled: _disabled, ...props }, ref) => {
|
|
45
|
+
const slot = asChildRender(asChild, children);
|
|
46
|
+
return (_jsx(ContextMenuPrimitive.Trigger, { ref: ref, ...props, render: stateRender('span', openState, slot.render), children: slot.children }));
|
|
59
47
|
});
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
ContextMenuTrigger.displayName = 'ContextMenuTrigger';
|
|
49
|
+
const ContextMenuPortal = MenuPortalPassthrough;
|
|
50
|
+
const ContextMenuSub = MenuSub;
|
|
51
|
+
const ContextMenuRadioGroup = MenuRadioGroup;
|
|
52
|
+
const ContextMenuGroup = MenuGroup;
|
|
53
|
+
const ContextMenuSubTrigger = makeMenuSubTrigger('context-menu-sub-trigger');
|
|
54
|
+
ContextMenuSubTrigger.displayName = 'ContextMenuSubTrigger';
|
|
55
|
+
// `sideOffset={4}` matches the dropdown: 4px of daylight keeps the two panels
|
|
56
|
+
// legible as parent and child, and the safe-polygon pointer tracking covers
|
|
57
|
+
// the gap, so the submenu does not close while the cursor crosses it.
|
|
58
|
+
const ContextMenuSubContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
59
|
+
return (_jsx(MenuContentImpl, { ref: ref, Positioner: MenuPrimitive.Positioner, varName: "context-menu", ...props, sideOffset: sideOffset, "data-slot": "context-menu-sub-content", className: cn(CONTEXT_PANEL, 'overflow-hidden', className) }));
|
|
64
60
|
});
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
const ContextMenuCheckboxItem = React.forwardRef(({ className, children, checked, reverse, size = 'sm', ...props }, ref) => (_jsxs(ContextMenuPrimitive.CheckboxItem, { ref: ref, "data-slot": "context-menu-checkbox-item",
|
|
69
|
-
// Same geometry as `DropdownMenuCheckboxItem` — see there.
|
|
70
|
-
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(ContextMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }), children] })));
|
|
71
|
-
ContextMenuCheckboxItem.displayName = ContextMenuPrimitive.CheckboxItem.displayName;
|
|
72
|
-
const ContextMenuRadioItem = React.forwardRef(({ className, children, size = 'sm', side = 'right', ...props }, ref) => {
|
|
73
|
-
/**
|
|
74
|
-
* A check, not a dot, and the same check `ContextMenuCheckboxItem` uses.
|
|
75
|
-
*
|
|
76
|
-
* This was `<CircleIcon className="size-2 fill-current" />`, which could not
|
|
77
|
-
* work: Phosphor's CircleIcon is a stroked outline, so `fill-current` painted
|
|
78
|
-
* nothing, and the row recipe's `[&_svg]:size-4` — a descendant selector —
|
|
79
|
-
* outranked the `size-2` sitting on the icon itself. The mark rendered as a
|
|
80
|
-
* hollow ring. No consumer renders a RadioItem, so nobody saw it.
|
|
81
|
-
*/
|
|
82
|
-
const indicator = (_jsx("span", { className: MENU_INDICATOR, children: _jsx(ContextMenuPrimitive.ItemIndicator, { children: _jsx(Check, { className: MENU_INDICATOR_ICON }) }) }));
|
|
83
|
-
return (_jsx(ContextMenuPrimitive.RadioItem, { ref: ref, "data-slot": "context-menu-radio-item", className: cn(menuRow(size, 'default'), className), ...props, children: side === 'left' ? (_jsxs(_Fragment, { children: [indicator, _jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: children })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "flex min-w-0 flex-1 items-center gap-2", children: children }), indicator] })) }));
|
|
61
|
+
ContextMenuSubContent.displayName = 'ContextMenuSubContent';
|
|
62
|
+
const ContextMenuContent = React.forwardRef(({ className, ...props }, ref) => {
|
|
63
|
+
return (_jsx(MenuContentImpl, { ref: ref, Positioner: ContextMenuPrimitive.Positioner, varName: "context-menu", ...props, "data-slot": "context-menu-content", className: cn(CONTEXT_PANEL, 'max-h-(--radix-context-menu-content-available-height) overflow-x-hidden overflow-y-auto', className) }));
|
|
84
64
|
});
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
65
|
+
ContextMenuContent.displayName = 'ContextMenuContent';
|
|
66
|
+
const ContextMenuItem = makeMenuItem('context-menu-item');
|
|
67
|
+
ContextMenuItem.displayName = 'ContextMenuItem';
|
|
68
|
+
// Same geometry as `DropdownMenuCheckboxItem` — see there.
|
|
69
|
+
const ContextMenuCheckboxItem = makeMenuCheckboxItem('context-menu-checkbox-item');
|
|
70
|
+
ContextMenuCheckboxItem.displayName = 'ContextMenuCheckboxItem';
|
|
71
|
+
const ContextMenuRadioItem = makeMenuRadioItem('context-menu-radio-item');
|
|
72
|
+
ContextMenuRadioItem.displayName = 'ContextMenuRadioItem';
|
|
73
|
+
const ContextMenuLabel = makeMenuLabel('context-menu-label');
|
|
74
|
+
ContextMenuLabel.displayName = 'ContextMenuLabel';
|
|
75
|
+
const ContextMenuSeparator = makeMenuSeparator('context-menu-separator');
|
|
76
|
+
ContextMenuSeparator.displayName = 'ContextMenuSeparator';
|
|
90
77
|
const ContextMenuShortcut = ({ className, ...props }) => {
|
|
91
78
|
return (_jsx("span", { "data-slot": "context-menu-shortcut", className: cn(MENU_SHORTCUT, className), ...props }));
|
|
92
79
|
};
|
|
@@ -1,18 +1,52 @@
|
|
|
1
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { type DismissHandlers } from '../lib/base-ui-compat.js';
|
|
4
4
|
import { type TriggerVariantProps } from './trigger-variants.js';
|
|
5
|
+
export interface DialogProps {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onOpenChange?: (open: boolean) => void;
|
|
9
|
+
modal?: boolean;
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
5
12
|
/** @deprecated In feature code use `Modal` (`@kortix/ui/modal`). `Dialog` is the primitive other components build on. */
|
|
6
|
-
declare const Dialog: ({ open, defaultOpen, onOpenChange,
|
|
7
|
-
declare const DialogTrigger:
|
|
13
|
+
declare const Dialog: ({ open, defaultOpen, onOpenChange, modal, children }: DialogProps) => React.JSX.Element;
|
|
14
|
+
declare const DialogTrigger: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
} & TriggerVariantProps & React.RefAttributes<HTMLButtonElement>>;
|
|
8
17
|
declare const DialogPortal: {
|
|
9
|
-
(props:
|
|
18
|
+
(props: Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & React.RefAttributes<HTMLDivElement>): React.JSX.Element;
|
|
10
19
|
displayName: string;
|
|
11
20
|
};
|
|
12
|
-
declare const DialogClose: React.ForwardRefExoticComponent<
|
|
13
|
-
|
|
21
|
+
declare const DialogClose: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "size"> & {
|
|
22
|
+
asChild?: boolean;
|
|
23
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
|
+
declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
/** The Radix `Content` props the dialog family still accepts. */
|
|
26
|
+
export type DialogContentBaseProps = React.ComponentPropsWithoutRef<'div'> & DismissHandlers & {
|
|
27
|
+
asChild?: boolean;
|
|
28
|
+
forceMount?: true;
|
|
29
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
30
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The dialog popup with the Radix content contract: `data-state`, dismiss
|
|
34
|
+
* handlers, auto-focus handlers and `forceMount`. `DialogContent`, `Sheet`,
|
|
35
|
+
* `Modal` and `AlertDialog` build on it.
|
|
36
|
+
*/
|
|
37
|
+
declare const DialogPopup: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & DismissHandlers & {
|
|
38
|
+
asChild?: boolean;
|
|
39
|
+
forceMount?: true;
|
|
40
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
41
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
42
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
14
43
|
/** @deprecated In feature code use `ModalContent` (`@kortix/ui/modal`). */
|
|
15
|
-
declare const DialogContent: React.ForwardRefExoticComponent<Omit<
|
|
44
|
+
declare const DialogContent: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & DismissHandlers & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
forceMount?: true;
|
|
47
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
48
|
+
onCloseAutoFocus?: (event: Event) => void;
|
|
49
|
+
} & VariantProps<(props?: ({
|
|
16
50
|
variant?: "default" | "transparent" | null | undefined;
|
|
17
51
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
|
|
18
52
|
hideCloseButton?: boolean;
|
|
@@ -27,6 +61,10 @@ declare const DialogFooter: {
|
|
|
27
61
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
28
62
|
displayName: string;
|
|
29
63
|
};
|
|
30
|
-
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<
|
|
31
|
-
|
|
32
|
-
|
|
64
|
+
declare const DialogTitle: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, "ref"> & {
|
|
65
|
+
asChild?: boolean;
|
|
66
|
+
} & React.RefAttributes<HTMLHeadingElement>>;
|
|
67
|
+
declare const DialogDescription: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
68
|
+
asChild?: boolean;
|
|
69
|
+
} & React.RefAttributes<HTMLParagraphElement>>;
|
|
70
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -1,30 +1,42 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
3
|
+
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
5
6
|
import { Close } from '../icons/close.js';
|
|
7
|
+
import { asChildRender, composeRefs, DismissProvider, focusProps, openState, stateRender, useDismissContent, useDismissRoot, useNativeButton, } from '../lib/base-ui-compat.js';
|
|
6
8
|
import { withPortalContainer } from '../lib/portal-container.js';
|
|
7
9
|
import { cn } from '../lib/utils.js';
|
|
8
|
-
import { useUiStrings } from '../providers/ui-provider.js';
|
|
9
10
|
import { dialogContentZ, DialogDepthProvider, dialogOverlayZ, useDialogDepth, useDialogRootLayer, } from '../lib/z-stack.js';
|
|
10
|
-
import {
|
|
11
|
+
import { useUiStrings } from '../providers/ui-provider.js';
|
|
11
12
|
import { buttonVariants } from './button.js';
|
|
12
13
|
import { triggerVariants } from './trigger-variants.js';
|
|
13
14
|
/** @deprecated In feature code use `Modal` (`@kortix/ui/modal`). `Dialog` is the primitive other components build on. */
|
|
14
|
-
const Dialog = ({ open, defaultOpen, onOpenChange,
|
|
15
|
+
const Dialog = ({ open, defaultOpen, onOpenChange, modal, children }) => {
|
|
15
16
|
const layer = useDialogRootLayer({ open, defaultOpen, onOpenChange });
|
|
16
|
-
|
|
17
|
+
const dismiss = useDismissRoot(layer.onOpenChange);
|
|
18
|
+
return (_jsx(DialogDepthProvider, { depth: layer.depth, children: _jsx(DismissProvider, { kind: "dialog", registry: dismiss.registry, children: _jsx(DialogPrimitive.Root, { open: layer.open, onOpenChange: dismiss.onOpenChange, modal: modal, children: children }) }) }));
|
|
17
19
|
};
|
|
18
|
-
const DialogTrigger = ({ className, variant, size, asChild, ...props }) =>
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
const DialogTrigger = React.forwardRef(({ className, variant, size, asChild, children, ...props }, ref) => {
|
|
21
|
+
const slot = asChildRender(asChild, children);
|
|
22
|
+
const native = useNativeButton(asChild, children);
|
|
23
|
+
return (_jsx(DialogPrimitive.Trigger, { ref: composeRefs(ref, native.ref), ...props,
|
|
24
|
+
// With `asChild` the child owns its styling — merging ours would double it.
|
|
25
|
+
className: asChild ? className : cn(triggerVariants({ variant, size }), className), render: stateRender('button', openState, slot.render), nativeButton: native.nativeButton, children: slot.children }));
|
|
26
|
+
});
|
|
27
|
+
DialogTrigger.displayName = 'DialogTrigger';
|
|
21
28
|
const DialogPortal = withPortalContainer(DialogPrimitive.Portal);
|
|
22
|
-
const DialogClose =
|
|
29
|
+
const DialogClose = React.forwardRef(({ asChild, children, ...props }, ref) => {
|
|
30
|
+
const slot = asChildRender(asChild, children);
|
|
31
|
+
const native = useNativeButton(asChild, children);
|
|
32
|
+
return (_jsx(DialogPrimitive.Close, { ref: composeRefs(ref, native.ref), ...props, render: slot.render, nativeButton: native.nativeButton, children: slot.children }));
|
|
33
|
+
});
|
|
34
|
+
DialogClose.displayName = 'DialogClose';
|
|
23
35
|
const DialogOverlay = React.forwardRef(({ className, style, ...props }, ref) => {
|
|
24
36
|
const depth = useDialogDepth();
|
|
25
|
-
return (_jsx(DialogPrimitive.
|
|
37
|
+
return (_jsx(DialogPrimitive.Backdrop, { ref: ref, className: cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 duration-moderate fixed inset-0 bg-black/65 backdrop-blur-xs', className), style: { zIndex: dialogOverlayZ(depth), ...style }, render: stateRender('div', openState), ...props }));
|
|
26
38
|
});
|
|
27
|
-
DialogOverlay.displayName =
|
|
39
|
+
DialogOverlay.displayName = 'DialogOverlay';
|
|
28
40
|
const DialogVariants = cva(cn('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 border p-5 shadow-lg duration-moderate sm:max-w-lg sm:rounded-lg'), {
|
|
29
41
|
variants: {
|
|
30
42
|
variant: {
|
|
@@ -36,19 +48,36 @@ const DialogVariants = cva(cn('data-[state=open]:animate-in data-[state=closed]:
|
|
|
36
48
|
variant: 'transparent',
|
|
37
49
|
},
|
|
38
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* The dialog popup with the Radix content contract: `data-state`, dismiss
|
|
53
|
+
* handlers, auto-focus handlers and `forceMount`. `DialogContent`, `Sheet`,
|
|
54
|
+
* `Modal` and `AlertDialog` build on it.
|
|
55
|
+
*/
|
|
56
|
+
const DialogPopup = React.forwardRef(({ asChild, children, forceMount: _forceMount, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onOpenAutoFocus, onCloseAutoFocus, ...props }, ref) => {
|
|
57
|
+
useDismissContent('dialog', {
|
|
58
|
+
onEscapeKeyDown,
|
|
59
|
+
onPointerDownOutside,
|
|
60
|
+
onFocusOutside,
|
|
61
|
+
onInteractOutside,
|
|
62
|
+
});
|
|
63
|
+
const slot = asChildRender(asChild, children);
|
|
64
|
+
const popupRef = React.useRef(null);
|
|
65
|
+
return (_jsx(DialogPrimitive.Popup, { ref: composeRefs(ref, popupRef), ...props, ...focusProps(() => popupRef.current, onOpenAutoFocus, onCloseAutoFocus), render: stateRender('div', openState, slot.render), children: slot.children }));
|
|
66
|
+
});
|
|
67
|
+
DialogPopup.displayName = 'DialogPopup';
|
|
39
68
|
/** @deprecated In feature code use `ModalContent` (`@kortix/ui/modal`). */
|
|
40
|
-
const DialogContent = React.forwardRef(({ className, children, hideCloseButton = false, showOverlay = true, overlayClassName, style, ...props }, ref) => {
|
|
69
|
+
const DialogContent = React.forwardRef(({ className, children, hideCloseButton = false, showOverlay = true, overlayClassName, style, forceMount, variant: _variant, ...props }, ref) => {
|
|
41
70
|
const depth = useDialogDepth();
|
|
42
71
|
const strings = useUiStrings();
|
|
43
|
-
return (_jsxs(DialogPortal, { children: [showOverlay && _jsx(DialogOverlay, { className: overlayClassName }), _jsxs(
|
|
72
|
+
return (_jsxs(DialogPortal, { keepMounted: forceMount, children: [showOverlay && _jsx(DialogOverlay, { className: overlayClassName }), _jsxs(DialogPopup, { ref: ref, className: cn(DialogVariants({ variant: 'default' }), className), style: { zIndex: dialogContentZ(depth), ...style }, ...props, children: [children, !hideCloseButton && (_jsxs(DialogPrimitive.Close, { className: cn(buttonVariants({ variant: 'ghost', size: 'icon' }), 'absolute top-3 right-3'), children: [_jsx(Close, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: strings.close })] }))] })] }));
|
|
44
73
|
});
|
|
45
|
-
DialogContent.displayName =
|
|
74
|
+
DialogContent.displayName = 'DialogContent';
|
|
46
75
|
const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
|
|
47
76
|
DialogHeader.displayName = 'DialogHeader';
|
|
48
77
|
const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
|
|
49
78
|
DialogFooter.displayName = 'DialogFooter';
|
|
50
|
-
const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg leading-none font-semibold tracking-tight', className), ...props })));
|
|
51
|
-
DialogTitle.displayName =
|
|
52
|
-
const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn('text-muted-foreground text-sm', className), ...props })));
|
|
53
|
-
DialogDescription.displayName =
|
|
54
|
-
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
79
|
+
const DialogTitle = React.forwardRef(({ className, asChild, children, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ...asChildRender(asChild, children), ref: ref, className: cn('text-lg leading-none font-semibold tracking-tight', className), ...props })));
|
|
80
|
+
DialogTitle.displayName = 'DialogTitle';
|
|
81
|
+
const DialogDescription = React.forwardRef(({ className, asChild, children, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ...asChildRender(asChild, children), ref: ref, className: cn('text-muted-foreground text-sm', className), ...props })));
|
|
82
|
+
DialogDescription.displayName = 'DialogDescription';
|
|
83
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, };
|
|
@@ -49,7 +49,7 @@ export type DisclosureProviderProps = {
|
|
|
49
49
|
};
|
|
50
50
|
/**
|
|
51
51
|
* Controlled OR uncontrolled, with exactly one source of truth for `open` —
|
|
52
|
-
* the same contract every
|
|
52
|
+
* the same contract every `@kortix/ui` primitive uses.
|
|
53
53
|
*
|
|
54
54
|
* This replaces a mirrored-state design that copied `open` into internal state
|
|
55
55
|
* and reconciled the two in a `useEffect`. That shape produced the reported
|
|
@@ -21,7 +21,7 @@ export function resolveDisclosureToggle(state) {
|
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
23
|
* Controlled OR uncontrolled, with exactly one source of truth for `open` —
|
|
24
|
-
* the same contract every
|
|
24
|
+
* the same contract every `@kortix/ui` primitive uses.
|
|
25
25
|
*
|
|
26
26
|
* This replaces a mirrored-state design that copied `open` into internal state
|
|
27
27
|
* and reconciled the two in a `useEffect`. That shape produced the reported
|
|
@@ -110,7 +110,7 @@ export function DisclosureTrigger({ children, className, variant = 'default', })
|
|
|
110
110
|
return;
|
|
111
111
|
if (e.key === 'Enter' || e.key === ' ') {
|
|
112
112
|
// Activate before preventing the default: a composed handler
|
|
113
|
-
// (
|
|
113
|
+
// (a tooltip trigger's) may skip a prevented event.
|
|
114
114
|
activate(e);
|
|
115
115
|
e.preventDefault();
|
|
116
116
|
}
|